The R Project SVN R

Rev

Rev 63205 | Rev 63381 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 63205 Rev 63207
Line 1... Line 1...
1
 
1
 
2
R Under development (unstable) (2013-07-06 r63204) -- "Unsuffered Consequences"
2
R Under development (unstable) (2013-07-07 r63206) -- "Unsuffered Consequences"
3
Copyright (C) 2013 The R Foundation for Statistical Computing
3
Copyright (C) 2013 The R Foundation for Statistical Computing
4
Platform: x86_64-apple-darwin12.4.0/x86_64 (64-bit)
4
Platform: x86_64-unknown-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.
8
Type 'license()' or 'licence()' for distribution details.
8
Type 'license()' or 'licence()' for distribution details.
9
 
9
 
Line 912... Line 912...
912
      Estimate Std. Error t value Pr(>|t|)    
912
      Estimate Std. Error t value Pr(>|t|)    
913
Asym   94.1282     8.4030  11.202 0.001525 ** 
913
Asym   94.1282     8.4030  11.202 0.001525 ** 
914
resp0  -8.2508     1.2261  -6.729 0.006700 ** 
914
resp0  -8.2508     1.2261  -6.729 0.006700 ** 
915
lrc    -3.2176     0.1386 -23.218 0.000175 ***
915
lrc    -3.2176     0.1386 -23.218 0.000175 ***
916
---
916
---
917
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
917
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
918
 
918
 
919
Residual standard error: 0.7493 on 3 degrees of freedom
919
Residual standard error: 0.7493 on 3 degrees of freedom
920
 
920
 
921
> ## Don't show: 
921
> ## Don't show: 
922
> require(graphics)
922
> require(graphics)
Line 997... Line 997...
997
     Estimate Std. Error t value Pr(>|t|)    
997
     Estimate Std. Error t value Pr(>|t|)    
998
Asym  38.1398     0.9164  41.620 1.99e-06 ***
998
Asym  38.1398     0.9164  41.620 1.99e-06 ***
999
lrc   -4.3806     0.2042 -21.457 2.79e-05 ***
999
lrc   -4.3806     0.2042 -21.457 2.79e-05 ***
1000
c0    51.2232    11.6698   4.389   0.0118 *  
1000
c0    51.2232    11.6698   4.389   0.0118 *  
1001
---
1001
---
1002
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1002
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1003
 
1003
 
1004
Residual standard error: 1.663 on 4 degrees of freedom
1004
Residual standard error: 1.663 on 4 degrees of freedom
1005
 
1005
 
1006
> ## Don't show: 
1006
> ## Don't show: 
1007
> require(graphics)
1007
> require(graphics)
Line 1120... Line 1120...
1120
A1     2.0293     0.1099  18.464 3.39e-07 ***
1120
A1     2.0293     0.1099  18.464 3.39e-07 ***
1121
lrc1   0.5794     0.1247   4.648  0.00235 ** 
1121
lrc1   0.5794     0.1247   4.648  0.00235 ** 
1122
A2     0.1915     0.1106   1.731  0.12698    
1122
A2     0.1915     0.1106   1.731  0.12698    
1123
lrc2  -1.7878     0.7871  -2.271  0.05737 .  
1123
lrc2  -1.7878     0.7871  -2.271  0.05737 .  
1124
---
1124
---
1125
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1125
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1126
 
1126
 
1127
Residual standard error: 0.04103 on 7 degrees of freedom
1127
Residual standard error: 0.04103 on 7 degrees of freedom
1128
 
1128
 
1129
> ## Don't show: 
1129
> ## Don't show: 
1130
>   require(graphics)
1130
>   require(graphics)
Line 1207... Line 1207...
1207
    Estimate Std. Error t value Pr(>|t|)    
1207
    Estimate Std. Error t value Pr(>|t|)    
1208
lKe  -2.9196     0.1709 -17.085 1.40e-07 ***
1208
lKe  -2.9196     0.1709 -17.085 1.40e-07 ***
1209
lKa   0.5752     0.1728   3.328   0.0104 *  
1209
lKa   0.5752     0.1728   3.328   0.0104 *  
1210
lCl  -3.9159     0.1273 -30.768 1.35e-09 ***
1210
lCl  -3.9159     0.1273 -30.768 1.35e-09 ***
1211
---
1211
---
1212
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1212
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1213
 
1213
 
1214
Residual standard error: 0.732 on 8 degrees of freedom
1214
Residual standard error: 0.732 on 8 degrees of freedom
1215
 
1215
 
1216
> 
1216
> 
1217
> 
1217
> 
Line 1266... Line 1266...
1266
A      27.453      6.601   4.159 0.003169 ** 
1266
A      27.453      6.601   4.159 0.003169 ** 
1267
B     348.971     57.899   6.027 0.000314 ***
1267
B     348.971     57.899   6.027 0.000314 ***
1268
xmid   19.391      2.194   8.836 2.12e-05 ***
1268
xmid   19.391      2.194   8.836 2.12e-05 ***
1269
scal    6.673      1.002   6.662 0.000159 ***
1269
scal    6.673      1.002   6.662 0.000159 ***
1270
---
1270
---
1271
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1271
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1272
 
1272
 
1273
Residual standard error: 2.351 on 8 degrees of freedom
1273
Residual standard error: 2.351 on 8 degrees of freedom
1274
 
1274
 
1275
> ## Don't show: 
1275
> ## Don't show: 
1276
> require(graphics)
1276
> require(graphics)
Line 1361... Line 1361...
1361
     Estimate Std. Error t value Pr(>|t|)    
1361
     Estimate Std. Error t value Pr(>|t|)    
1362
Asym  4.60333    0.65321   7.047 8.71e-06 ***
1362
Asym  4.60333    0.65321   7.047 8.71e-06 ***
1363
b2    2.27134    0.14373  15.803 7.24e-10 ***
1363
b2    2.27134    0.14373  15.803 7.24e-10 ***
1364
b3    0.71647    0.02206  32.475 7.85e-14 ***
1364
b3    0.71647    0.02206  32.475 7.85e-14 ***
1365
---
1365
---
1366
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1366
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1367
 
1367
 
1368
Residual standard error: 0.02684 on 13 degrees of freedom
1368
Residual standard error: 0.02684 on 13 degrees of freedom
1369
 
1369
 
1370
> 
1370
> 
1371
> 
1371
> 
Line 1457... Line 1457...
1457
Parameters:
1457
Parameters:
1458
    Estimate Std. Error t value Pr(>|t|)    
1458
    Estimate Std. Error t value Pr(>|t|)    
1459
Vm 2.127e+02  6.947e+00  30.615 3.24e-11 ***
1459
Vm 2.127e+02  6.947e+00  30.615 3.24e-11 ***
1460
K  6.412e-02  8.281e-03   7.743 1.57e-05 ***
1460
K  6.412e-02  8.281e-03   7.743 1.57e-05 ***
1461
---
1461
---
1462
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1462
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1463
 
1463
 
1464
Residual standard error: 10.93 on 10 degrees of freedom
1464
Residual standard error: 10.93 on 10 degrees of freedom
1465
 
1465
 
1466
> ## Alternative call using the subset argument
1466
> ## Alternative call using the subset argument
1467
> fm2 <- nls(rate ~ SSmicmen(conc, Vm, K), data = Puromycin,
1467
> fm2 <- nls(rate ~ SSmicmen(conc, Vm, K), data = Puromycin,
Line 1473... Line 1473...
1473
Parameters:
1473
Parameters:
1474
    Estimate Std. Error t value Pr(>|t|)    
1474
    Estimate Std. Error t value Pr(>|t|)    
1475
Vm 2.127e+02  6.947e+00  30.615 3.24e-11 ***
1475
Vm 2.127e+02  6.947e+00  30.615 3.24e-11 ***
1476
K  6.412e-02  8.281e-03   7.743 1.57e-05 ***
1476
K  6.412e-02  8.281e-03   7.743 1.57e-05 ***
1477
---
1477
---
1478
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1478
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1479
 
1479
 
1480
Residual standard error: 10.93 on 10 degrees of freedom
1480
Residual standard error: 10.93 on 10 degrees of freedom
1481
 
1481
 
1482
> ## Don't show: 
1482
> ## Don't show: 
1483
> require(graphics)
1483
> require(graphics)
Line 1552... Line 1552...
1552
Asym 158.5012     1.1769  134.67 3.28e-13 ***
1552
Asym 158.5012     1.1769  134.67 3.28e-13 ***
1553
Drop 110.9971     2.6330   42.16 1.10e-09 ***
1553
Drop 110.9971     2.6330   42.16 1.10e-09 ***
1554
lrc   -5.9934     0.3733  -16.05 8.83e-07 ***
1554
lrc   -5.9934     0.3733  -16.05 8.83e-07 ***
1555
pwr    2.6461     0.1613   16.41 7.62e-07 ***
1555
pwr    2.6461     0.1613   16.41 7.62e-07 ***
1556
---
1556
---
1557
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1557
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1558
 
1558
 
1559
Residual standard error: 2.061 on 7 degrees of freedom
1559
Residual standard error: 2.061 on 7 degrees of freedom
1560
 
1560
 
1561
> 
1561
> 
1562
> 
1562
> 
Line 1729... Line 1729...
1729
            Df Sum Sq Mean Sq F value  Pr(>F)   
1729
            Df Sum Sq Mean Sq F value  Pr(>F)   
1730
wool         1    451   450.7   3.339 0.07361 . 
1730
wool         1    451   450.7   3.339 0.07361 . 
1731
tension      2   2034  1017.1   7.537 0.00138 **
1731
tension      2   2034  1017.1   7.537 0.00138 **
1732
Residuals   50   6748   135.0                   
1732
Residuals   50   6748   135.0                   
1733
---
1733
---
1734
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1734
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1735
> TukeyHSD(fm1, "tension", ordered = TRUE)
1735
> TukeyHSD(fm1, "tension", ordered = TRUE)
1736
  Tukey multiple comparisons of means
1736
  Tukey multiple comparisons of means
1737
    95% family-wise confidence level
1737
    95% family-wise confidence level
1738
    factor levels have been ordered
1738
    factor levels have been ordered
1739
 
1739
 
Line 1988... Line 1988...
1988
Examination       1        53 2158 190    1.03  0.3155    
1988
Examination       1        53 2158 190    1.03  0.3155    
1989
Education         1      1163 3268 209   22.64 2.4e-05 ***
1989
Education         1      1163 3268 209   22.64 2.4e-05 ***
1990
Catholic          1       448 2553 198    8.72  0.0052 ** 
1990
Catholic          1       448 2553 198    8.72  0.0052 ** 
1991
Infant.Mortality  1       409 2514 197    7.96  0.0073 ** 
1991
Infant.Mortality  1       409 2514 197    7.96  0.0073 ** 
1992
---
1992
---
1993
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
1993
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1994
> 
1994
> 
1995
> ## following example(glm)
1995
> ## following example(glm)
1996
> ## Don't show: 
1996
> ## Don't show: 
1997
> example(glm, echo = FALSE)
1997
> example(glm, echo = FALSE)
1998
  treatment outcome counts
1998
  treatment outcome counts
Line 2014... Line 2014...
2014
          Df Deviance  AIC  LRT Pr(>Chi)  
2014
          Df Deviance  AIC  LRT Pr(>Chi)  
2015
<none>           5.13 56.8                
2015
<none>           5.13 56.8                
2016
outcome    2    10.58 58.2 5.45    0.065 .
2016
outcome    2    10.58 58.2 5.45    0.065 .
2017
treatment  2     5.13 52.8 0.00    1.000  
2017
treatment  2     5.13 52.8 0.00    1.000  
2018
---
2018
---
2019
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
2019
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
2020
> drop1(glm.D93, test = "F")
2020
> drop1(glm.D93, test = "F")
2021
Warning in drop1.glm(glm.D93, test = "F") :
2021
Warning in drop1.glm(glm.D93, test = "F") :
2022
  F test assumes 'quasipoisson' family
2022
  F test assumes 'quasipoisson' family
2023
Single term deletions
2023
Single term deletions
2024
 
2024
 
Line 2532... Line 2532...
2532
          Df Deviance Resid. Df Resid. Dev Pr(>Chi)  
2532
          Df Deviance Resid. Df Resid. Dev Pr(>Chi)  
2533
NULL                          8    10.5814           
2533
NULL                          8    10.5814           
2534
outcome    2   5.4523         6     5.1291  0.06547 .
2534
outcome    2   5.4523         6     5.1291  0.06547 .
2535
treatment  2   0.0000         4     5.1291  1.00000  
2535
treatment  2   0.0000         4     5.1291  1.00000  
2536
---
2536
---
2537
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
2537
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
2538
> glm.D93a <-
2538
> glm.D93a <-
2539
+    update(glm.D93, ~treatment*outcome) # equivalent to Pearson Chi-square
2539
+    update(glm.D93, ~treatment*outcome) # equivalent to Pearson Chi-square
2540
> anova(glm.D93, glm.D93a, test = "Rao")
2540
> anova(glm.D93, glm.D93a, test = "Rao")
2541
Analysis of Deviance Table
2541
Analysis of Deviance Table
2542
 
2542
 
Line 2572... Line 2572...
2572
pop75      1  53.34  53.343  3.6889 0.0611255 .  
2572
pop75      1  53.34  53.343  3.6889 0.0611255 .  
2573
dpi        1  12.40  12.401  0.8576 0.3593551    
2573
dpi        1  12.40  12.401  0.8576 0.3593551    
2574
ddpi       1  63.05  63.054  4.3605 0.0424711 *  
2574
ddpi       1  63.05  63.054  4.3605 0.0424711 *  
2575
Residuals 45 650.71  14.460                      
2575
Residuals 45 650.71  14.460                      
2576
---
2576
---
2577
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
2577
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
2578
> 
2578
> 
2579
> ## same effect via separate models
2579
> ## same effect via separate models
2580
> fit0 <- lm(sr ~ 1, data = LifeCycleSavings)
2580
> fit0 <- lm(sr ~ 1, data = LifeCycleSavings)
2581
> fit1 <- update(fit0, . ~ . + pop15)
2581
> fit1 <- update(fit0, . ~ . + pop15)
2582
> fit2 <- update(fit1, . ~ . + pop75)
2582
> fit2 <- update(fit1, . ~ . + pop75)
Line 2595... Line 2595...
2595
2     48 779.51  1   204.118 14.1157 0.0004922 ***
2595
2     48 779.51  1   204.118 14.1157 0.0004922 ***
2596
3     47 726.17  1    53.343  3.6889 0.0611255 .  
2596
3     47 726.17  1    53.343  3.6889 0.0611255 .  
2597
4     46 713.77  1    12.401  0.8576 0.3593551    
2597
4     46 713.77  1    12.401  0.8576 0.3593551    
2598
5     45 650.71  1    63.054  4.3605 0.0424711 *  
2598
5     45 650.71  1    63.054  4.3605 0.0424711 *  
2599
---
2599
---
2600
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
2600
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
2601
> 
2601
> 
2602
> anova(fit4, fit2, fit0, test = "F") # unconventional order
2602
> anova(fit4, fit2, fit0, test = "F") # unconventional order
2603
Analysis of Variance Table
2603
Analysis of Variance Table
2604
 
2604
 
2605
Model 1: sr ~ pop15 + pop75 + dpi + ddpi
2605
Model 1: sr ~ pop15 + pop75 + dpi + ddpi
Line 2608... Line 2608...
2608
  Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
2608
  Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
2609
1     45 650.71                                  
2609
1     45 650.71                                  
2610
2     47 726.17 -2   -75.455 2.6090 0.0847088 .  
2610
2     47 726.17 -2   -75.455 2.6090 0.0847088 .  
2611
3     49 983.63 -2  -257.460 8.9023 0.0005527 ***
2611
3     49 983.63 -2  -257.460 8.9023 0.0005527 ***
2612
---
2612
---
2613
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
2613
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
2614
> 
2614
> 
2615
> 
2615
> 
2616
> 
2616
> 
2617
> cleanEx()
2617
> cleanEx()
2618
> nameEx("anova.mlm")
2618
> nameEx("anova.mlm")
Line 2696... Line 2696...
2696
 
2696
 
2697
  Res.Df Df Gen.var. Pillai approx F num Df den Df   Pr(>F)   
2697
  Res.Df Df Gen.var. Pillai approx F num Df den Df   Pr(>F)   
2698
1      9      1249.6                                          
2698
1      9      1249.6                                          
2699
2     10  1   2013.2 0.9456   17.381      5      5 0.003534 **
2699
2     10  1   2013.2 0.9456   17.381      5      5 0.003534 **
2700
---
2700
---
2701
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
2701
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
2702
> 
2702
> 
2703
> ## Assuming sphericity
2703
> ## Assuming sphericity
2704
> anova(mlmfit, mlmfit0, X = ~1, test = "Spherical")
2704
> anova(mlmfit, mlmfit0, X = ~1, test = "Spherical")
2705
Analysis of Variance Table
2705
Analysis of Variance Table
2706
 
2706
 
Line 2987... Line 2987...
2987
          Df Sum Sq Mean Sq F value  Pr(>F)   
2987
          Df Sum Sq Mean Sq F value  Pr(>F)   
2988
N          1 189.28  189.28  12.259 0.00437 **
2988
N          1 189.28  189.28  12.259 0.00437 **
2989
P          1   8.40    8.40   0.544 0.47490   
2989
P          1   8.40    8.40   0.544 0.47490   
2990
K          1  95.20   95.20   6.166 0.02880 * 
2990
K          1  95.20   95.20   6.166 0.02880 * 
2991
N:P        1  21.28   21.28   1.378 0.26317   
2991
N:P        1  21.28   21.28   1.378 0.26317   
2992
N:K        1  33.13   33.13   2.146 0.16865   
2992
N:K        1  33.14   33.14   2.146 0.16865   
2993
P:K        1   0.48    0.48   0.031 0.86275   
2993
P:K        1   0.48    0.48   0.031 0.86275   
2994
Residuals 12 185.29   15.44                   
2994
Residuals 12 185.29   15.44                   
2995
---
2995
---
2996
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
2996
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
2997
> options(op)  # reset to previous
2997
> options(op)  # reset to previous
2998
> 
2998
> 
2999
> 
2999
> 
3000
> 
3000
> 
3001
> base::options(contrasts = c(unordered = "contr.treatment",ordered = "contr.poly"))
3001
> base::options(contrasts = c(unordered = "contr.treatment",ordered = "contr.poly"))
Line 3696... Line 3696...
3696
> 
3696
> 
3697
> 
3697
> 
3698
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
3698
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
3699
> cleanEx()
3699
> cleanEx()
3700
 
3700
 
3701
detaching 'package:cluster'
3701
detaching ‘package:cluster’
3702
 
3702
 
3703
> nameEx("asOneSidedFormula")
3703
> nameEx("asOneSidedFormula")
3704
> ### * asOneSidedFormula
3704
> ### * asOneSidedFormula
3705
> 
3705
> 
3706
> flush(stderr()); flush(stdout())
3706
> flush(stderr()); flush(stdout())
Line 3712... Line 3712...
3712
> 
3712
> 
3713
> ### ** Examples
3713
> ### ** Examples
3714
> 
3714
> 
3715
> asOneSidedFormula("age")
3715
> asOneSidedFormula("age")
3716
~age
3716
~age
3717
<environment: 0x7f9342c1cd88>
3717
<environment: 0x4fbcac8>
3718
> asOneSidedFormula(~ age)
3718
> asOneSidedFormula(~ age)
3719
~age
3719
~age
3720
> 
3720
> 
3721
> 
3721
> 
3722
> 
3722
> 
Line 4030... Line 4030...
4030
x               5.524412   1.255354   4.401 0.000516 ***
4030
x               5.524412   1.255354   4.401 0.000516 ***
4031
I(x^2)         -0.542292   0.138460  -3.917 0.001374 ** 
4031
I(x^2)         -0.542292   0.138460  -3.917 0.001374 ** 
4032
I(x^3)          0.020905   0.004372   4.782 0.000242 ***
4032
I(x^3)          0.020905   0.004372   4.782 0.000242 ***
4033
I((x - 10)^2)         NA         NA      NA       NA    
4033
I((x - 10)^2)         NA         NA      NA       NA    
4034
---
4034
---
4035
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
4035
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
4036
 
4036
 
4037
Residual standard error: 2.838 on 15 degrees of freedom
4037
Residual standard error: 2.838 on 15 degrees of freedom
4038
Multiple R-squared:  0.9702,	Adjusted R-squared:  0.9643 
4038
Multiple R-squared:  0.9702,	Adjusted R-squared:  0.9643 
4039
F-statistic:   163 on 3 and 15 DF,  p-value: 1.14e-11
4039
F-statistic:   163 on 3 and 15 DF,  p-value: 1.14e-11
4040
 
4040
 
Line 4663... Line 4663...
4663
Armed.Forces .    .     1      
4663
Armed.Forces .    .     1      
4664
Population   B    B   , . 1    
4664
Population   B    B   , . 1    
4665
Year         B    B   , . B 1  
4665
Year         B    B   , . B 1  
4666
Employed     B    B   . . B B 1
4666
Employed     B    B   . . B B 1
4667
attr(,"legend")
4667
attr(,"legend")
4668
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
4668
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
4669
> 
4669
> 
4670
> ## Spearman's rho  and  Kendall's tau
4670
> ## Spearman's rho  and  Kendall's tau
4671
> symnum(clS <- cor(longley, method = "spearman"))
4671
> symnum(clS <- cor(longley, method = "spearman"))
4672
             GNP. GNP U A P Y E
4672
             GNP. GNP U A P Y E
4673
GNP.deflator 1                 
4673
GNP.deflator 1                 
Line 4676... Line 4676...
4676
Armed.Forces          . 1      
4676
Armed.Forces          . 1      
4677
Population   B    B   ,   1    
4677
Population   B    B   ,   1    
4678
Year         B    B   ,   1 1  
4678
Year         B    B   ,   1 1  
4679
Employed     B    B   .   B B 1
4679
Employed     B    B   .   B B 1
4680
attr(,"legend")
4680
attr(,"legend")
4681
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
4681
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
4682
> symnum(clK <- cor(longley, method = "kendall"))
4682
> symnum(clK <- cor(longley, method = "kendall"))
4683
             GNP. GNP U A P Y E
4683
             GNP. GNP U A P Y E
4684
GNP.deflator 1                 
4684
GNP.deflator 1                 
4685
GNP          B    1            
4685
GNP          B    1            
4686
Unemployed   .    .   1        
4686
Unemployed   .    .   1        
4687
Armed.Forces            1      
4687
Armed.Forces            1      
4688
Population   B    B   .   1    
4688
Population   B    B   .   1    
4689
Year         B    B   .   1 1  
4689
Year         B    B   .   1 1  
4690
Employed     *    *   .   + + 1
4690
Employed     *    *   .   + + 1
4691
attr(,"legend")
4691
attr(,"legend")
4692
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
4692
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
4693
> ## How much do they differ?
4693
> ## How much do they differ?
4694
> i <- lower.tri(Cl)
4694
> i <- lower.tri(Cl)
4695
> cor(cbind(P = Cl[i], S = clS[i], K = clK[i]))
4695
> cor(cbind(P = Cl[i], S = clS[i], K = clK[i]))
4696
          P         S         K
4696
          P         S         K
4697
P 1.0000000 0.9802390 0.9572562
4697
P 1.0000000 0.9802390 0.9572562
Line 4713... Line 4713...
4713
    r <- V
4713
    r <- V
4714
    r[] <- Is * V * rep(Is, each = p)
4714
    r[] <- Is * V * rep(Is, each = p)
4715
    r[cbind(1L:p, 1L:p)] <- 1
4715
    r[cbind(1L:p, 1L:p)] <- 1
4716
    r
4716
    r
4717
}
4717
}
4718
<bytecode: 0x7f934795c078>
4718
<bytecode: 0x7bd76c0>
4719
<environment: namespace:stats>
4719
<environment: namespace:stats>
4720
> stopifnot(all.equal(Cl, cov2cor(cov(longley))),
4720
> stopifnot(all.equal(Cl, cov2cor(cov(longley))),
4721
+           all.equal(cor(longley, method = "kendall"),
4721
+           all.equal(cor(longley, method = "kendall"),
4722
+             cov2cor(cov(longley, method = "kendall"))))
4722
+             cov2cor(cov(longley, method = "kendall"))))
4723
> 
4723
> 
Line 4758... Line 4758...
4758
Exmntn . . 1        
4758
Exmntn . . 1        
4759
Eductn . . .  1     
4759
Eductn . . .  1     
4760
Cathlc     .     1  
4760
Cathlc     .     1  
4761
Infn.M             1
4761
Infn.M             1
4762
attr(,"legend")
4762
attr(,"legend")
4763
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
4763
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
4764
> symnum(Rp <- cor(swM, method = "kendall", use = "pairwise"))
4764
> symnum(Rp <- cor(swM, method = "kendall", use = "pairwise"))
4765
       F A Ex Ed C I
4765
       F A Ex Ed C I
4766
Frtlty 1            
4766
Frtlty 1            
4767
Agrclt   1          
4767
Agrclt   1          
4768
Exmntn . . 1        
4768
Exmntn . . 1        
4769
Eductn . . .  1     
4769
Eductn . . .  1     
4770
Cathlc     .     1  
4770
Cathlc     .     1  
4771
Infn.M .           1
4771
Infn.M .           1
4772
attr(,"legend")
4772
attr(,"legend")
4773
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
4773
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
4774
> symnum(R. <- cor(swiss, method = "kendall"))
4774
> symnum(R. <- cor(swiss, method = "kendall"))
4775
                 F A Ex Ed C I
4775
                 F A Ex Ed C I
4776
Fertility        1            
4776
Fertility        1            
4777
Agriculture        1          
4777
Agriculture        1          
4778
Examination      . . 1        
4778
Examination      . . 1        
4779
Education        . . .  1     
4779
Education        . . .  1     
4780
Catholic             .     1  
4780
Catholic             .     1  
4781
Infant.Mortality .           1
4781
Infant.Mortality .           1
4782
attr(,"legend")
4782
attr(,"legend")
4783
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
4783
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
4784
> 
4784
> 
4785
> ## "pairwise" is closer componentwise,
4785
> ## "pairwise" is closer componentwise,
4786
> summary(abs(c(1 - Rp/R.)))
4786
> summary(abs(c(1 - Rp/R.)))
4787
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
4787
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
4788
0.00000 0.00000 0.04481 0.09573 0.15210 0.53940 
4788
0.00000 0.00000 0.04481 0.09573 0.15210 0.53940 
Line 6397... Line 6397...
6397
> (fit <- aov(Yield ~ A*B*C + Error(Block), data = aovdat))
6397
> (fit <- aov(Yield ~ A*B*C + Error(Block), data = aovdat))
6398
 
6398
 
6399
Call:
6399
Call:
6400
aov(formula = Yield ~ A * B * C + Error(Block), data = aovdat)
6400
aov(formula = Yield ~ A * B * C + Error(Block), data = aovdat)
6401
 
6401
 
6402
Grand Mean: 291.5937
6402
Grand Mean: 291.5938
6403
 
6403
 
6404
Stratum 1: Block
6404
Stratum 1: Block
6405
 
6405
 
6406
Terms:
6406
Terms:
6407
                      A:B       A:C       B:C     A:B:C Residuals
6407
                      A:B       A:C       B:C     A:B:C Residuals
Line 6416... Line 6416...
6416
Terms:
6416
Terms:
6417
                        A         B         C       A:B       A:C       B:C
6417
                        A         B         C       A:B       A:C       B:C
6418
Sum of Squares    3465.28 161170.03 278817.78     28.17   1802.67  11528.17
6418
Sum of Squares    3465.28 161170.03 278817.78     28.17   1802.67  11528.17
6419
Deg. of Freedom         1         1         1         1         1         1
6419
Deg. of Freedom         1         1         1         1         1         1
6420
                    A:B:C Residuals
6420
                    A:B:C Residuals
6421
Sum of Squares      45.38   5423.28
6421
Sum of Squares      45.37   5423.28
6422
Deg. of Freedom         1        17
6422
Deg. of Freedom         1        17
6423
 
6423
 
6424
Residual standard error: 17.86103
6424
Residual standard error: 17.86103
6425
Estimated effects are balanced
6425
Estimated effects are balanced
6426
> eff.aovlist(fit)
6426
> eff.aovlist(fit)
Line 7131... Line 7131...
7131
> environment(fo)
7131
> environment(fo)
7132
<environment: R_GlobalEnv>
7132
<environment: R_GlobalEnv>
7133
> environment(as.formula("y ~ x"))
7133
> environment(as.formula("y ~ x"))
7134
<environment: R_GlobalEnv>
7134
<environment: R_GlobalEnv>
7135
> environment(as.formula("y ~ x", env = new.env()))
7135
> environment(as.formula("y ~ x", env = new.env()))
7136
<environment: 0x7f934a9db600>
7136
<environment: 0xaf34e28>
7137
> 
7137
> 
7138
> 
7138
> 
7139
> ## Create a formula for a model with a large number of variables:
7139
> ## Create a formula for a model with a large number of variables:
7140
> xnam <- paste0("x", 1:25)
7140
> xnam <- paste0("x", 1:25)
7141
> (fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+"))))
7141
> (fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+"))))
Line 7572... Line 7572...
7572
(Intercept)  49.7711    13.3910   3.717 0.000410 ***
7572
(Intercept)  49.7711    13.3910   3.717 0.000410 ***
7573
Prewt        -0.5655     0.1612  -3.509 0.000803 ***
7573
Prewt        -0.5655     0.1612  -3.509 0.000803 ***
7574
TreatCont    -4.0971     1.8935  -2.164 0.033999 *  
7574
TreatCont    -4.0971     1.8935  -2.164 0.033999 *  
7575
TreatFT       4.5631     2.1333   2.139 0.036035 *  
7575
TreatFT       4.5631     2.1333   2.139 0.036035 *  
7576
---
7576
---
7577
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
7577
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
7578
 
7578
 
7579
(Dispersion parameter for gaussian family taken to be 48.69504)
7579
(Dispersion parameter for gaussian family taken to be 48.69504)
7580
 
7580
 
7581
    Null deviance: 4525.4  on 71  degrees of freedom
7581
    Null deviance: 4525.4  on 71  degrees of freedom
7582
Residual deviance: 3311.3  on 68  degrees of freedom
7582
Residual deviance: 3311.3  on 68  degrees of freedom
Line 7602... Line 7602...
7602
Coefficients:
7602
Coefficients:
7603
              Estimate Std. Error t value Pr(>|t|)    
7603
              Estimate Std. Error t value Pr(>|t|)    
7604
(Intercept) -0.0165544  0.0009275  -17.85 4.28e-07 ***
7604
(Intercept) -0.0165544  0.0009275  -17.85 4.28e-07 ***
7605
log(u)       0.0153431  0.0004150   36.98 2.75e-09 ***
7605
log(u)       0.0153431  0.0004150   36.98 2.75e-09 ***
7606
---
7606
---
7607
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
7607
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
7608
 
7608
 
7609
(Dispersion parameter for Gamma family taken to be 0.002446059)
7609
(Dispersion parameter for Gamma family taken to be 0.002446059)
7610
 
7610
 
7611
    Null deviance: 3.51283  on 8  degrees of freedom
7611
    Null deviance: 3.51283  on 8  degrees of freedom
7612
Residual deviance: 0.01673  on 7  degrees of freedom
7612
Residual deviance: 0.01673  on 7  degrees of freedom
Line 7626... Line 7626...
7626
Coefficients:
7626
Coefficients:
7627
              Estimate Std. Error t value Pr(>|t|)    
7627
              Estimate Std. Error t value Pr(>|t|)    
7628
(Intercept) -0.0239085  0.0013265  -18.02 4.00e-07 ***
7628
(Intercept) -0.0239085  0.0013265  -18.02 4.00e-07 ***
7629
log(u)       0.0235992  0.0005768   40.91 1.36e-09 ***
7629
log(u)       0.0235992  0.0005768   40.91 1.36e-09 ***
7630
---
7630
---
7631
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
7631
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
7632
 
7632
 
7633
(Dispersion parameter for Gamma family taken to be 0.001813354)
7633
(Dispersion parameter for Gamma family taken to be 0.001813354)
7634
 
7634
 
7635
    Null deviance: 3.118557  on 8  degrees of freedom
7635
    Null deviance: 3.118557  on 8  degrees of freedom
7636
Residual deviance: 0.012672  on 7  degrees of freedom
7636
Residual deviance: 0.012672  on 7  degrees of freedom
Line 7756... Line 7756...
7756
learning   ,  .  . 1        
7756
learning   ,  .  . 1        
7757
raises     .  ,  . , 1      
7757
raises     .  ,  . , 1      
7758
critical             .  1   
7758
critical             .  1   
7759
advance          . . .     1
7759
advance          . . .     1
7760
attr(,"legend")
7760
attr(,"legend")
7761
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
7761
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
7762
> heatmap(Ca,               symm = TRUE, margins = c(6,6)) # with reorder()
7762
> heatmap(Ca,               symm = TRUE, margins = c(6,6)) # with reorder()
7763
> heatmap(Ca, Rowv = FALSE, symm = TRUE, margins = c(6,6)) # _NO_ reorder()
7763
> heatmap(Ca, Rowv = FALSE, symm = TRUE, margins = c(6,6)) # _NO_ reorder()
7764
> ## slightly artificial with color bar, without and with ordering:
7764
> ## slightly artificial with color bar, without and with ordering:
7765
> cc <- rainbow(nrow(Ca))
7765
> cc <- rainbow(nrow(Ca))
7766
> heatmap(Ca, Rowv = FALSE, symm = TRUE, RowSideColors = cc, ColSideColors = cc,
7766
> heatmap(Ca, Rowv = FALSE, symm = TRUE, RowSideColors = cc, ColSideColors = cc,
Line 7782... Line 7782...
7782
ORAL    * *  B  B  *  B  B 1       
7782
ORAL    * *  B  B  *  B  B 1       
7783
WRIT    * +  B  *  *  B  B B 1     
7783
WRIT    * +  B  *  *  B  B B 1     
7784
PHYS    , ,  +  +  +  +  + + + 1   
7784
PHYS    , ,  +  +  +  +  + + + 1   
7785
RTEN    * *  *  *  *  B  * B B *  1
7785
RTEN    * *  *  *  *  B  * B B *  1
7786
attr(,"legend")
7786
attr(,"legend")
7787
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
7787
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
7788
> 
7788
> 
7789
> hU <- heatmap(cU, Rowv = FALSE, symm = TRUE, col = topo.colors(16),
7789
> hU <- heatmap(cU, Rowv = FALSE, symm = TRUE, col = topo.colors(16),
7790
+              distfun = function(c) as.dist(1 - c), keep.dendro = TRUE)
7790
+              distfun = function(c) as.dist(1 - c), keep.dendro = TRUE)
7791
> ## The Correlation matrix with same reordering:
7791
> ## The Correlation matrix with same reordering:
7792
> round(100 * cU[hU[[1]], hU[[2]]])
7792
> round(100 * cU[hU[[1]], hU[[2]]])
Line 7909... Line 7909...
7909
> integrate(integrand, lower = 0, upper = 10)
7909
> integrate(integrand, lower = 0, upper = 10)
7910
2.529038 with absolute error < 3e-04
7910
2.529038 with absolute error < 3e-04
7911
> integrate(integrand, lower = 0, upper = 100000)
7911
> integrate(integrand, lower = 0, upper = 100000)
7912
3.135268 with absolute error < 4.2e-07
7912
3.135268 with absolute error < 4.2e-07
7913
> integrate(integrand, lower = 0, upper = 1000000, stop.on.error = FALSE)
7913
> integrate(integrand, lower = 0, upper = 1000000, stop.on.error = FALSE)
7914
failed with message 'the integral is probably divergent'
7914
failed with message ‘the integral is probably divergent’
7915
> 
7915
> 
7916
> ## some functions do not handle vector input properly
7916
> ## some functions do not handle vector input properly
7917
> f <- function(x) 2.0
7917
> f <- function(x) 2.0
7918
> try(integrate(f, 0, 1))
7918
> try(integrate(f, 0, 1))
7919
Error in integrate(f, 0, 1) : 
7919
Error in integrate(f, 0, 1) : 
Line 8585... Line 8585...
8585
pop15       -0.4611931  0.1446422  -3.189 0.002603 ** 
8585
pop15       -0.4611931  0.1446422  -3.189 0.002603 ** 
8586
pop75       -1.6914977  1.0835989  -1.561 0.125530    
8586
pop75       -1.6914977  1.0835989  -1.561 0.125530    
8587
dpi         -0.0003369  0.0009311  -0.362 0.719173    
8587
dpi         -0.0003369  0.0009311  -0.362 0.719173    
8588
ddpi         0.4096949  0.1961971   2.088 0.042471 *  
8588
ddpi         0.4096949  0.1961971   2.088 0.042471 *  
8589
---
8589
---
8590
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
8590
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
8591
 
8591
 
8592
Residual standard error: 3.803 on 45 degrees of freedom
8592
Residual standard error: 3.803 on 45 degrees of freedom
8593
Multiple R-squared:  0.3385,	Adjusted R-squared:  0.2797 
8593
Multiple R-squared:  0.3385,	Adjusted R-squared:  0.2797 
8594
F-statistic: 5.756 on 4 and 45 DF,  p-value: 0.0007904
8594
F-statistic: 5.756 on 4 and 45 DF,  p-value: 0.0007904
8595
 
8595
 
Line 9117... Line 9117...
9117
N:P        1 0.30158   2.3750      2     11 0.13888  
9117
N:P        1 0.30158   2.3750      2     11 0.13888  
9118
N:K        1 0.21654   1.5201      2     11 0.26127  
9118
N:K        1 0.21654   1.5201      2     11 0.26127  
9119
P:K        1 0.41992   3.9814      2     11 0.05003 .
9119
P:K        1 0.41992   3.9814      2     11 0.05003 .
9120
Residuals 12                                         
9120
Residuals 12                                         
9121
---
9121
---
9122
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
9122
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
9123
> 
9123
> 
9124
> ( npk2.aovE <- manova(cbind(yield, foo) ~  N*P*K + Error(block), npk2) )
9124
> ( npk2.aovE <- manova(cbind(yield, foo) ~  N*P*K + Error(block), npk2) )
9125
 
9125
 
9126
Call:
9126
Call:
9127
manova(cbind(yield, foo) ~ N * P * K + Error(block), npk2)
9127
manova(cbind(yield, foo) ~ N * P * K + Error(block), npk2)
Line 9170... Line 9170...
9170
N:P        1 0.30158   2.3750      2     11 0.13888  
9170
N:P        1 0.30158   2.3750      2     11 0.13888  
9171
N:K        1 0.21654   1.5201      2     11 0.26127  
9171
N:K        1 0.21654   1.5201      2     11 0.26127  
9172
P:K        1 0.41992   3.9814      2     11 0.05003 .
9172
P:K        1 0.41992   3.9814      2     11 0.05003 .
9173
Residuals 12                                         
9173
Residuals 12                                         
9174
---
9174
---
9175
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
9175
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
9176
> 
9176
> 
9177
> 
9177
> 
9178
> 
9178
> 
9179
> 
9179
> 
9180
> 
9180
> 
Line 10264... Line 10264...
10264
     Estimate Std. Error t value Pr(>|t|)    
10264
     Estimate Std. Error t value Pr(>|t|)    
10265
Asym   2.3452     0.0782    30.0  2.2e-13 ***
10265
Asym   2.3452     0.0782    30.0  2.2e-13 ***
10266
xmid   1.4831     0.0814    18.2  1.2e-10 ***
10266
xmid   1.4831     0.0814    18.2  1.2e-10 ***
10267
scal   1.0415     0.0323    32.3  8.5e-14 ***
10267
scal   1.0415     0.0323    32.3  8.5e-14 ***
10268
---
10268
---
10269
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
10269
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
10270
 
10270
 
10271
Residual standard error: 0.0192 on 13 degrees of freedom
10271
Residual standard error: 0.0192 on 13 degrees of freedom
10272
 
10272
 
10273
> ## the coefficients only:
10273
> ## the coefficients only:
10274
> coef(fm1DNase1)
10274
> coef(fm1DNase1)
Line 10294... Line 10294...
10294
     Estimate Std. Error t value Pr(>|t|)    
10294
     Estimate Std. Error t value Pr(>|t|)    
10295
xmid   1.4831     0.0814    18.2  1.2e-10 ***
10295
xmid   1.4831     0.0814    18.2  1.2e-10 ***
10296
scal   1.0415     0.0323    32.3  8.5e-14 ***
10296
scal   1.0415     0.0323    32.3  8.5e-14 ***
10297
.lin   2.3452     0.0782    30.0  2.2e-13 ***
10297
.lin   2.3452     0.0782    30.0  2.2e-13 ***
10298
---
10298
---
10299
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
10299
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
10300
 
10300
 
10301
Residual standard error: 0.0192 on 13 degrees of freedom
10301
Residual standard error: 0.0192 on 13 degrees of freedom
10302
 
10302
 
10303
> 
10303
> 
10304
> ## without conditional linearity
10304
> ## without conditional linearity
Line 10313... Line 10313...
10313
     Estimate Std. Error t value Pr(>|t|)    
10313
     Estimate Std. Error t value Pr(>|t|)    
10314
Asym   2.3452     0.0782    30.0  2.2e-13 ***
10314
Asym   2.3452     0.0782    30.0  2.2e-13 ***
10315
xmid   1.4831     0.0814    18.2  1.2e-10 ***
10315
xmid   1.4831     0.0814    18.2  1.2e-10 ***
10316
scal   1.0415     0.0323    32.3  8.5e-14 ***
10316
scal   1.0415     0.0323    32.3  8.5e-14 ***
10317
---
10317
---
10318
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
10318
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
10319
 
10319
 
10320
Residual standard error: 0.0192 on 13 degrees of freedom
10320
Residual standard error: 0.0192 on 13 degrees of freedom
10321
 
10321
 
10322
> 
10322
> 
10323
> ## using Port's nl2sol algorithm
10323
> ## using Port's nl2sol algorithm
Line 10333... Line 10333...
10333
     Estimate Std. Error t value Pr(>|t|)    
10333
     Estimate Std. Error t value Pr(>|t|)    
10334
Asym   2.3452     0.0782    30.0  2.2e-13 ***
10334
Asym   2.3452     0.0782    30.0  2.2e-13 ***
10335
xmid   1.4831     0.0814    18.2  1.2e-10 ***
10335
xmid   1.4831     0.0814    18.2  1.2e-10 ***
10336
scal   1.0415     0.0323    32.3  8.5e-14 ***
10336
scal   1.0415     0.0323    32.3  8.5e-14 ***
10337
---
10337
---
10338
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
10338
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
10339
 
10339
 
10340
Residual standard error: 0.0192 on 13 degrees of freedom
10340
Residual standard error: 0.0192 on 13 degrees of freedom
10341
 
10341
 
10342
Algorithm "port", convergence message: relative convergence (4)
10342
Algorithm "port", convergence message: relative convergence (4)
10343
 
10343
 
Line 10366... Line 10366...
10366
Parameters:
10366
Parameters:
10367
   Estimate Std. Error t value Pr(>|t|)    
10367
   Estimate Std. Error t value Pr(>|t|)    
10368
Vm 2.07e+02   9.22e+00   22.42  7.0e-10 ***
10368
Vm 2.07e+02   9.22e+00   22.42  7.0e-10 ***
10369
K  5.46e-02   7.98e-03    6.84  4.5e-05 ***
10369
K  5.46e-02   7.98e-03    6.84  4.5e-05 ***
10370
---
10370
---
10371
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
10371
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
10372
 
10372
 
10373
Residual standard error: 1.21 on 10 degrees of freedom
10373
Residual standard error: 1.21 on 10 degrees of freedom
10374
 
10374
 
10375
> 
10375
> 
10376
> ## Passing arguments using a list that can not be coerced to a data.frame
10376
> ## Passing arguments using a list that can not be coerced to a data.frame
Line 10443... Line 10443...
10443
> x <- -(1:100)/10
10443
> x <- -(1:100)/10
10444
> y <- 100 + 10 * exp(x / 2) + rnorm(x)/10
10444
> y <- 100 + 10 * exp(x / 2) + rnorm(x)/10
10445
> nlmod <- nls(y ~  Const + A * exp(B * x))
10445
> nlmod <- nls(y ~  Const + A * exp(B * x))
10446
Warning in nls(y ~ Const + A * exp(B * x)) :
10446
Warning in nls(y ~ Const + A * exp(B * x)) :
10447
  No starting values specified for some parameters.
10447
  No starting values specified for some parameters.
10448
Initializing 'Const', 'A', 'B' to '1.'.
10448
Initializing ‘Const’, ‘A’, ‘B’ to '1.'.
10449
Consider specifying 'start' or using a selfStart model
10449
Consider specifying 'start' or using a selfStart model
10450
> 
10450
> 
10451
> plot(x,y, main = "nls(*), data, true function and fit, n=100")
10451
> plot(x,y, main = "nls(*), data, true function and fit, n=100")
10452
> curve(100 + 10 * exp(x / 2), col = 4, add = TRUE)
10452
> curve(100 + 10 * exp(x / 2), col = 4, add = TRUE)
10453
> lines(x, predict(nlmod), col = 2)
10453
> lines(x, predict(nlmod), col = 2)
Line 10483... Line 10483...
10483
      Estimate Std. Error t value Pr(>|t|)    
10483
      Estimate Std. Error t value Pr(>|t|)    
10484
th       0.608      0.115    5.31  1.9e-06 ***
10484
th       0.608      0.115    5.31  1.9e-06 ***
10485
.lin1   28.963      1.230   23.55  < 2e-16 ***
10485
.lin1   28.963      1.230   23.55  < 2e-16 ***
10486
.lin2  -34.227      3.793   -9.02  1.4e-12 ***
10486
.lin2  -34.227      3.793   -9.02  1.4e-12 ***
10487
---
10487
---
10488
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
10488
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
10489
 
10489
 
10490
Residual standard error: 4.67 on 57 degrees of freedom
10490
Residual standard error: 4.67 on 57 degrees of freedom
10491
 
10491
 
10492
> 
10492
> 
10493
> ## Then we use nls' indexing feature for parameters in non-linear
10493
> ## Then we use nls' indexing feature for parameters in non-linear
Line 10547... Line 10547...
10547
b19  -28.969      7.235   -4.00  0.00092 ***
10547
b19  -28.969      7.235   -4.00  0.00092 ***
10548
b20  -36.917      8.033   -4.60  0.00026 ***
10548
b20  -36.917      8.033   -4.60  0.00026 ***
10549
b21  -26.508      7.012   -3.78  0.00149 ** 
10549
b21  -26.508      7.012   -3.78  0.00149 ** 
10550
th     0.797      0.127    6.30  8.0e-06 ***
10550
th     0.797      0.127    6.30  8.0e-06 ***
10551
---
10551
---
10552
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
10552
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
10553
 
10553
 
10554
Residual standard error: 1.11 on 17 degrees of freedom
10554
Residual standard error: 1.11 on 17 degrees of freedom
10555
 
10555
 
10556
> ## Don't show: 
10556
> ## Don't show: 
10557
> options(od)
10557
> options(od)
Line 10691... Line 10691...
10691
Response: extra
10691
Response: extra
10692
          Df Sum Sq Mean Sq F value  Pr(>F)  
10692
          Df Sum Sq Mean Sq F value  Pr(>F)  
10693
group      1 12.482 12.4820  3.4626 0.07919 .
10693
group      1 12.482 12.4820  3.4626 0.07919 .
10694
Residuals 18 64.886  3.6048                  
10694
Residuals 18 64.886  3.6048                  
10695
---
10695
---
10696
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
10696
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
10697
> 
10697
> 
10698
> 
10698
> 
10699
> 
10699
> 
10700
> cleanEx()
10700
> cleanEx()
10701
> nameEx("optim")
10701
> nameEx("optim")
Line 11746... Line 11746...
11746
[1] "link-glm"
11746
[1] "link-glm"
11747
> quasi(link = power(1/3))[c("linkfun", "linkinv")]
11747
> quasi(link = power(1/3))[c("linkfun", "linkinv")]
11748
$linkfun
11748
$linkfun
11749
function (mu) 
11749
function (mu) 
11750
mu^lambda
11750
mu^lambda
11751
<bytecode: 0x7f93488e2630>
11751
<bytecode: 0x8b86170>
11752
<environment: 0x7f9348866548>
11752
<environment: 0x8b7b8e8>
11753
 
11753
 
11754
$linkinv
11754
$linkinv
11755
function (eta) 
11755
function (eta) 
11756
pmax(eta^(1/lambda), .Machine$double.eps)
11756
pmax(eta^(1/lambda), .Machine$double.eps)
11757
<bytecode: 0x7f93488e2748>
11757
<bytecode: 0x8b86288>
11758
<environment: 0x7f9348866548>
11758
<environment: 0x8b7b8e8>
11759
 
11759
 
11760
> 
11760
> 
11761
> 
11761
> 
11762
> 
11762
> 
11763
> cleanEx()
11763
> cleanEx()
Line 12338... Line 12338...
12338
(Intercept)  -2.9935     0.5527  -5.416 6.09e-08 ***
12338
(Intercept)  -2.9935     0.5527  -5.416 6.09e-08 ***
12339
sexM          0.1750     0.7783   0.225    0.822    
12339
sexM          0.1750     0.7783   0.225    0.822    
12340
ldose         0.9060     0.1671   5.422 5.89e-08 ***
12340
ldose         0.9060     0.1671   5.422 5.89e-08 ***
12341
sexM:ldose    0.3529     0.2700   1.307    0.191    
12341
sexM:ldose    0.3529     0.2700   1.307    0.191    
12342
---
12342
---
12343
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
12343
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
12344
 
12344
 
12345
(Dispersion parameter for binomial family taken to be 1)
12345
(Dispersion parameter for binomial family taken to be 1)
12346
 
12346
 
12347
    Null deviance: 124.8756  on 11  degrees of freedom
12347
    Null deviance: 124.8756  on 11  degrees of freedom
12348
Residual deviance:   4.9937  on  8  degrees of freedom
12348
Residual deviance:   4.9937  on  8  degrees of freedom
Line 13074... Line 13074...
13074
     Estimate Std.Err Z value    Pr(>z)    
13074
     Estimate Std.Err Z value    Pr(>z)    
13075
[1,]   9.3735  4.4447  2.1089 0.0349492 *  
13075
[1,]   9.3735  4.4447  2.1089 0.0349492 *  
13076
[2,]  10.1836  3.5496  2.8689 0.0041185 ** 
13076
[2,]  10.1836  3.5496  2.8689 0.0041185 ** 
13077
[3,]   9.1644  2.7365  3.3490 0.0008111 ***
13077
[3,]   9.1644  2.7365  3.3490 0.0008111 ***
13078
---
13078
---
13079
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
13079
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
13080
> op <- options(show.coef.Pvalues = FALSE)
13080
> op <- options(show.coef.Pvalues = FALSE)
13081
> printCoefmat(cmat, digits = 2)
13081
> printCoefmat(cmat, digits = 2)
13082
     Estimate Std.Err Z value
13082
     Estimate Std.Err Z value
13083
[1,]      9.4     4.4     2.1
13083
[1,]      9.4     4.4     2.1
13084
[2,]     10.2     3.5     2.9
13084
[2,]     10.2     3.5     2.9
Line 13087... Line 13087...
13087
     Estimate Std.Err Z value Pr(>z)    
13087
     Estimate Std.Err Z value Pr(>z)    
13088
[1,]      9.4     4.4     2.1  0.035 *  
13088
[1,]      9.4     4.4     2.1  0.035 *  
13089
[2,]     10.2     3.5     2.9  0.004 ** 
13089
[2,]     10.2     3.5     2.9  0.004 ** 
13090
[3,]      9.2     2.7     3.3  8e-04 ***
13090
[3,]      9.2     2.7     3.3  8e-04 ***
13091
---
13091
---
13092
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
13092
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
13093
> options(op) # restore
13093
> options(op) # restore
13094
> 
13094
> 
13095
> 
13095
> 
13096
> 
13096
> 
13097
> cleanEx()
13097
> cleanEx()
Line 13901... Line 13901...
13901
(Intercept)   29.278      3.162   9.260    2e-12 ***
13901
(Intercept)   29.278      3.162   9.260    2e-12 ***
13902
woolB         -5.778      3.162  -1.827   0.0736 .  
13902
woolB         -5.778      3.162  -1.827   0.0736 .  
13903
tensionL      10.000      3.872   2.582   0.0128 *  
13903
tensionL      10.000      3.872   2.582   0.0128 *  
13904
tensionH      -4.722      3.872  -1.219   0.2284    
13904
tensionH      -4.722      3.872  -1.219   0.2284    
13905
---
13905
---
13906
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
13906
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
13907
 
13907
 
13908
Residual standard error: 11.62 on 50 degrees of freedom
13908
Residual standard error: 11.62 on 50 degrees of freedom
13909
Multiple R-squared:  0.2691,	Adjusted R-squared:  0.2253 
13909
Multiple R-squared:  0.2691,	Adjusted R-squared:  0.2253 
13910
F-statistic: 6.138 on 3 and 50 DF,  p-value: 0.00123
13910
F-statistic: 6.138 on 3 and 50 DF,  p-value: 0.00123
13911
 
13911
 
Line 14676... Line 14676...
14676
A:B          2  81.56   40.78   4.823 0.01527 * 
14676
A:B          2  81.56   40.78   4.823 0.01527 * 
14677
  A:B: C1    1  13.50   13.50   1.597 0.21612   
14677
  A:B: C1    1  13.50   13.50   1.597 0.21612   
14678
  A:B: C2    1  68.06   68.06   8.049 0.00809 **
14678
  A:B: C2    1  68.06   68.06   8.049 0.00809 **
14679
Residuals   30 253.67    8.46                   
14679
Residuals   30 253.67    8.46                   
14680
---
14680
---
14681
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
14681
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
14682
> ## t.stat^2 is the F value on the A:B: C1 line (with Helmert contrasts)
14682
> ## t.stat^2 is the F value on the A:B: C1 line (with Helmert contrasts)
14683
> ## Now look at all three interaction contrasts
14683
> ## Now look at all three interaction contrasts
14684
> cont <- c(1, -1)[A] * cbind(c(1, -1, 0), c(1, 0, -1), c(0, 1, -1))[B,]
14684
> cont <- c(1, -1)[A] * cbind(c(1, -1, 0), c(1, 0, -1), c(0, 1, -1))[B,]
14685
> se.contrast(fit, cont)  # same, due to balance.
14685
> se.contrast(fit, cont)  # same, due to balance.
14686
Contrast 1 Contrast 2 Contrast 3 
14686
Contrast 1 Contrast 2 Contrast 3 
Line 14718... Line 14718...
14718
eff.vl> (fit <- aov(Yield ~ A*B*C + Error(Block), data = aovdat))
14718
eff.vl> (fit <- aov(Yield ~ A*B*C + Error(Block), data = aovdat))
14719
 
14719
 
14720
Call:
14720
Call:
14721
aov(formula = Yield ~ A * B * C + Error(Block), data = aovdat)
14721
aov(formula = Yield ~ A * B * C + Error(Block), data = aovdat)
14722
 
14722
 
14723
Grand Mean: 291.5937
14723
Grand Mean: 291.5938
14724
 
14724
 
14725
Stratum 1: Block
14725
Stratum 1: Block
14726
 
14726
 
14727
Terms:
14727
Terms:
14728
                      A:B       A:C       B:C     A:B:C Residuals
14728
                      A:B       A:C       B:C     A:B:C Residuals
Line 14737... Line 14737...
14737
Terms:
14737
Terms:
14738
                        A         B         C       A:B       A:C       B:C
14738
                        A         B         C       A:B       A:C       B:C
14739
Sum of Squares    3465.28 161170.03 278817.78     28.17   1802.67  11528.17
14739
Sum of Squares    3465.28 161170.03 278817.78     28.17   1802.67  11528.17
14740
Deg. of Freedom         1         1         1         1         1         1
14740
Deg. of Freedom         1         1         1         1         1         1
14741
                    A:B:C Residuals
14741
                    A:B:C Residuals
14742
Sum of Squares      45.38   5423.28
14742
Sum of Squares      45.37   5423.28
14743
Deg. of Freedom         1        17
14743
Deg. of Freedom         1        17
14744
 
14744
 
14745
Residual standard error: 17.86103
14745
Residual standard error: 17.86103
14746
Estimated effects are balanced
14746
Estimated effects are balanced
14747
 
14747
 
Line 15547... Line 15547...
15547
> 
15547
> 
15548
> ## look at the internal structure:
15548
> ## look at the internal structure:
15549
> unclass(sfun0)
15549
> unclass(sfun0)
15550
function (v) 
15550
function (v) 
15551
.approxfun(x, y, v, method, yleft, yright, f)
15551
.approxfun(x, y, v, method, yleft, yright, f)
15552
<bytecode: 0x7f9344070e30>
15552
<bytecode: 0x4a01dc0>
15553
<environment: 0x7f9349fb2dc8>
15553
<environment: 0xa664e58>
15554
attr(,"call")
15554
attr(,"call")
15555
stepfun(1:3, y0, f = 0)
15555
stepfun(1:3, y0, f = 0)
15556
> ls(envir = environment(sfun0))
15556
> ls(envir = environment(sfun0))
15557
[1] "f"      "method" "x"      "y"      "yleft"  "yright"
15557
[1] "f"      "method" "x"      "y"      "yleft"  "yright"
15558
> 
15558
> 
Line 15785... Line 15785...
15785
Coefficients:
15785
Coefficients:
15786
         Estimate Std. Error t value Pr(>|t|)    
15786
         Estimate Std. Error t value Pr(>|t|)    
15787
groupCtl   5.0320     0.2202   22.85 9.55e-15 ***
15787
groupCtl   5.0320     0.2202   22.85 9.55e-15 ***
15788
groupTrt   4.6610     0.2202   21.16 3.62e-14 ***
15788
groupTrt   4.6610     0.2202   21.16 3.62e-14 ***
15789
---
15789
---
15790
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
15790
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
15791
 
15791
 
15792
Residual standard error: 0.6964 on 18 degrees of freedom
15792
Residual standard error: 0.6964 on 18 degrees of freedom
15793
Multiple R-squared:  0.9818,	Adjusted R-squared:  0.9798 
15793
Multiple R-squared:  0.9818,	Adjusted R-squared:  0.9798 
15794
F-statistic: 485.1 on 2 and 18 DF,  p-value: < 2.2e-16
15794
F-statistic: 485.1 on 2 and 18 DF,  p-value: < 2.2e-16
15795
 
15795
 
Line 15814... Line 15814...
15814
                      Estimate Std. Error t value Pr(>|t|)    
15814
                      Estimate Std. Error t value Pr(>|t|)    
15815
(Intercept)             5.0320     0.2202  22.850 9.55e-15 ***
15815
(Intercept)             5.0320     0.2202  22.850 9.55e-15 ***
15816
groupTrt               -0.3710     0.3114  -1.191    0.249    
15816
groupTrt               -0.3710     0.3114  -1.191    0.249    
15817
I(group != "Ctl")TRUE       NA         NA      NA       NA    
15817
I(group != "Ctl")TRUE       NA         NA      NA       NA    
15818
---
15818
---
15819
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
15819
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
15820
 
15820
 
15821
Residual standard error: 0.6964 on 18 degrees of freedom
15821
Residual standard error: 0.6964 on 18 degrees of freedom
15822
Multiple R-squared:  0.07308,	Adjusted R-squared:  0.02158 
15822
Multiple R-squared:  0.07308,	Adjusted R-squared:  0.02158 
15823
F-statistic: 1.419 on 1 and 18 DF,  p-value: 0.249
15823
F-statistic: 1.419 on 1 and 18 DF,  p-value: 0.249
15824
 
15824
 
Line 15916... Line 15916...
15916
> ii <- setNames(0:8, 0:8)
15916
> ii <- setNames(0:8, 0:8)
15917
> symnum(ii, cut =  2*(0:4), sym = c(".", "-", "+", "$"))
15917
> symnum(ii, cut =  2*(0:4), sym = c(".", "-", "+", "$"))
15918
0 1 2 3 4 5 6 7 8 
15918
0 1 2 3 4 5 6 7 8 
15919
. . . - - + + $ $ 
15919
. . . - - + + $ $ 
15920
attr(,"legend")
15920
attr(,"legend")
15921
[1] 0 '.' 2 '-' 4 '+' 6 '$' 8
15921
[1] 0 ‘.’ 2 ‘-’ 4 ‘+’ 6 ‘$’ 8
15922
> symnum(ii, cut =  2*(0:4), sym = c(".", "-", "+", "$"), show.max = TRUE)
15922
> symnum(ii, cut =  2*(0:4), sym = c(".", "-", "+", "$"), show.max = TRUE)
15923
0 1 2 3 4 5 6 7 8 
15923
0 1 2 3 4 5 6 7 8 
15924
. . . - - + + $ 8 
15924
. . . - - + + $ 8 
15925
attr(,"legend")
15925
attr(,"legend")
15926
[1] 0 '.' 2 '-' 4 '+' 6 '$' 8
15926
[1] 0 ‘.’ 2 ‘-’ 4 ‘+’ 6 ‘$’ 8
15927
> 
15927
> 
15928
> symnum(1:12 %% 3 == 0)  # --> "|" = TRUE, "." = FALSE  for logical
15928
> symnum(1:12 %% 3 == 0)  # --> "|" = TRUE, "." = FALSE  for logical
15929
 [1] . . | . . | . . | . . |
15929
 [1] . . | . . | . . | . . |
15930
> 
15930
> 
15931
> ## Pascal's Triangle modulo 2 -- odd and even numbers:
15931
> ## Pascal's Triangle modulo 2 -- odd and even numbers:
Line 15983... Line 15983...
15983
learning   ,  .  .          
15983
learning   ,  .  .          
15984
raises     .  ,  . ,        
15984
raises     .  ,  . ,        
15985
critical             .      
15985
critical             .      
15986
advance          . . .      
15986
advance          . . .      
15987
attr(,"legend")
15987
attr(,"legend")
15988
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
15988
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
15989
> symnum(cor(attitude), abbr. = NULL)
15989
> symnum(cor(attitude), abbr. = NULL)
15990
                        
15990
                        
15991
rating     1            
15991
rating     1            
15992
complaints + 1          
15992
complaints + 1          
15993
privileges . . 1        
15993
privileges . . 1        
15994
learning   , . . 1      
15994
learning   , . . 1      
15995
raises     . , . , 1    
15995
raises     . , . , 1    
15996
critical           . 1  
15996
critical           . 1  
15997
advance        . . .   1
15997
advance        . . .   1
15998
attr(,"legend")
15998
attr(,"legend")
15999
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
15999
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16000
> symnum(cor(attitude), abbr. = FALSE)
16000
> symnum(cor(attitude), abbr. = FALSE)
16001
           rating complaints privileges learning raises critical advance
16001
           rating complaints privileges learning raises critical advance
16002
rating     1                                                            
16002
rating     1                                                            
16003
complaints +      1                                                     
16003
complaints +      1                                                     
16004
privileges .      .          1                                          
16004
privileges .      .          1                                          
16005
learning   ,      .          .          1                               
16005
learning   ,      .          .          1                               
16006
raises     .      ,          .          ,        1                      
16006
raises     .      ,          .          ,        1                      
16007
critical                                         .      1               
16007
critical                                         .      1               
16008
advance                      .          .        .               1      
16008
advance                      .          .        .               1      
16009
attr(,"legend")
16009
attr(,"legend")
16010
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
16010
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16011
> symnum(cor(attitude), abbr. = 2)
16011
> symnum(cor(attitude), abbr. = 2)
16012
           rt cm pr lr rs cr ad
16012
           rt cm pr lr rs cr ad
16013
rating     1                   
16013
rating     1                   
16014
complaints +  1                
16014
complaints +  1                
16015
privileges .  .  1             
16015
privileges .  .  1             
16016
learning   ,  .  .  1          
16016
learning   ,  .  .  1          
16017
raises     .  ,  .  ,  1       
16017
raises     .  ,  .  ,  1       
16018
critical               .  1    
16018
critical               .  1    
16019
advance          .  .  .     1 
16019
advance          .  .  .     1 
16020
attr(,"legend")
16020
attr(,"legend")
16021
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
16021
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16022
> 
16022
> 
16023
> symnum(cor(rbind(1, rnorm(25), rnorm(25)^2)))
16023
> symnum(cor(rbind(1, rnorm(25), rnorm(25)^2)))
16024
                                                       
16024
                                                       
16025
 [1,] 1                                                
16025
 [1,] 1                                                
16026
 [2,] + 1                                              
16026
 [2,] + 1                                              
Line 16046... Line 16046...
16046
[22,] . , , , + . B B B , + + . . + , , B B + B 1      
16046
[22,] . , , , + . B B B , + + . . + , , B B + B 1      
16047
[23,] B , , . , , .   . , . , B +   + +     ,     1    
16047
[23,] B , , . , , .   . , . , B +   + +     ,     1    
16048
[24,] * , , . , , .     , . . * * . , ,     .     B 1  
16048
[24,] * , , . , , .     , . . * * . , ,     .     B 1  
16049
[25,] B + . . + . , . . .   , B ,   * *   . +   . B B 1
16049
[25,] B + . . + . , . . .   , B ,   * *   . +   . B B 1
16050
attr(,"legend")
16050
attr(,"legend")
16051
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
16051
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16052
> symnum(cor(matrix(rexp(30, 1), 5, 18))) # <<-- PATTERN ! --
16052
> symnum(cor(matrix(rexp(30, 1), 5, 18))) # <<-- PATTERN ! --
16053
                                         
16053
                                         
16054
 [1,] 1                                  
16054
 [1,] 1                                  
16055
 [2,] . 1                                
16055
 [2,] . 1                                
16056
 [3,]     1                              
16056
 [3,]     1                              
Line 16068... Line 16068...
16068
[15,]     1   .       1   .       1      
16068
[15,]     1   .       1   .       1      
16069
[16,] . .   1     . .   1     . .   1    
16069
[16,] . .   1     . .   1     . .   1    
16070
[17,]   , .   1 ,   , .   1 ,   , .   1  
16070
[17,]   , .   1 ,   , .   1 ,   , .   1  
16071
[18,]   ,     , 1   ,     , 1   ,     , 1
16071
[18,]   ,     , 1   ,     , 1   ,     , 1
16072
attr(,"legend")
16072
attr(,"legend")
16073
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
16073
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16074
> symnum(cm1 <- cor(matrix(rnorm(90) ,  5, 18))) # < White Noise SMALL n
16074
> symnum(cm1 <- cor(matrix(rnorm(90) ,  5, 18))) # < White Noise SMALL n
16075
                                         
16075
                                         
16076
 [1,] 1                                  
16076
 [1,] 1                                  
16077
 [2,] . 1                                
16077
 [2,] . 1                                
16078
 [3,] . . 1                              
16078
 [3,] . . 1                              
Line 16090... Line 16090...
16090
[15,]   .   .     .   . .     . + 1      
16090
[15,]   .   .     .   . .     . + 1      
16091
[16,] .   , .   .   . . . .         1    
16091
[16,] .   , .   .   . . . .         1    
16092
[17,]   , +   , +       . . * .     . 1  
16092
[17,]   , +   , +       . . * .     . 1  
16093
[18,]   . .   * , . . .   , ,     .   . 1
16093
[18,]   . .   * , . . .   , ,     .   . 1
16094
attr(,"legend")
16094
attr(,"legend")
16095
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
16095
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16096
> symnum(cm1, diag = FALSE)
16096
> symnum(cm1, diag = FALSE)
16097
                                        
16097
                                        
16098
 [1,]                                   
16098
 [1,]                                   
16099
 [2,] .                                 
16099
 [2,] .                                 
16100
 [3,] . .                               
16100
 [3,] . .                               
Line 16112... Line 16112...
16112
[15,]   .   .     .   . .     . +       
16112
[15,]   .   .     .   . .     . +       
16113
[16,] .   , .   .   . . . .             
16113
[16,] .   , .   .   . . . .             
16114
[17,]   , +   , +       . . * .     .   
16114
[17,]   , +   , +       . . * .     .   
16115
[18,]   . .   * , . . .   , ,     .   . 
16115
[18,]   . .   * , . . .   , ,     .   . 
16116
attr(,"legend")
16116
attr(,"legend")
16117
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
16117
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16118
> symnum(cm2 <- cor(matrix(rnorm(900), 50, 18))) # < White Noise "BIG" n
16118
> symnum(cm2 <- cor(matrix(rnorm(900), 50, 18))) # < White Noise "BIG" n
16119
                                         
16119
                                         
16120
 [1,] 1                                  
16120
 [1,] 1                                  
16121
 [2,]   1                                
16121
 [2,]   1                                
16122
 [3,]     1                              
16122
 [3,]     1                              
Line 16134... Line 16134...
16134
[15,]                             1      
16134
[15,]                             1      
16135
[16,]                               1    
16135
[16,]                               1    
16136
[17,]                                 1  
16136
[17,]                                 1  
16137
[18,]                                   1
16137
[18,]                                   1
16138
attr(,"legend")
16138
attr(,"legend")
16139
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
16139
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16140
> symnum(cm2, lower = FALSE)
16140
> symnum(cm2, lower = FALSE)
16141
                                         
16141
                                         
16142
 [1,] 1                                  
16142
 [1,] 1                                  
16143
 [2,]   1                                
16143
 [2,]   1                                
16144
 [3,]     1                              
16144
 [3,]     1                              
Line 16156... Line 16156...
16156
[15,]                             1      
16156
[15,]                             1      
16157
[16,]                               1    
16157
[16,]                               1    
16158
[17,]                                 1  
16158
[17,]                                 1  
16159
[18,]                                   1
16159
[18,]                                   1
16160
attr(,"legend")
16160
attr(,"legend")
16161
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1
16161
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1
16162
> 
16162
> 
16163
> ## NA's:
16163
> ## NA's:
16164
> Cm <- cor(matrix(rnorm(60),  10, 6)); Cm[c(3,6), 2] <- NA
16164
> Cm <- cor(matrix(rnorm(60),  10, 6)); Cm[c(3,6), 2] <- NA
16165
> symnum(Cm, show.max = NULL)
16165
> symnum(Cm, show.max = NULL)
16166
               
16166
               
Line 16169... Line 16169...
16169
[3,] . ?       
16169
[3,] . ?       
16170
[4,] .   ,     
16170
[4,] .   ,     
16171
[5,]     .     
16171
[5,]     .     
16172
[6,] , ?       
16172
[6,] , ?       
16173
attr(,"legend")
16173
attr(,"legend")
16174
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1 \t    ## NA: '?'
16174
[1] 0 ‘ ’ 0.3 ‘.’ 0.6 ‘,’ 0.8 ‘+’ 0.9 ‘*’ 0.95 ‘B’ 1 \t    ## NA: ‘?’
16175
> 
16175
> 
16176
> ## Graphical P-values (aka "significance stars"):
16176
> ## Graphical P-values (aka "significance stars"):
16177
> pval <- rev(sort(c(outer(1:6, 10^-(1:3)))))
16177
> pval <- rev(sort(c(outer(1:6, 10^-(1:3)))))
16178
> symp <- symnum(pval, corr = FALSE,
16178
> symp <- symnum(pval, corr = FALSE,
16179
+                cutpoints = c(0,  .001,.01,.05, .1, 1),
16179
+                cutpoints = c(0,  .001,.01,.05, .1, 1),
Line 16957... Line 16957...
16957
search in [0,2] ... extended to [-1073.74, 2.14748e+07] in 30 steps
16957
search in [0,2] ... extended to [-1073.74, 2.14748e+07] in 30 steps
16958
> 
16958
> 
16959
> ## Nonsense example (must give an error):
16959
> ## Nonsense example (must give an error):
16960
> tools::assertCondition( uniroot(function(x) 1, 0:1, extendInt="yes"),
16960
> tools::assertCondition( uniroot(function(x) 1, 0:1, extendInt="yes"),
16961
+                        "error", verbose=TRUE)
16961
+                        "error", verbose=TRUE)
16962
assertCondition: caught "error"
16962
assertCondition: caught “error”
16963
> 
16963
> 
16964
> ## Convergence checking :
16964
> ## Convergence checking :
16965
> sinc <- function(x) ifelse(x == 0, 1, sin(x)/x)
16965
> sinc <- function(x) ifelse(x == 0, 1, sin(x)/x)
16966
> curve(sinc, -6,18); abline(h=0,v=0, lty=3, col=adjustcolor("gray", 0.8))
16966
> curve(sinc, -6,18); abline(h=0,v=0, lty=3, col=adjustcolor("gray", 0.8))
16967
> ## Don't show: 
16967
> ## Don't show: 
Line 17058... Line 17058...
17058
Coefficients:
17058
Coefficients:
17059
         Estimate Std. Error t value Pr(>|t|)    
17059
         Estimate Std. Error t value Pr(>|t|)    
17060
groupCtl   5.0320     0.2202   22.85 9.55e-15 ***
17060
groupCtl   5.0320     0.2202   22.85 9.55e-15 ***
17061
groupTrt   4.6610     0.2202   21.16 3.62e-14 ***
17061
groupTrt   4.6610     0.2202   21.16 3.62e-14 ***
17062
---
17062
---
17063
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
17063
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
17064
 
17064
 
17065
Residual standard error: 0.6964 on 18 degrees of freedom
17065
Residual standard error: 0.6964 on 18 degrees of freedom
17066
Multiple R-squared:  0.9818,	Adjusted R-squared:  0.9798 
17066
Multiple R-squared:  0.9818,	Adjusted R-squared:  0.9798 
17067
F-statistic: 485.1 on 2 and 18 DF,  p-value: < 2.2e-16
17067
F-statistic: 485.1 on 2 and 18 DF,  p-value: < 2.2e-16
17068
 
17068
 
Line 17797... Line 17797...
17797
> 
17797
> 
17798
> 
17798
> 
17799
> 
17799
> 
17800
> cleanEx()
17800
> cleanEx()
17801
 
17801
 
17802
detaching 'package:Matrix', 'package:lattice'
17802
detaching ‘package:Matrix’, ‘package:lattice’
17803
 
17803
 
17804
> nameEx("zC")
17804
> nameEx("zC")
17805
> ### * zC
17805
> ### * zC
17806
> 
17806
> 
17807
> flush(stderr()); flush(stdout())
17807
> flush(stderr()); flush(stdout())
Line 17845... Line 17845...
17845
(Intercept)             29.278      3.162   9.260    2e-12 ***
17845
(Intercept)             29.278      3.162   9.260    2e-12 ***
17846
woolB                   -5.778      3.162  -1.827   0.0736 .  
17846
woolB                   -5.778      3.162  -1.827   0.0736 .  
17847
C(tension, base = 2)1   10.000      3.872   2.582   0.0128 *  
17847
C(tension, base = 2)1   10.000      3.872   2.582   0.0128 *  
17848
C(tension, base = 2)3   -4.722      3.872  -1.219   0.2284    
17848
C(tension, base = 2)3   -4.722      3.872  -1.219   0.2284    
17849
---
17849
---
17850
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
17850
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
17851
 
17851
 
17852
Residual standard error: 11.62 on 50 degrees of freedom
17852
Residual standard error: 11.62 on 50 degrees of freedom
17853
Multiple R-squared:  0.2691,	Adjusted R-squared:  0.2253 
17853
Multiple R-squared:  0.2691,	Adjusted R-squared:  0.2253 
17854
F-statistic: 6.138 on 3 and 50 DF,  p-value: 0.00123
17854
F-statistic: 6.138 on 3 and 50 DF,  p-value: 0.00123
17855
 
17855
 
Line 17877... Line 17877...
17877
agegp^4          0.06668    0.30776   0.217  0.82848    
17877
agegp^4          0.06668    0.30776   0.217  0.82848    
17878
agegp^5         -0.20288    0.19523  -1.039  0.29872    
17878
agegp^5         -0.20288    0.19523  -1.039  0.29872    
17879
C(tobgp, , 1).L  0.58501    0.18331   3.191  0.00142 ** 
17879
C(tobgp, , 1).L  0.58501    0.18331   3.191  0.00142 ** 
17880
C(alcgp, , 1).L  1.46034    0.18899   7.727 1.10e-14 ***
17880
C(alcgp, , 1).L  1.46034    0.18899   7.727 1.10e-14 ***
17881
---
17881
---
17882
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
17882
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
17883
 
17883
 
17884
(Dispersion parameter for binomial family taken to be 1)
17884
(Dispersion parameter for binomial family taken to be 1)
17885
 
17885
 
17886
    Null deviance: 227.241  on 87  degrees of freedom
17886
    Null deviance: 227.241  on 87  degrees of freedom
17887
Residual deviance:  59.277  on 80  degrees of freedom
17887
Residual deviance:  59.277  on 80  degrees of freedom
Line 17895... Line 17895...
17895
> base::options(contrasts = c(unordered = "contr.treatment",ordered = "contr.poly"))
17895
> base::options(contrasts = c(unordered = "contr.treatment",ordered = "contr.poly"))
17896
> ### * <FOOTER>
17896
> ### * <FOOTER>
17897
> ###
17897
> ###
17898
> options(digits = 7L)
17898
> options(digits = 7L)
17899
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
17899
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
17900
Time elapsed:  7.043 0.31 7.584 0 0 
17900
Time elapsed:  6.681 0.143 6.848 0 0 
17901
> grDevices::dev.off()
17901
> grDevices::dev.off()
17902
null device 
17902
null device 
17903
          1 
17903
          1 
17904
> ###
17904
> ###
17905
> ### Local variables: ***
17905
> ### Local variables: ***