768 lines
37 KiB
Plaintext
Raw Normal View History

2025-01-12 00:52:51 +08:00
R version 3.4.3 Patched (2018-02-11 r74243) -- "Kite-Eating Tree"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.4.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(nlme)
>
> op <- options(digits = 3) # reduce rounding differences
>
> Ovary[c(1,272), 2] <- NA
> fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
+ correlation = corAR1(form = ~ 1 | Mare), na.action=na.exclude)
> fitted(fm1)
1 2 3 4 5 6 7 8 9 10 11 12 13
NA 12.86 12.06 11.27 10.55 9.96 9.54 9.34 9.36 9.60 10.05 10.67 11.41
14 15 16 17 18 19 20 21 22 23 24 25 26
12.21 13.00 13.71 14.31 14.72 14.93 14.91 14.66 14.21 13.59 12.86 12.06 11.27
27 28 29 30 31 32 33 34 35 36 37 38 39
10.55 9.96 9.54 13.79 13.01 12.14 11.27 10.49 9.86 9.46 9.32 9.45 9.85
40 41 42 43 44 45 46 47 48 49 50 51 52
10.47 11.26 12.13 13.00 13.78 14.41 14.81 14.95 14.81 14.41 13.79 13.01 12.14
53 54 55 56 57 58 59 60 61 62 63 64 65
11.27 10.49 9.86 9.46 13.90 13.10 12.19 11.27 10.45 9.81 9.42 9.32 9.53
66 67 68 69 70 71 72 73 74 75 76 77 78
10.03 10.75 11.62 12.54 13.42 14.17 14.69 14.93 14.87 14.52 13.90 13.10 12.19
79 80 81 82 83 84 85 86 87 88 89 90 91
11.27 10.45 9.81 9.42 13.59 12.86 12.06 11.27 10.55 9.96 9.54 9.34 9.36
92 93 94 95 96 97 98 99 100 101 102 103 104
9.60 10.05 10.67 11.41 12.21 13.00 13.71 14.31 14.72 14.93 14.91 14.66 14.21
105 106 107 108 109 110 111 112 113 114 115 116 117
13.59 12.86 12.06 11.27 10.55 9.96 9.54 13.59 12.86 12.06 11.27 10.55 9.96
118 119 120 121 122 123 124 125 126 127 128 129 130
9.54 9.34 9.36 9.60 10.05 10.67 11.41 12.21 13.00 13.71 14.31 14.72 14.93
131 132 133 134 135 136 137 138 139 140 141 142 143
14.91 14.66 14.21 13.59 12.86 12.06 11.27 10.55 9.96 9.54 13.59 12.86 12.06
144 145 146 147 148 149 150 151 152 153 154 155 156
11.27 10.55 9.96 9.54 9.34 9.36 9.60 10.05 10.67 11.41 12.21 13.00 13.71
157 158 159 160 161 162 163 164 165 166 167 168 169
14.31 14.72 14.93 14.91 14.66 14.21 13.59 12.86 12.06 11.27 10.55 9.96 9.54
170 171 172 173 174 175 176 177 178 179 180 181 182
13.79 13.01 12.14 11.27 10.49 9.86 9.46 9.32 9.45 9.85 10.47 11.26 12.13
183 184 185 186 187 188 189 190 191 192 193 194 195
13.00 13.78 14.41 14.81 14.95 14.81 14.41 13.79 13.01 12.14 11.27 10.49 9.86
196 197 198 199 200 201 202 203 204 205 206 207 208
9.46 13.42 12.73 11.99 11.27 10.61 10.05 9.63 9.38 9.32 9.45 9.77 10.24
209 210 211 212 213 214 215 216 217 218 219 220 221
10.85 11.54 12.27 13.00 13.66 14.22 14.64 14.88 14.94 14.81 14.50 14.02 13.42
222 223 224 225 226 227 228 229 230 231 232 233 234
12.73 11.99 11.27 10.61 10.05 9.63 14.02 13.19 12.24 11.27 10.41 9.75 9.38
235 236 237 238 239 240 241 242 243 244 245 246 247
9.35 9.64 10.24 11.07 12.03 13.00 13.86 14.52 14.88 14.92 14.62 14.02 13.19
248 249 250 251 252 253 254 255 256 257 258 259 260
12.24 11.27 10.41 9.75 9.38 13.59 12.86 12.06 11.27 10.55 9.96 9.54 9.34
261 262 263 264 265 266 267 268 269 270 271 272 273
9.36 9.60 10.05 10.67 11.41 12.21 13.00 13.71 14.31 14.72 14.93 NA 14.66
274 275 276 277 278 279 280 281 282 283 284 285 286
14.21 13.59 12.86 12.06 11.27 10.55 9.96 9.54 13.79 13.01 12.14 11.27 10.49
287 288 289 290 291 292 293 294 295 296 297 298 299
9.86 9.46 9.32 9.45 9.85 10.47 11.26 12.13 13.00 13.78 14.41 14.81 14.95
300 301 302 303 304 305 306 307 308
14.81 14.41 13.79 13.01 12.14 11.27 10.49 9.86 9.46
attr(,"label")
[1] "Fitted values"
> residuals(fm1)
1 2 3 4 5 6 7 8
NA 2.1439 6.9394 4.7290 2.4488 0.0405 2.4560 4.6618
9 10 11 12 13 14 15 16
3.6412 10.3959 11.9456 4.3270 6.5900 4.7945 1.0049 4.2851
17 18 19 20 21 22 23 24
-0.3066 1.2779 2.0720 3.0927 3.3380 2.7883 0.4069 -0.8561
25 26 27 28 29 30 31 32
-0.0606 2.7290 -0.5512 1.0405 6.4560 -7.7936 -7.0102 -4.1410
33 34 35 36 37 38 39 40
-4.2710 5.5146 0.1390 3.5409 -0.3189 -2.4542 -3.8517 -2.4725
41 42 43 44 45 46 47 48
-3.2559 -6.1251 -4.9951 -6.7808 -5.4051 -8.8070 -10.9472 -9.8119
49 50 51 52 53 54 55 56
-6.4144 -2.7936 -0.0102 -2.1410 -5.2710 -3.4854 -3.8610 -4.4591
57 58 59 60 61 62 63 64
-0.9042 -2.0982 -2.1875 -5.2710 -2.4479 -3.8074 -0.4189 -0.3245
65 66 67 68 69 70 71 72
0.4655 -2.0261 3.2540 1.3838 1.4576 2.5757 5.8338 6.3122
73 74 75 76 77 78 79 80
10.0674 8.1260 4.4817 8.0958 2.9018 8.8125 7.7290 9.5521
81 82 83 84 85 86 87 88
7.1926 14.5811 -4.5931 -3.8561 -5.0606 -5.2710 -3.5512 -3.9595
89 90 91 92 93 94 95 96
-8.5440 -8.3382 -8.3588 -4.6041 -4.0544 -7.6730 -6.4100 -9.2055
97 98 99 100 101 102 103 104
-6.9951 -5.7149 -8.3066 -9.7221 -8.9280 -6.9073 -3.6620 -0.2117
105 106 107 108 109 110 111 112
-5.5931 -3.8561 -2.0606 -4.2710 -3.5512 -3.9595 1.4560 -3.5931
113 114 115 116 117 118 119 120
-0.8561 -0.0606 5.7290 -1.5512 0.0405 -6.5440 2.6618 3.6412
121 122 123 124 125 126 127 128
-0.6041 -6.0544 -3.6730 -7.4100 -0.2055 1.0049 -1.7149 0.6934
129 130 131 132 133 134 135 136
2.2779 0.0720 -1.9073 3.3380 4.7883 -0.5931 -3.8561 -0.0606
137 138 139 140 141 142 143 144
-3.2710 -0.5512 -4.9595 4.4560 2.4069 4.1439 0.9394 5.7290
145 146 147 148 149 150 151 152
4.4488 -0.9595 -1.5440 -4.3382 -0.3588 -1.6041 -2.0544 2.3270
153 154 155 156 157 158 159 160
2.5900 0.7945 1.0049 0.2851 -3.3066 2.2779 6.0720 6.0927
161 162 163 164 165 166 167 168
6.3380 5.7883 3.4069 5.1439 9.9394 -1.2710 0.4488 1.0405
169 170 171 172 173 174 175 176
2.4560 4.2064 -0.0102 1.8590 0.7290 0.5146 -1.8610 -4.4591
177 178 179 180 181 182 183 184
-1.3189 0.5458 1.1483 -0.4725 0.7441 -2.1251 -3.9951 -1.7808
185 186 187 188 189 190 191 192
-0.4051 1.1930 -1.9472 -3.8119 -1.4144 -0.7936 -2.0102 -1.1410
193 194 195 196 197 198 199 200
-3.2710 3.5146 -5.8610 -2.4591 -0.4177 -3.7259 3.0063 3.7290
201 202 203 204 205 206 207 208
1.3930 -2.0471 0.3708 -3.3821 -0.3224 -1.4542 0.2314 -4.2441
209 210 211 212 213 214 215 216
-2.8484 1.4598 -0.2724 -0.9951 1.3409 6.7809 10.3631 6.1159
217 218 219 220 221 222 223 224
6.0562 9.1881 5.5025 5.9780 4.5823 7.2741 8.0063 7.7290
225 226 227 228 229 230 231 232
1.3930 -3.0471 -1.6292 -4.0220 0.8054 -0.2392 -1.2710 -3.4068
233 234 235 236 237 238 239 240
2.2493 0.6179 -1.3452 0.3554 4.7559 3.9285 -0.0269 6.0049
241 242 243 244 245 246 247 248
1.1406 1.4846 0.1159 2.0791 -0.6215 1.9780 1.8054 -1.2392
249 250 251 252 253 254 255 256
-1.2710 -3.4067 -5.7507 -1.3821 -2.5931 3.1439 2.9394 0.7290
257 258 259 260 261 262 263 264
0.4488 -3.9595 1.4560 2.6618 1.6412 6.3959 4.9456 0.3270
265 266 267 268 269 270 271 272
-4.4100 1.7945 7.0049 8.2851 8.6934 6.2779 6.0720 NA
273 274 275 276 277 278 279 280
7.3380 7.7883 3.4069 4.1439 4.9394 5.7290 3.4488 2.0405
281 282 283 284 285 286 287 288
1.4560 -4.7936 -5.0102 -4.1410 -3.2710 -2.4854 -3.8610 -2.4591
289 290 291 292 293 294 295 296
-1.3189 0.5458 0.1483 3.5275 1.7441 -4.1251 -4.9951 -5.7808
297 298 299 300 301 302 303 304
-5.4051 1.1930 -2.9472 -4.8119 -2.4144 -1.7936 -4.0102 -6.1410
305 306 307 308
-2.2710 -3.4854 -4.8610 -4.4591
attr(,"std")
[1] NA 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[16] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[31] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[46] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[61] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[76] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[91] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[106] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[121] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[136] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[151] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[166] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[181] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[196] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[211] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[226] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[241] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[256] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[271] 4.58 NA 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[286] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
[301] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58
attr(,"label")
[1] "Residuals"
> summary(fm1)
Generalized least squares fit by REML
Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time)
Data: Ovary
AIC BIC logLik
1560 1579 -775
Correlation Structure: AR(1)
Formula: ~1 | Mare
Parameter estimate(s):
Phi
0.75
Coefficients:
Value Std.Error t-value p-value
(Intercept) 12.13 0.657 18.46 0.000
sin(2 * pi * Time) -2.68 0.644 -4.16 0.000
cos(2 * pi * Time) -0.86 0.690 -1.25 0.213
Correlation:
(Intr) s(*p*T
sin(2 * pi * Time) -0.007
cos(2 * pi * Time) -0.295 0.003
Standardized residuals:
Min Q1 Med Q3 Max
-2.3897 -0.7565 -0.0132 0.6396 3.1830
Residual standard error: 4.58
Degrees of freedom: 306 total; 303 residual
>
> Orthodont[100:102, 2] <- NA
> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1,
+ na.action=na.exclude)
> fitted(fm2, 0:1)
fixed Subject
1 23.0 25.4
2 24.3 26.7
3 25.6 28.0
4 27.0 29.4
5 23.0 21.6
6 24.3 22.9
7 25.6 24.3
8 27.0 25.6
9 23.0 22.3
10 24.3 23.7
11 25.6 25.0
12 27.0 26.4
13 23.0 24.4
14 24.3 25.7
15 25.6 27.1
16 27.0 28.4
17 23.0 21.3
18 24.3 22.6
19 25.6 23.9
20 27.0 25.3
21 23.0 24.2
22 24.3 25.5
23 25.6 26.9
24 27.0 28.2
25 23.0 21.9
26 24.3 23.2
27 25.6 24.6
28 27.0 25.9
29 23.0 22.0
30 24.3 23.4
31 25.6 24.7
32 27.0 26.0
33 23.0 23.1
34 24.3 24.4
35 25.6 25.8
36 27.0 27.1
37 23.0 26.9
38 24.3 28.2
39 25.6 29.5
40 27.0 30.9
41 23.0 21.8
42 24.3 23.1
43 25.6 24.5
44 27.0 25.8
45 23.0 22.3
46 24.3 23.7
47 25.6 25.0
48 27.0 26.4
49 23.0 22.3
50 24.3 23.7
51 25.6 25.0
52 27.0 26.4
53 23.0 22.9
54 24.3 24.2
55 25.6 25.6
56 27.0 26.9
57 23.0 23.7
58 24.3 25.1
59 25.6 26.4
60 27.0 27.8
61 23.0 21.3
62 24.3 22.6
63 25.6 23.9
64 27.0 25.3
65 20.7 19.5
66 22.0 20.9
67 23.4 22.2
68 24.7 23.6
69 20.7 20.9
70 22.0 22.3
71 23.4 23.6
72 24.7 25.0
73 20.7 21.6
74 22.0 22.9
75 23.4 24.3
76 24.7 25.6
77 20.7 22.6
78 22.0 23.9
79 23.4 25.2
80 24.7 26.6
81 20.7 20.6
82 22.0 22.0
83 23.4 23.3
84 24.7 24.6
85 20.7 19.3
86 22.0 20.7
87 23.4 22.0
88 24.7 23.4
89 20.7 20.9
90 22.0 22.3
91 23.4 23.6
92 24.7 25.0
93 20.7 21.3
94 22.0 22.6
95 23.4 24.0
96 24.7 25.3
97 20.7 19.8
98 22.0 21.2
99 23.4 22.5
100 NA NA
101 NA NA
102 NA NA
103 23.4 19.7
104 24.7 21.1
105 20.7 23.9
106 22.0 25.2
107 23.4 26.5
108 24.7 27.9
> fitted(fm2)
M01 M01 M01 M01 M02 M02 M02 M02 M03 M03 M03 M03 M04 M04 M04 M04
25.4 26.7 28.0 29.4 21.6 22.9 24.3 25.6 22.3 23.7 25.0 26.4 24.4 25.7 27.1 28.4
M05 M05 M05 M05 M06 M06 M06 M06 M07 M07 M07 M07 M08 M08 M08 M08
21.3 22.6 23.9 25.3 24.2 25.5 26.9 28.2 21.9 23.2 24.6 25.9 22.0 23.4 24.7 26.0
M09 M09 M09 M09 M10 M10 M10 M10 M11 M11 M11 M11 M12 M12 M12 M12
23.1 24.4 25.8 27.1 26.9 28.2 29.5 30.9 21.8 23.1 24.5 25.8 22.3 23.7 25.0 26.4
M13 M13 M13 M13 M14 M14 M14 M14 M15 M15 M15 M15 M16 M16 M16 M16
22.3 23.7 25.0 26.4 22.9 24.2 25.6 26.9 23.7 25.1 26.4 27.8 21.3 22.6 23.9 25.3
F01 F01 F01 F01 F02 F02 F02 F02 F03 F03 F03 F03 F04 F04 F04 F04
19.5 20.9 22.2 23.6 20.9 22.3 23.6 25.0 21.6 22.9 24.3 25.6 22.6 23.9 25.2 26.6
F05 F05 F05 F05 F06 F06 F06 F06 F07 F07 F07 F07 F08 F08 F08 F08
20.6 22.0 23.3 24.6 19.3 20.7 22.0 23.4 20.9 22.3 23.6 25.0 21.3 22.6 24.0 25.3
F09 F09 F09 <NA> <NA> <NA> F10 F10 F11 F11 F11 F11
19.8 21.2 22.5 NA NA NA 19.7 21.1 23.9 25.2 26.5 27.9
attr(,"label")
[1] "Fitted values (mm)"
> residuals(fm2, 0:1)
fixed Subject
1 3.0453 0.64827
2 0.7026 -1.69443
3 3.3599 0.96286
4 4.0172 1.62016
5 -1.4547 -0.08111
6 -1.7974 -0.42382
7 -2.6401 -1.26652
8 -0.4828 0.89078
9 0.0453 0.66476
10 -1.7974 -1.17794
11 -1.6401 -1.02064
12 0.5172 1.13665
13 2.5453 1.11786
14 3.2026 1.77515
15 0.8599 -0.56755
16 0.0172 -1.41025
17 -2.9547 -1.25792
18 -0.7974 0.89938
19 -3.1401 -1.44332
20 -0.9828 0.71397
21 1.5453 0.33332
22 1.2026 -0.00938
23 1.3599 0.14791
24 1.5172 0.30521
25 -0.9547 0.09569
26 -2.2974 -1.24701
27 -1.1401 -0.08972
28 -0.4828 0.56758
29 1.0453 1.98796
30 -2.7974 -1.85474
31 -1.1401 -0.19745
32 -1.4828 -0.54015
33 0.0453 -0.08936
34 -3.7974 -3.93206
35 5.3599 5.22523
36 -0.9828 -1.11747
37 4.5453 0.64002
38 3.7026 -0.20268
39 5.3599 1.45461
40 4.5172 0.61191
41 0.0453 1.20342
42 -1.2974 -0.13928
43 -2.1401 -0.98198
44 -1.9828 -0.82469
45 -1.4547 -0.83524
46 -0.7974 -0.17794
47 -1.6401 -1.02064
48 1.0172 1.63665
49 -5.9547 -5.33524
50 0.2026 0.82206
51 0.3599 0.97936
52 2.5172 3.13665
53 -0.4547 -0.37390
54 1.2026 1.28340
55 -0.1401 -0.05930
56 -0.9828 -0.90201
57 0.0453 -0.73575
58 0.2026 -0.57846
59 0.3599 -0.42116
60 3.0172 2.23614
61 -0.9547 0.74208
62 -2.7974 -1.10062
63 -2.1401 -0.44332
64 -1.9828 -0.28603
65 0.3135 1.45594
66 -2.0292 -0.88676
67 -1.8719 -0.72947
68 -1.7146 -0.57217
69 0.3135 0.05543
70 -0.5292 -0.78728
71 0.6281 0.37002
72 0.7854 0.52732
73 -0.1865 -1.09097
74 1.9708 1.06633
75 1.1281 0.22363
76 1.2854 0.38092
77 2.8135 0.93945
78 2.4708 0.59674
79 1.6281 -0.24596
80 1.7854 -0.08866
81 0.8135 0.87862
82 0.9708 1.03592
83 -0.8719 -0.80678
84 -1.2146 -1.14949
85 -0.6865 0.67141
86 -1.0292 0.32870
87 -2.3719 -1.01400
88 -2.2146 -0.85670
89 0.8135 0.55543
90 0.4708 0.21272
91 -0.3719 -0.62998
92 0.2854 0.02732
93 2.3135 1.73223
94 0.9708 0.38953
95 0.1281 -0.45318
96 -0.7146 -1.29588
97 -0.6865 0.16148
98 -1.0292 -0.18122
99 -1.3719 -0.52392
100 NA NA
101 NA NA
102 NA NA
103 -4.3719 -0.74222
104 -5.2146 -1.58492
105 3.8135 0.64666
106 2.9708 -0.19604
107 4.6281 1.46126
108 3.2854 0.11855
> round(residuals(fm2), 2)
M01 M01 M01 M01 M02 M02 M02 M02 M03 M03 M03 M03 M04
0.65 -1.69 0.96 1.62 -0.08 -0.42 -1.27 0.89 0.66 -1.18 -1.02 1.14 1.12
M04 M04 M04 M05 M05 M05 M05 M06 M06 M06 M06 M07 M07
1.78 -0.57 -1.41 -1.26 0.90 -1.44 0.71 0.33 -0.01 0.15 0.31 0.10 -1.25
M07 M07 M08 M08 M08 M08 M09 M09 M09 M09 M10 M10 M10
-0.09 0.57 1.99 -1.85 -0.20 -0.54 -0.09 -3.93 5.23 -1.12 0.64 -0.20 1.45
M10 M11 M11 M11 M11 M12 M12 M12 M12 M13 M13 M13 M13
0.61 1.20 -0.14 -0.98 -0.82 -0.84 -0.18 -1.02 1.64 -5.34 0.82 0.98 3.14
M14 M14 M14 M14 M15 M15 M15 M15 M16 M16 M16 M16 F01
-0.37 1.28 -0.06 -0.90 -0.74 -0.58 -0.42 2.24 0.74 -1.10 -0.44 -0.29 1.46
F01 F01 F01 F02 F02 F02 F02 F03 F03 F03 F03 F04 F04
-0.89 -0.73 -0.57 0.06 -0.79 0.37 0.53 -1.09 1.07 0.22 0.38 0.94 0.60
F04 F04 F05 F05 F05 F05 F06 F06 F06 F06 F07 F07 F07
-0.25 -0.09 0.88 1.04 -0.81 -1.15 0.67 0.33 -1.01 -0.86 0.56 0.21 -0.63
F07 F08 F08 F08 F08 F09 F09 F09 <NA> <NA> <NA> F10 F10
0.03 1.73 0.39 -0.45 -1.30 0.16 -0.18 -0.52 NA NA NA -0.74 -1.58
F11 F11 F11 F11
0.65 -0.20 1.46 0.12
attr(,"label")
[1] "Residuals (mm)"
> summary(fm2)
Linear mixed-effects model fit by REML
Data: Orthodont
AIC BIC logLik
437 450 -213
Random effects:
Formula: ~1 | Subject
(Intercept) Residual
StdDev: 1.8 1.44
Fixed effects: distance ~ age + Sex
Value Std.Error DF t-value p-value
(Intercept) 17.58 0.850 77 20.68 0.0000
age 0.67 0.064 77 10.56 0.0000
SexFemale -2.27 0.762 25 -2.98 0.0064
Correlation:
(Intr) age
age -0.822
SexFemale -0.357 -0.006
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-3.7079 -0.5471 -0.0564 0.4666 3.6314
Number of Observations: 105
Number of Groups: 27
>
> Soybean[1:5, "Time"] <- NA
> fm3 <- gnls(weight ~ SSlogis(Time, Asym, xmid, scal), Soybean,
+ weights = varPower(), na.action=na.exclude)
> fitted(fm3)
1 2 3 4 5 6 7 8 9 10 11
NA NA NA NA NA 7.047 10.958 14.082 15.894 16.756 0.120
12 13 14 15 16 17 18 19 20 21 22
0.298 0.726 1.708 3.724 7.047 10.958 15.894 16.756 0.120 0.298 0.726
23 24 25 26 27 28 29 30 31 32 33
1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708
34 35 36 37 38 39 40 41 42 43 44
3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724
45 46 47 48 49 50 51 52 53 54 55
7.047 10.958 15.894 0.120 0.298 0.726 1.708 3.724 7.047 10.958 14.082
56 57 58 59 60 61 62 63 64 65 66
15.894 16.756 0.120 0.298 0.726 1.708 3.724 7.047 10.958 15.894 16.756
67 68 69 70 71 72 73 74 75 76 77
0.120 0.298 0.726 1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120
78 79 80 81 82 83 84 85 86 87 88
0.298 0.726 1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298
89 90 91 92 93 94 95 96 97 98 99
0.726 1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726
100 101 102 103 104 105 106 107 108 109 110
1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708
111 112 113 114 115 116 117 118 119 120 121
3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724
122 123 124 125 126 127 128 129 130 131 132
7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724 7.047
133 134 135 136 137 138 139 140 141 142 143
10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724 7.047 10.958
144 145 146 147 148 149 150 151 152 153 154
14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724 7.047 10.958 14.082
155 156 157 158 159 160 161 162 163 164 165
15.894 16.756 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120
166 167 168 169 170 171 172 173 174 175 176
0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517
177 178 179 180 181 182 183 184 185 186 187
3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706
188 189 190 191 192 193 194 195 196 197 198
17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262
199 200 201 202 203 204 205 206 207 208 209
0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355
210 211 212 213 214 215 216 217 218 219 220
10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127
221 222 223 224 225 226 227 228 229 230 231
0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640
232 233 234 235 236 237 238 239 240 241 242
1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419
243 244 245 246 247 248 249 250 251 252 253
15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120
254 255 256 257 258 259 260 261 262 263 264
0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517
265 266 267 268 269 270 271 272 273 274 275
3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706
276 277 278 279 280 281 282 283 284 285 286
17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.137 0.385
287 288 289 290 291 292 293 294 295 296 297
0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121
298 299 300 301 302 303 304 305 306 307 308
8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897
309 310 311 312 313 314 315 316 317 318 319
0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932
320 321 322 323 324 325 326 327 328 329 330
2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166
331 332 333 334 335 336 337 338 339 340 341
14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137
342 343 344 345 346 347 348 349 350 351 352
0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157
353 354 355 356 357 358 359 360 361 362 363
4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418
364 365 366 367 368 369 370 371 372 373 374
16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385
375 376 377 378 379 380 381 382 383 384 385
0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121
386 387 388 389 390 391 392 393 394 395 396
8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897
397 398 399 400 401 402 403 404 405 406 407
0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932
408 409 410 411 412
2.157 4.121 8.166 14.418 16.897
attr(,"label")
[1] "Fitted values (g)"
> residuals(fm3)
1 2 3 4 5 6 7 8
NA NA NA NA NA -0.81724 -2.24772 -0.73203
9 10 11 12 13 14 15 16
0.44774 0.99485 -0.01627 -0.02870 0.05209 0.41153 -0.79366 -1.75724
17 18 19 20 21 22 23 24
-1.45772 1.07274 0.99072 -0.01227 -0.00670 -0.05891 0.34153 0.08634
25 26 27 28 29 30 31 32
-0.91724 -0.67772 3.99797 4.28854 5.05482 -0.01527 0.00130 0.11809
33 34 35 36 37 38 39 40
-0.38847 -1.48366 -2.36724 -2.13772 1.00797 -1.23396 -2.75138 -0.01927
41 42 43 44 45 46 47 48
-0.02470 0.12209 0.24153 1.04634 -1.03724 -1.04772 3.36834 -0.01427
49 50 51 52 53 54 55 56
0.03930 -0.02691 -0.17847 0.14634 -1.44724 -1.52772 -0.35203 1.48684
57 58 59 60 61 62 63 64
3.17632 -0.01827 -0.02270 0.04109 -0.25847 0.22634 -2.10724 -1.31772
65 66 67 68 69 70 71 72
1.98604 0.96822 -0.01727 -0.02470 0.01609 -0.29847 -0.71366 -1.78724
73 74 75 76 77 78 79 80
-1.14772 -1.23203 2.32021 2.92402 0.01073 0.04030 -0.02491 -0.04847
81 82 83 84 85 86 87 88
0.52634 2.19276 1.19228 2.69797 0.03104 0.51632 0.00773 0.10630
89 90 91 92 93 94 95 96
0.17109 0.07153 0.18634 0.35276 -0.88772 4.77797 1.11774 10.61402
97 98 99 100 101 102 103 104
0.01073 0.08130 0.40009 0.73153 0.16634 -0.13724 1.53228 1.58797
105 106 107 108 109 110 111 112
7.86934 4.73482 0.03373 0.05930 0.45509 0.12153 0.98634 3.66276
113 114 115 116 117 118 119 120
-1.04772 1.42797 -0.93606 5.04402 0.01873 0.03030 0.20609 0.28153
121 122 123 124 125 126 127 128
-0.26366 -0.02724 0.83228 1.74797 0.02687 0.68572 0.01873 0.09130
129 130 131 132 133 134 135 136
0.36809 0.42153 0.31634 0.57276 1.52228 3.84797 -1.47226 13.51572
137 138 139 140 141 142 143 144
0.02473 0.06830 0.07309 -0.09847 -0.21366 -0.25724 -1.00772 0.45797
145 146 147 148 149 150 151 152
3.38604 5.81675 0.00973 0.05730 0.36409 0.57153 0.21634 -2.08724
153 154 155 156 157 158 159 160
-0.03772 -0.06203 2.10024 5.61482 -0.07327 -0.12571 -0.36726 -0.53373
161 162 163 164 165 166 167 168
-1.55813 -6.30167 -4.66844 -6.72407 -0.08527 -0.14971 -0.37209 -0.46373
169 170 171 172 173 174 175 176
-1.63980 -3.69048 -5.39225 -6.03907 -0.07627 -0.11571 -0.27959 -0.74206
177 178 179 180 181 182 183 184
-1.71313 -6.67048 -4.83058 -1.09990 -0.07127 -0.16471 -0.41259 -0.68373
185 186 187 188 189 190 191 192
-2.00080 -4.43048 -5.12058 -6.21597 -0.08127 -0.14071 -0.36842 -0.85873
193 194 195 196 197 198 199 200
-0.96480 -4.93548 -5.76891 -8.23907 -0.09127 -0.16971 -0.38909 -0.97539
201 202 203 204 205 206 207 208
-2.29313 -5.58881 -9.43391 -8.54407 -0.07927 -0.11671 -0.23476 -0.75706
209 210 211 212 213 214 215 216
-1.86147 -4.17048 -4.59388 -8.24740 -0.08227 -0.13471 -0.29992 -0.52306
217 218 219 220 221 222 223 224
-1.07313 -1.91281 -6.73225 -5.49540 -0.05027 -0.05371 -0.03926 0.38461
225 226 227 228 229 230 231 232
-0.38980 -2.27548 -0.00558 2.76090 -0.05227 -0.00971 -0.05959 0.49694
233 234 235 236 237 238 239 240
-0.68147 -1.61881 -1.22058 5.51590 -0.04327 -0.03771 -0.29876 0.22294
241 242 243 244 245 246 247 248
1.16920 1.23789 4.61112 4.27460 -0.02127 -0.06371 -0.14892 -0.31206
249 250 251 252 253 254 255 256
-0.55480 -3.05548 -0.56391 0.05927 -0.05227 -0.02971 -0.20409 -0.07373
257 258 259 260 261 262 263 264
-0.09480 -2.21048 3.70112 -1.46573 -0.05727 -0.05271 0.10074 -0.24873
265 266 267 268 269 270 271 272
0.53520 -1.32681 -1.21558 1.96760 0.01273 0.04129 0.47691 0.66294
273 274 275 276 277 278 279 280
0.18187 2.74119 0.08442 -2.35240 -0.03927 -0.00671 0.12474 -0.42373
281 282 283 284 285 286 287 288
-0.30313 -2.31381 8.71842 1.79090 -0.02776 -0.00104 0.23005 0.18344
289 290 291 292 293 294 295 296
-1.25117 1.37221 -1.73490 1.73667 -0.04196 -0.04654 -0.17329 0.36344
297 298 299 300 301 302 303 304
-1.60284 -3.04945 -5.84320 -2.72333 -0.04896 0.22830 0.38338 0.86511
305 306 307 308 309 310 311 312
1.72883 -0.74945 -3.08650 -0.01333 -0.04824 0.21180 0.14338 0.91844
313 314 315 316 317 318 319 320
-0.16284 -2.13279 -3.98153 0.90664 -0.03566 -0.00954 0.99005 0.05011
321 322 323 324 325 326 327 328
0.64383 0.97388 1.42180 1.21164 -0.02720 0.09846 0.37505 1.79844
329 330 331 332 333 334 335 336
0.18383 -0.13445 1.66513 2.67664 -0.03402 0.02963 0.73171 -0.76656
337 338 339 340 341 342 343 344
-1.11950 -1.32112 1.79180 2.17664 -0.06027 -0.01304 -0.18662 0.09011
345 346 347 348 349 350 351 352
0.37383 -2.49112 1.72680 2.03504 0.01178 0.30213 0.64005 1.65677
353 354 355 356 357 358 359 360
0.69050 3.48721 2.95850 1.00004 0.01680 0.20930 0.26838 0.98844
361 362 363 364 365 366 367 368
-0.31784 -0.74945 -0.83820 3.96334 -0.01280 0.36546 0.52671 3.60177
369 370 371 372 373 374 375 376
1.87550 0.80555 2.65350 0.92004 0.04150 0.49596 0.45005 1.47178
377 378 379 380 381 382 383 384
1.07217 -2.97612 1.36180 4.64501 0.00218 0.07096 0.65171 1.89844
385 386 387 388 389 390 391 392
0.38883 -0.00445 4.29680 1.05834 0.02574 0.38880 0.04338 1.35511
393 394 395 396 397 398 399 400
0.38883 -0.38279 3.70013 -0.94999 -0.02653 0.07113 0.43838 -0.01156
401 402 403 404 405 406 407 408
1.70883 0.63721 -2.18320 0.88834 0.00904 0.17880 0.54671 0.44511
409 410 411 412
2.22216 -2.03445 1.99350 0.05004
attr(,"std")
[1] NA NA NA NA NA 2.0514 3.0228 3.7679 4.1905 4.3895
[11] 0.0575 0.1274 0.2786 0.5909 1.1714 2.0514 3.0228 4.1905 4.3895 0.0575
[21] 0.1274 0.2786 0.5909 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575
[31] 0.1274 0.2786 0.5909 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575
[41] 0.1274 0.2786 0.5909 1.1714 2.0514 3.0228 4.1905 0.0575 0.1274 0.2786
[51] 0.5909 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786
[61] 0.5909 1.1714 2.0514 3.0228 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[71] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[81] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[91] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[101] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[111] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[121] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[131] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[141] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909
[151] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1137 0.2495 0.5324
[161] 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919
[171] 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749
[181] 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137
[191] 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324
[201] 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919
[211] 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749
[221] 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137
[231] 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324
[241] 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919
[251] 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749
[261] 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137
[271] 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324
[281] 1.0689 2.8919 4.1469 4.4749 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348
[291] 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219
[301] 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596
[311] 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251
[321] 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348
[331] 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219
[341] 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596
[351] 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251
[361] 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348
[371] 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219
[381] 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596
[391] 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251
[401] 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348
[411] 3.8468 4.4219
attr(,"label")
[1] "Residuals (g)"
> summary(fm3)
Generalized nonlinear least squares fit
Model: weight ~ SSlogis(Time, Asym, xmid, scal)
Data: Soybean
AIC BIC logLik
987 1007 -489
Variance function:
Structure: Power of variance covariate
Formula: ~fitted(.)
Parameter estimates:
power
0.878
Coefficients:
Value Std.Error t-value p-value
Asym 17.4 0.525 33.1 0
xmid 51.9 0.598 86.8 0
scal 7.6 0.142 54.0 0
Correlation:
Asym xmid
xmid 0.788
scal 0.488 0.842
Standardized residuals:
Min Q1 Med Q3 Max
-2.3066 -0.6545 -0.0019 0.5012 4.9676
Residual standard error: 0.369
Degrees of freedom: 407 total; 404 residual
>
> options(op)# revert when this file is source()d
>
> proc.time()
user system elapsed
0.461 0.085 0.549