| Line 1... |
Line 1... |
| 1 |
|
1 |
|
| 2 |
R Under development (unstable) (2021-09-02 r80849) -- "Unsuffered Consequences"
|
2 |
R Under development (unstable) (2021-10-13 r81047) -- "Unsuffered Consequences"
|
| 3 |
Copyright (C) 2021 The R Foundation for Statistical Computing
|
3 |
Copyright (C) 2021 The R Foundation for Statistical Computing
|
| 4 |
Platform: x86_64-pc-linux-gnu (64-bit)
|
4 |
Platform: x86_64-pc-linux-gnu (64-bit)
|
| 5 |
|
5 |
|
| 6 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
6 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
| 7 |
You are welcome to redistribute it under certain conditions.
|
7 |
You are welcome to redistribute it under certain conditions.
|
| Line 1257... |
Line 1257... |
| 1257 |
> try( # maxiter=10: store less garbage
|
1257 |
> try( # maxiter=10: store less garbage
|
| 1258 |
+ nls(conc ~ SSbiexp(time, A1, lrc1, A2, lrc2), data = datN,
|
1258 |
+ nls(conc ~ SSbiexp(time, A1, lrc1, A2, lrc2), data = datN,
|
| 1259 |
+ trace=TRUE, control = list(maxiter = 10)) )
|
1259 |
+ trace=TRUE, control = list(maxiter = 10)) )
|
| 1260 |
0.01722077 (5.34e+02): par = (0.6168807 -1.783839 2.050204 0.2004597)
|
1260 |
0.01722077 (5.34e+02): par = (0.6168807 -1.783839 2.050204 0.2004597)
|
| 1261 |
3.308944e-06 (1.13e+04): par = (0.5798674 -1.784335 2.028943 0.1920502)
|
1261 |
3.308944e-06 (1.13e+04): par = (0.5798674 -1.784335 2.028943 0.1920502)
|
| 1262 |
2.571093e-11 (7.68e+06): par = (0.5793882 -1.78778 2.029276 0.1915479)
|
1262 |
2.571095e-11 (7.68e+06): par = (0.5793882 -1.78778 2.029276 0.1915479)
|
| 1263 |
1.633875e-23 (4.26e+03): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1263 |
1.619248e-23 (5.90e+03): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| 1264 |
5.883240e-29 (1.32e+01): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1264 |
1.243570e-28 (8.88e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| 1265 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1265 |
2.599121e-29 (1.38e+01): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| 1266 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1266 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| 1267 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1267 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| 1268 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1268 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| 1269 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1269 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| 1270 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1270 |
1.292713e-29 (1.71e+00): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| Line 1277... |
Line 1277... |
| 1277 |
0.01722077 (6.55e-02): par = (0.6168807 -1.783839 2.050204 0.2004597)
|
1277 |
0.01722077 (6.55e-02): par = (0.6168807 -1.783839 2.050204 0.2004597)
|
| 1278 |
It. 1, fac= 1, eval (no.,total): ( 1, 1): new dev = 3.30894e-06
|
1278 |
It. 1, fac= 1, eval (no.,total): ( 1, 1): new dev = 3.30894e-06
|
| 1279 |
3.308942e-06 (9.08e-04): par = (0.5798674 -1.784335 2.028943 0.1920502)
|
1279 |
3.308942e-06 (9.08e-04): par = (0.5798674 -1.784335 2.028943 0.1920502)
|
| 1280 |
It. 2, fac= 1, eval (no.,total): ( 1, 2): new dev = 2.57108e-11
|
1280 |
It. 2, fac= 1, eval (no.,total): ( 1, 2): new dev = 2.57108e-11
|
| 1281 |
2.571082e-11 (2.53e-06): par = (0.5793882 -1.78778 2.029276 0.1915479)
|
1281 |
2.571082e-11 (2.53e-06): par = (0.5793882 -1.78778 2.029276 0.1915479)
|
| 1282 |
It. 3, fac= 1, eval (no.,total): ( 1, 3): new dev = 1.66922e-23
|
1282 |
It. 3, fac= 1, eval (no.,total): ( 1, 3): new dev = 1.66996e-23
|
| 1283 |
1.669220e-23 (2.04e-12): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
1283 |
1.669964e-23 (2.04e-12): par = (0.5793887 -1.787785 2.029277 0.1915474)
|
| 1284 |
1.670353e-23 (1.67e-13): par = (2.029277 0.5793887 0.1915474 -1.787785)
|
1284 |
1.671287e-23 (1.67e-13): par = (2.029277 0.5793887 0.1915474 -1.787785)
|
| 1285 |
> all.equal(coef(fm1), coef(fmX1), tolerance=0) # ... rel.diff.: 1.57e-6
|
1285 |
> all.equal(coef(fm1), coef(fmX1), tolerance=0) # ... rel.diff.: 1.57e-6
|
| 1286 |
[1] "Mean relative difference: 1.574125e-06"
|
1286 |
[1] "Mean relative difference: 1.574124e-06"
|
| 1287 |
> all.equal(coef(fm1), coef(fmX), tolerance=0) # ... rel.diff.: 1.03e-12
|
1287 |
> all.equal(coef(fm1), coef(fmX), tolerance=0) # ... rel.diff.: 1.03e-12
|
| 1288 |
[1] "Mean relative difference: 1.031784e-12"
|
1288 |
[1] "Mean relative difference: 1.032014e-12"
|
| 1289 |
> ## IGNORE_RDIFF_END
|
1289 |
> ## IGNORE_RDIFF_END
|
| 1290 |
> stopifnot(all.equal(coef(fm1), coef(fmX1), tolerance = 6e-6),
|
1290 |
> stopifnot(all.equal(coef(fm1), coef(fmX1), tolerance = 6e-6),
|
| 1291 |
+ all.equal(coef(fm1), coef(fmX ), tolerance = 1e-11))
|
1291 |
+ all.equal(coef(fm1), coef(fmX ), tolerance = 1e-11))
|
| 1292 |
>
|
1292 |
>
|
| 1293 |
>
|
1293 |
>
|
| Line 3992... |
Line 3992... |
| 3992 |
>
|
3992 |
>
|
| 3993 |
> ### ** Examples
|
3993 |
> ### ** Examples
|
| 3994 |
>
|
3994 |
>
|
| 3995 |
> asOneSidedFormula("age")
|
3995 |
> asOneSidedFormula("age")
|
| 3996 |
~age
|
3996 |
~age
|
| 3997 |
<environment: 0x564b7d38cbb0>
|
3997 |
<environment: 0x32a3fb8>
|
| 3998 |
> asOneSidedFormula(~ age)
|
3998 |
> asOneSidedFormula(~ age)
|
| 3999 |
~age
|
3999 |
~age
|
| 4000 |
>
|
4000 |
>
|
| 4001 |
>
|
4001 |
>
|
| 4002 |
>
|
4002 |
>
|
| Line 5029... |
Line 5029... |
| 5029 |
r <- V
|
5029 |
r <- V
|
| 5030 |
r[] <- Is * V * rep(Is, each = p)
|
5030 |
r[] <- Is * V * rep(Is, each = p)
|
| 5031 |
r[cbind(1L:p, 1L:p)] <- 1
|
5031 |
r[cbind(1L:p, 1L:p)] <- 1
|
| 5032 |
r
|
5032 |
r
|
| 5033 |
}
|
5033 |
}
|
| 5034 |
<bytecode: 0x564b798dd788>
|
5034 |
<bytecode: 0x5b09fd0>
|
| 5035 |
<environment: namespace:stats>
|
5035 |
<environment: namespace:stats>
|
| 5036 |
> stopifnot(all.equal(Cl, cov2cor(cov(longley))),
|
5036 |
> stopifnot(all.equal(Cl, cov2cor(cov(longley))),
|
| 5037 |
+ all.equal(cor(longley, method = "kendall"),
|
5037 |
+ all.equal(cor(longley, method = "kendall"),
|
| 5038 |
+ cov2cor(cov(longley, method = "kendall"))))
|
5038 |
+ cov2cor(cov(longley, method = "kendall"))))
|
| 5039 |
>
|
5039 |
>
|
| Line 7546... |
Line 7546... |
| 7546 |
alternative hypothesis: two.sided
|
7546 |
alternative hypothesis: two.sided
|
| 7547 |
|
7547 |
|
| 7548 |
> # Exactly the same p-value, as Cochran's conditions are never met:
|
7548 |
> # Exactly the same p-value, as Cochran's conditions are never met:
|
| 7549 |
> fisher.test(MP6, hybrid=TRUE)
|
7549 |
> fisher.test(MP6, hybrid=TRUE)
|
| 7550 |
|
7550 |
|
| 7551 |
Fisher's Exact Test for Count Data hybrid using asym.chisq. iff
|
7551 |
Fisher's Exact Test for Count Data hybrid using asym.chisq. iff (exp=5,
|
| 7552 |
(exp=5, perc=80, Emin=1)
|
7552 |
perc=80, Emin=1)
|
| 7553 |
|
7553 |
|
| 7554 |
data: MP6
|
7554 |
data: MP6
|
| 7555 |
p-value = 0.03929
|
7555 |
p-value = 0.03929
|
| 7556 |
alternative hypothesis: two.sided
|
7556 |
alternative hypothesis: two.sided
|
| 7557 |
|
7557 |
|
| Line 7653... |
Line 7653... |
| 7653 |
> environment(fo)
|
7653 |
> environment(fo)
|
| 7654 |
<environment: R_GlobalEnv>
|
7654 |
<environment: R_GlobalEnv>
|
| 7655 |
> environment(as.formula("y ~ x"))
|
7655 |
> environment(as.formula("y ~ x"))
|
| 7656 |
<environment: R_GlobalEnv>
|
7656 |
<environment: R_GlobalEnv>
|
| 7657 |
> environment(as.formula("y ~ x", env = new.env()))
|
7657 |
> environment(as.formula("y ~ x", env = new.env()))
|
| 7658 |
<environment: 0x564b7a1d19e8>
|
7658 |
<environment: 0x691c4e8>
|
| 7659 |
>
|
7659 |
>
|
| 7660 |
>
|
7660 |
>
|
| 7661 |
> ## Create a formula for a model with a large number of variables:
|
7661 |
> ## Create a formula for a model with a large number of variables:
|
| 7662 |
> xnam <- paste0("x", 1:25)
|
7662 |
> xnam <- paste0("x", 1:25)
|
| 7663 |
> (fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+"))))
|
7663 |
> (fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+"))))
|
| Line 11150... |
Line 11150... |
| 11150 |
> try(nlm1 <- update(nlmod, control = list(tol = 1e-7)))
|
11150 |
> try(nlm1 <- update(nlmod, control = list(tol = 1e-7)))
|
| 11151 |
Warning in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default", :
|
11151 |
Warning in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default", :
|
| 11152 |
No starting values specified for some parameters.
|
11152 |
No starting values specified for some parameters.
|
| 11153 |
Initializing ‘Const’, ‘A’, ‘B’ to '1.'.
|
11153 |
Initializing ‘Const’, ‘A’, ‘B’ to '1.'.
|
| 11154 |
Consider specifying 'start' or using a selfStart model
|
11154 |
Consider specifying 'start' or using a selfStart model
|
| 11155 |
Error in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default", :
|
- |
|
| 11156 |
step factor 0.000488281 reduced below 'minFactor' of 0.000976562
|
- |
|
| 11157 |
> o2 <- options(digits = 10) # more accuracy for 'trace'
|
11155 |
> o2 <- options(digits = 10) # more accuracy for 'trace'
|
| 11158 |
> ## central differencing works here typically (PR#18165: not converging on *some*):
|
11156 |
> ## central differencing works here typically (PR#18165: not converging on *some*):
|
| 11159 |
> ctr2 <- nls.control(nDcentral=TRUE, tol = 8e-8, # <- even smaller than above
|
11157 |
> ctr2 <- nls.control(nDcentral=TRUE, tol = 8e-8, # <- even smaller than above
|
| - |
|
11158 |
+ warnOnly =
|
| - |
|
11159 |
+ TRUE || # << work around; e.g. needed on some ATLAS-Lapack setups
|
| 11160 |
+ warnOnly = (grepl("^aarch64.*linux", R.version$platform) && grepl("^NixOS", osVersion)
|
11160 |
+ (grepl("^aarch64.*linux", R.version$platform) && grepl("^NixOS", osVersion)
|
| 11161 |
+ ))
|
11161 |
+ ))
|
| 11162 |
> (nlm2 <- update(nlmod, control = ctr2, trace = TRUE)); options(o2)
|
11162 |
> (nlm2 <- update(nlmod, control = ctr2, trace = TRUE)); options(o2)
|
| 11163 |
Warning in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default", :
|
11163 |
Warning in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default", :
|
| 11164 |
No starting values specified for some parameters.
|
11164 |
No starting values specified for some parameters.
|
| 11165 |
Initializing ‘Const’, ‘A’, ‘B’ to '1.'.
|
11165 |
Initializing ‘Const’, ‘A’, ‘B’ to '1.'.
|
| 11166 |
Consider specifying 'start' or using a selfStart model
|
11166 |
Consider specifying 'start' or using a selfStart model
|
| 11167 |
1017460.306 (4.15e+02): par = (1 1 1)
|
11167 |
1017460.306 (4.15e+02): par = (1 1 1)
|
| 11168 |
758164.7503 (2.34e+02): par = (13.42031396 1.961485 0.05947543745)
|
11168 |
758164.7503 (2.34e+02): par = (13.42031396 1.961485 0.05947543746)
|
| 11169 |
269506.3537 (3.23e+02): par = (51.75719817 -13.09155958 0.8428607712)
|
11169 |
269506.3540 (3.23e+02): par = (51.75719814 -13.09155954 0.8428607699)
|
| 11170 |
68969.21891 (1.03e+02): par = (76.0006985 -1.93522675 1.0190858)
|
11170 |
68969.21900 (1.03e+02): par = (76.00069849 -1.93522673 1.019085799)
|
| 11171 |
633.3672224 (1.29e+00): par = (100.3761515 8.624648408 5.104490252)
|
11171 |
633.3672239 (1.29e+00): par = (100.3761515 8.62464841 5.104490279)
|
| 11172 |
151.4400170 (9.39e+00): par = (100.6344391 4.913490999 0.2849209664)
|
11172 |
151.4400266 (9.39e+00): par = (100.6344391 4.913490966 0.284920948)
|
| 11173 |
53.08739445 (7.24e+00): par = (100.6830407 6.899303393 0.4637755095)
|
11173 |
53.08740235 (7.24e+00): par = (100.6830408 6.899303242 0.4637755057)
|
| 11174 |
1.344478582 (5.97e-01): par = (100.0368306 9.897714144 0.5169294926)
|
11174 |
1.344478691 (5.97e-01): par = (100.0368306 9.89771414 0.5169294949)
|
| 11175 |
0.9908415908 (1.55e-02): par = (100.0300625 9.9144191 0.5023516843)
|
11175 |
0.9908415909 (1.55e-02): par = (100.0300625 9.9144191 0.5023516842)
|
| 11176 |
0.9906046057 (1.84e-05): par = (100.0288724 9.916224018 0.5025207336)
|
11176 |
0.9906046057 (1.84e-05): par = (100.0288724 9.916224018 0.5025207337)
|
| 11177 |
0.9906046054 (9.94e-08): par = (100.028875 9.916228366 0.50252165)
|
11177 |
0.9906046054 (9.94e-08): par = (100.028875 9.916228366 0.50252165)
|
| 11178 |
0.9906046054 (5.00e-08): par = (100.028875 9.916228377 0.5025216525)
|
11178 |
0.9906046054 (5.06e-10): par = (100.028875 9.916228388 0.5025216549)
|
| 11179 |
Nonlinear regression model
|
11179 |
Nonlinear regression model
|
| 11180 |
model: y ~ Const + A * exp(B * x)
|
11180 |
model: y ~ Const + A * exp(B * x)
|
| 11181 |
data: parent.frame()
|
11181 |
data: parent.frame()
|
| 11182 |
Const A B
|
11182 |
Const A B
|
| 11183 |
100.0288750 9.9162284 0.5025217
|
11183 |
100.0288750 9.9162284 0.5025217
|
| Line 12470... |
Line 12470... |
| 12470 |
[1] "link-glm"
|
12470 |
[1] "link-glm"
|
| 12471 |
> quasi(link = power(1/3))[c("linkfun", "linkinv")]
|
12471 |
> quasi(link = power(1/3))[c("linkfun", "linkinv")]
|
| 12472 |
$linkfun
|
12472 |
$linkfun
|
| 12473 |
function (mu)
|
12473 |
function (mu)
|
| 12474 |
mu^lambda
|
12474 |
mu^lambda
|
| 12475 |
<bytecode: 0x564b7bd79308>
|
12475 |
<bytecode: 0x59e1648>
|
| 12476 |
<environment: 0x564b7c2a9ac0>
|
12476 |
<environment: 0x59e9c68>
|
| 12477 |
|
12477 |
|
| 12478 |
$linkinv
|
12478 |
$linkinv
|
| 12479 |
function (eta)
|
12479 |
function (eta)
|
| 12480 |
pmax(eta^(1/lambda), .Machine$double.eps)
|
12480 |
pmax(eta^(1/lambda), .Machine$double.eps)
|
| 12481 |
<bytecode: 0x564b7bd791b8>
|
12481 |
<bytecode: 0x59e14f8>
|
| 12482 |
<environment: 0x564b7c2a9ac0>
|
12482 |
<environment: 0x59e9c68>
|
| 12483 |
|
12483 |
|
| 12484 |
>
|
12484 |
>
|
| 12485 |
>
|
12485 |
>
|
| 12486 |
>
|
12486 |
>
|
| 12487 |
> cleanEx()
|
12487 |
> cleanEx()
|
| Line 14390... |
Line 14390... |
| 14390 |
>
|
14390 |
>
|
| 14391 |
> smokers <- c( 83, 90, 129, 70 )
|
14391 |
> smokers <- c( 83, 90, 129, 70 )
|
| 14392 |
> patients <- c( 86, 93, 136, 82 )
|
14392 |
> patients <- c( 86, 93, 136, 82 )
|
| 14393 |
> prop.test(smokers, patients)
|
14393 |
> prop.test(smokers, patients)
|
| 14394 |
|
14394 |
|
| 14395 |
4-sample test for equality of proportions without continuity
|
14395 |
4-sample test for equality of proportions without continuity correction
|
| 14396 |
correction
|
- |
|
| 14397 |
|
14396 |
|
| 14398 |
data: smokers out of patients
|
14397 |
data: smokers out of patients
|
| 14399 |
X-squared = 12.6, df = 3, p-value = 0.005585
|
14398 |
X-squared = 12.6, df = 3, p-value = 0.005585
|
| 14400 |
alternative hypothesis: two.sided
|
14399 |
alternative hypothesis: two.sided
|
| 14401 |
sample estimates:
|
14400 |
sample estimates:
|
| Line 14420... |
Line 14419... |
| 14420 |
>
|
14419 |
>
|
| 14421 |
> smokers <- c( 83, 90, 129, 70 )
|
14420 |
> smokers <- c( 83, 90, 129, 70 )
|
| 14422 |
> patients <- c( 86, 93, 136, 82 )
|
14421 |
> patients <- c( 86, 93, 136, 82 )
|
| 14423 |
> prop.test(smokers, patients)
|
14422 |
> prop.test(smokers, patients)
|
| 14424 |
|
14423 |
|
| 14425 |
4-sample test for equality of proportions without continuity
|
14424 |
4-sample test for equality of proportions without continuity correction
|
| 14426 |
correction
|
- |
|
| 14427 |
|
14425 |
|
| 14428 |
data: smokers out of patients
|
14426 |
data: smokers out of patients
|
| 14429 |
X-squared = 12.6, df = 3, p-value = 0.005585
|
14427 |
X-squared = 12.6, df = 3, p-value = 0.005585
|
| 14430 |
alternative hypothesis: two.sided
|
14428 |
alternative hypothesis: two.sided
|
| 14431 |
sample estimates:
|
14429 |
sample estimates:
|
| Line 16749... |
Line 16747... |
| 16749 |
>
|
16747 |
>
|
| 16750 |
> ## look at the internal structure:
|
16748 |
> ## look at the internal structure:
|
| 16751 |
> unclass(sfun0)
|
16749 |
> unclass(sfun0)
|
| 16752 |
function (v)
|
16750 |
function (v)
|
| 16753 |
.approxfun(x, y, v, method, yleft, yright, f, na.rm)
|
16751 |
.approxfun(x, y, v, method, yleft, yright, f, na.rm)
|
| 16754 |
<bytecode: 0x564b7a0c9b98>
|
16752 |
<bytecode: 0x5b2ea30>
|
| 16755 |
<environment: 0x564b7c1c1e38>
|
16753 |
<environment: 0x7496e48>
|
| 16756 |
attr(,"call")
|
16754 |
attr(,"call")
|
| 16757 |
stepfun(1:3, y0, f = 0)
|
16755 |
stepfun(1:3, y0, f = 0)
|
| 16758 |
> ls(envir = environment(sfun0))
|
16756 |
> ls(envir = environment(sfun0))
|
| 16759 |
[1] "f" "method" "na.rm" "x" "y" "yleft" "yright"
|
16757 |
[1] "f" "method" "na.rm" "x" "y" "yleft" "yright"
|
| 16760 |
>
|
16758 |
>
|
| Line 19186... |
Line 19184... |
| 19186 |
> ### * <FOOTER>
|
19184 |
> ### * <FOOTER>
|
| 19187 |
> ###
|
19185 |
> ###
|
| 19188 |
> cleanEx()
|
19186 |
> cleanEx()
|
| 19189 |
> options(digits = 7L)
|
19187 |
> options(digits = 7L)
|
| 19190 |
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
|
19188 |
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
|
| 19191 |
Time elapsed: 4.67 0.127 4.801 0 0
|
19189 |
Time elapsed: 7.667 0.249 7.957 0 0
|
| 19192 |
> grDevices::dev.off()
|
19190 |
> grDevices::dev.off()
|
| 19193 |
null device
|
19191 |
null device
|
| 19194 |
1
|
19192 |
1
|
| 19195 |
> ###
|
19193 |
> ###
|
| 19196 |
> ### Local variables: ***
|
19194 |
> ### Local variables: ***
|