0

Doğrusal olmayan karma efektler modelim, age numaralı telefondan vücut kitlesini (bm) geri yükler. brood'un year içinde yuvalandığını düşünmek isterim, ancak bir kuluçkahane sadece veri kümesindeki yedi yıldan birinde gerçekleşebileceğinden, year ve brood rastgele etkilerinin çaprazlanması gerekir. (2000)nlme'de diğerinde iç içe geçmiş iki rastgele etki nasıl alınır?

Pinheiro olarak

& Bates: (http://link.springer.com/book/10.1007%2Fb98882) 'S ve S-artı karma etkileri Modelleri' çapraz rastgele etkileri olan bir örnek vardır: bir hücre kültürü biyotahlilin bir tam faktöriyel bir model temsil etmek için kullanılır Sabit etkiler ve üç rastgele etki, blok, satır ve sütun etkilerini hesaba katmak için kullanılır, son iki rastgele etki bloğun içine yerleştirilir, ancak birbiriyle çaprazlanır.

options(contrasts = c("contr.treatment", "contr.poly")) 
fm1Assay <- lme(logDens ~ sample * dilut, Assay, 
random = pdBlocked(list(pdIdent(~ 1), pdIdent(~ sample - 1), pdIdent(~ dilut - 1)))) 

bu örnek, bir karışık doğrusal model, sözdizimini doğrusal olmayan karma modeller için de çalışır: - Bu ve arkasından (. 165 s 163) uygulanmaktadır. (

fmbm1 <- nlme(bm ~ SSlogis(age, Asym, xmid, scal), data = bmgrp, 
      fixed = Asym + xmid + scal ~ 1, 
      random = pdBlocked(list(pdIdent(Asym + xmid + scal ~ 1), 
           pdIdent(Asym + xmid + scal ~ brood - 1))), 
      start = startvalues, na.action = na.omit) 

Ama bu sözdizimi o R donma yapar gibi yanlış gibi görünüyor: Bu nedenle, (iç içe etkiler ortak değişken sonra -1 olması gerekir neden Ancak bilmiyorum) benim modeli için aşağıdaki çalıştı Bir hata mesajı bile yok, R sadece R yanıtı bırakmaya zorlamak için artık cevap vermiyor. nlme'da iç içe geçmiş ve çapraz yapının nasıl gerçekleştirileceğine dair ipuçları konusunda mutlu olurum. internette

> str(bmgrp) 
Classes ‘nfnGroupedData’, ‘nfGroupedData’, ‘groupedData’ and 'data.frame': 428 obs. of 7 variables: 
$ pop  : Factor w/ 2 levels "NL","RUS": 1 2 2 2 2 2 1 2 2 2 ... 
$ year : Ord.factor w/ 7 levels "2013"<"2012"<..: 5 1 1 7 1 1 2 1 1 1 ... 
$ sex  : Factor w/ 2 levels "f","m": 2 1 1 2 1 2 1 2 1 2 ... 
$ age  : int 0 0 7 8 10 10 10 12 12 12 ... 
$ bm  : int 80 85 137 165 225 227 132 215 183 195 ... 
$ relhatch: num 4.06 4.22 4.22 4.29 1.22 ... 
$ brood : Factor w/ 270 levels "","NL2004N1040054",..: 61 189 189 205 190 190 27 187 187 187 ... 

bmdata <- read.table(header = TRUE, stringsAsFactors = TRUE, text = " 
ID pop year sex age bm  relhatch   brood 
1 NL 2015 m 0 80 4.06293706  NL2015E278 
2 RUS 2013 f 0 85 4.22000000  RUS2013N350 
7 RUS 2013 f 7 137 4.21888412  RUS2013N350 
9 RUS 2014 m 8 165 4.28608247 RUS2014N1372 
11 RUS 2013 f 10 225 1.21888412  RUS2013N396 
12 RUS 2013 m 10 227 1.21888412  RUS2013N396 
13 NL 2012 f 10 132 0.86649874  NL2012E262 
17 RUS 2013 m 12 215 -0.78111588  RUS2013N120 
18 RUS 2013 f 12 183 -0.78111588  RUS2013N120 
19 RUS 2013 m 12 195 -0.78111588  RUS2013N120 
21 RUS 2014 m 13 325 -0.71391753  RUS2014N235 
22 RUS 2014 m 13 280 -0.71391753  RUS2014N235 
27 RUS 2013 m 16 498 -4.78111588  RUS2013N60 
28 RUS 2005 m 17 870 3.20000000 RUS2005N1030701 
29 NL 2012 m 18 324 -11.13350126  NL2012E45 
32 RUS 2003 f 19 880 1.20000000 RUS2003N1030266 
33 RUS 2005 f 19 750 6.10000000 RUS2005N1051002 
35 RUS 2004 f 20 670 3.20000000 RUS2004N1030477 
36 RUS 2004 m 20 790 3.20000000 RUS2004N1030491 
37 RUS 2004 m 20 940 3.20000000 RUS2004N1030476 
39 RUS 2004 f 20 900 3.20000000 RUS2004N1030521 
40 RUS 2004 f 20 740 3.20000000 RUS2004N1030473 
41 RUS 2003 m 21 980 -0.80000000 RUS2003N1030429 
42 NL 2012 f 21 260 -2.13350126  NL2012Wun23 
44 RUS 2014 m 21 620 -3.71391753  RUS2014N248 
45 RUS 2003 m 21 1080 -0.80000000 RUS2003N1030045 
46 NL 2012 m 21 237 -0.13350126  NL2012E265 
47 RUS 2004 m 21 572 2.80000000 RUS2004N1040648 
48 RUS 2004 m 21 940 3.20000000 RUS2004N1030482 
49 RUS 2004 m 21 450 4.20000000 RUS2004N1030645 
53 RUS 2014 f 22 660 -0.71391753  RUS2014N866 
54 RUS 2003 f 22 890 -1.80000000 RUS2003N1030415 
55 RUS 2005 f 22 684 0.80000000 RUS2005N1040060 
56 RUS 2005 f 22 652 0.80000000 RUS2005N1040060 
57 RUS 2003 f 22 776 -1.80000000 RUS2003N1030418 
58 RUS 2004 m 22 672 1.80000000 RUS2004N1042138 
59 RUS 2004 f 22 622 1.80000000 RUS2004N1042138 
61 RUS 2004 m 22 472 3.30000000 RUS2004N1042092 
62 RUS 2004 f 22 438 3.30000000 RUS2004N1042092 
63 NL 2012 m 22 222 7.86649874  NL2012W213 
64 RUS 2003 m 22 1410 -1.80000000 RUS2003N1030417 
65 RUS 2003 f 22 1010 -1.80000000 RUS2003N1030089 
66 RUS 2004 f 22 612 1.20000000 RUS2004N1030470 
67 RUS 2004 m 22 598 1.80000000 RUS2004N1042139 
68 RUS 2004 f 22 316 1.30000000 RUS2004N1042114 
69 RUS 2004 m 22 420 3.20000000 RUS2004N1030474 
70 RUS 2004 m 22 370 3.30000000 RUS2004N1042095 
76 RUS 2004 f 23 1080 0.20000000 RUS2004N1030467 
77 RUS 2003 f 23 854 -2.80000000 RUS2003N1030196 
78 RUS 2003 f 23 897 -1.80000000 RUS2003N1030402 
79 RUS 2003 m 23 1210 -1.80000000 RUS2003N1030416 
80 RUS 2003 f 23 1180 -1.80000000 RUS2003N1030416 
81 RUS 2004 m 23 990 0.20000000 RUS2004N1030446 
82 RUS 2004 f 23 990 0.20000000 RUS2004N1030446 
83 RUS 2004 f 23 1110 0.20000000 RUS2004N1030461 
84 RUS 2014 m 23 710 -5.71391753  RUS2014N160 
85 RUS 2014 f 23 695 -1.71391753  RUS2014N600 
86 RUS 2003 m 23 1230 -1.80000000 RUS2003N1030404 
87 RUS 2004 m 23 870 0.20000000 RUS2004N1030465 
88 RUS 2004 f 23 500 0.80000000 RUS2004N1040578 
89 RUS 2004 m 23 598 0.80000000 RUS2004N1040288 
90 RUS 2004 f 23 480 2.80000000 RUS2004N1040685 
91 RUS 2004 m 23 444 2.80000000 RUS2004N1040688 
92 RUS 2005 f 23 820 -0.80000000 RUS2005N1030706 
99 RUS 2004 m 24 1120 -0.80000000 RUS2004N1030467 
100 RUS 2004 m 24 612 -0.20000000 RUS2004N1040474 
101 RUS 2004 m 24 642 -0.20000000 RUS2004N1040474 
102 RUS 2004 m 24 634 -0.20000000 RUS2004N1040474 
103 RUS 2014 f 24 740 2.28608247  RUS2014N49 
104 RUS 2014 f 24 840 2.28608247  RUS2014N49 
105 RUS 2014 m 24 900 2.28608247  RUS2014N49 
106 RUS 2005 m 24 972 0.80000000 RUS2005N1040106 
107 RUS 2005 f 24 820 0.80000000 RUS2005N1040106 
108 RUS 2005 f 24 910 0.80000000 RUS2005N1040106 
109 RUS 2014 m 24 980 2.28608247  RUS2014N759 
110 RUS 2014 f 24 775 2.28608247  RUS2014N759 
111 RUS 2004 f 24 870 0.20000000 RUS2004N1030457 
112 RUS 2004 f 24 516 0.80000000 RUS2004N1040528 
113 RUS 2004 f 24 672 1.80000000 RUS2004N1040828 
114 RUS 2004 f 24 604 1.80000000 RUS2004N1040828 
115 RUS 2004 m 24 790 3.20000000 RUS2004N1030491 
116 RUS 2004 m 24 940 3.20000000 RUS2004N1030487 
117 RUS 2004 m 24 1040 3.20000000 RUS2004N1030487 
118 NL 2015 m 24 300 4.06293706  NL2015E278 
119 NL 2012 m 24 258 -8.13350126  NL2012Eun7 
120 NL 2012 f 24 190 3.86649874  NL2012E239 
121 RUS 2014 m 24 1085 2.28608247  RUS2014N858 
122 RUS 2003 m 24 1100 1.20000000 RUS2003N1030333 
123 RUS 2004 m 24 610 -0.70000000 RUS2004N1040622 
124 RUS 2004 m 24 674 -0.20000000 RUS2004N1040444 
125 RUS 2004 m 24 772 -0.20000000 RUS2004N1040285 
126 RUS 2004 m 24 760 -0.20000000 RUS2004N1040571 
127 RUS 2005 m 24 1060 0.80000000 RUS2005N1040118 
139 RUS 2014 f 25 860 4.28608247  RUS2014N766 
140 RUS 2014 m 25 1040 4.28608247  RUS2014N766 
142 NL 2015 f 25 490 -0.93706294  NL2015W224 
143 RUS 2014 m 25 1002 1.28608247  RUS2014NT1 
144 RUS 2014 f 25 880 1.28608247  RUS2014N812 
145 RUS 2014 m 25 955 1.28608247  RUS2014N111 
146 RUS 2014 m 25 985 1.28608247  RUS2014N111 
147 RUS 2003 f 25 980 -0.80000000 RUS2003N1030045 
148 RUS 2004 f 25 1070 0.20000000 RUS2004N1030466 
149 RUS 2004 m 25 1050 0.20000000 RUS2004N1030439 
150 RUS 2004 f 25 940 0.20000000 RUS2004N1030439 
151 RUS 2004 f 25 900 0.20000000 RUS2004N1030461 
152 RUS 2014 m 25 985 1.28608247  RUS2014N602 
153 RUS 2004 m 25 560 -1.20000000 RUS2004N1040503 
154 RUS 2004 f 25 680 0.20000000 RUS2004N1030437 
155 RUS 2004 f 25 910 0.20000000 RUS2004N1030451 
156 RUS 2004 m 25 484 0.80000000 RUS2004N1040541 
158 RUS 2014 f 26 985 0.28608247  RUS2014N61 
159 RUS 2014 f 26 882 0.28608247  RUS2014N61 
160 RUS 2004 m 26 626 -0.20000000 RUS2004N1040474 
161 RUS 2003 f 26 900 -0.80000000 RUS2003N1030429 
162 RUS 2004 m 26 810 3.20000000 RUS2004N1030476 
163 RUS 2014 f 26 860 0.28608247  RUS2014N706 
164 RUS 2014 f 26 945 2.28608247  RUS2014N963 
165 NL 2004 f 26 480 23.00000000 NL2004N1040293 
166 RUS 2004 f 26 720 -0.70000000 RUS2004N1040832 
167 RUS 2004 m 26 658 1.30000000 RUS2004N1042086 
168 RUS 2004 f 26 634 1.80000000 RUS2004N1042149 
171 RUS 2004 f 27 1300 -1.80000000 RUS2004N1030455 
172 RUS 2014 f 27 800 -0.71391753  RUS2014N619 
173 RUS 2014 m 27 1020 -0.71391753  RUS2014N411 
174 RUS 2014 m 27 1040 -0.71391753  RUS2014N411 
175 RUS 2014 f 27 980 3.28608247 RUS2014N1119 
176 RUS 2014 m 27 990 3.28608247 RUS2014N1119 
177 RUS 2014 m 27 925 3.28608247 RUS2014N1119 
178 RUS 2003 f 27 762 -1.80000000 RUS2003N1030400 
179 RUS 2003 f 27 880 -1.80000000 RUS2003N1030415 
180 RUS 2003 f 27 1020 -1.80000000 RUS2003N1030406 
181 RUS 2003 f 27 950 -1.80000000 RUS2003N1030406 
182 RUS 2003 m 27 1060 -1.80000000 RUS2003N1030406 
183 RUS 2003 m 27 772 0.20000000 RUS2003N1030400 
184 NL 2015 m 27 525 1.06293706  NL2015E222 
185 RUS 2014 f 27 830 2.28608247  RUS2014N769 
186 RUS 2014 f 27 940 2.28608247  RUS2014N769 
187 RUS 2003 m 27 976 -1.80000000 RUS2003N1030402 
188 RUS 2003 f 27 1050 -1.80000000 RUS2003N1030413 
189 RUS 2003 m 27 1090 -1.80000000 RUS2003N1030414 
190 RUS 2003 f 27 1140 -1.80000000 RUS2003N1030413 
191 RUS 2003 f 27 1080 -1.80000000 RUS2003N1030414 
192 RUS 2004 f 27 630 3.20000000 RUS2004N1030475 
193 NL 2012 m 27 290 0.86649874  NL2012W103 
194 RUS 2014 m 27 1100 -0.71391753  RUS2014N519 
195 RUS 2014 m 27 985 -0.71391753  RUS2014N629 
196 RUS 2014 m 27 925 1.28608247  RUS2014N533 
197 RUS 2014 f 27 950 2.28608247  RUS2014N452 
198 RUS 2003 f 27 1060 -1.80000000 RUS2003N1030411 
199 RUS 2005 f 27 990 3.10000000 RUS2005N1050621 
204 NL 2012 f 28 237 -0.13350126  NL2012E262 
206 RUS 2014 m 28 1085 -1.71391753  RUS2014N321 
207 RUS 2014 m 28 1220 -1.71391753  RUS2014N321 
208 RUS 2014 m 28 1010 -1.71391753  RUS2014N321 
209 RUS 2014 f 28 1005 2.28608247  RUS2014N554 
210 RUS 2014 m 28 1040 2.28608247  RUS2014N554 
211 RUS 2014 f 28 1005 2.28608247  RUS2014N554 
212 RUS 2003 f 28 960 -0.80000000 RUS2003N1030429 
213 RUS 2003 m 28 1330 -0.80000000 RUS2003N1030100 
214 RUS 2003 f 28 1140 -0.80000000 RUS2003N1030100 
215 RUS 2003 m 28 1340 -0.80000000 RUS2003N1030100 
216 RUS 2004 m 28 586 -2.20000000 RUS2004N1040279 
217 RUS 2005 m 28 894 0.80000000 RUS2005N1040060 
218 RUS 2014 m 28 980 -1.71391753  RUS2014N631 
219 RUS 2014 f 28 790 1.28608247  RUS2014NT1 
220 RUS 2003 f 28 902 -2.80000000 RUS2003N1030196 
221 RUS 2004 f 28 744 -3.20000000 RUS2004N1040600 
222 RUS 2005 m 28 576 0.80000000 RUS2005N1040130 
223 RUS 2005 f 28 517 0.80000000 RUS2005N1040130 
224 RUS 2014 f 28 855 2.28608247 RUS2014N1171 
225 RUS 2003 f 28 740 -0.80000000 RUS2003N1030090 
226 RUS 2004 m 28 792 -2.20000000 RUS2004N1040381 
227 RUS 2005 m 28 1034 0.80000000 RUS2005N1040265 
231 NL 2015 f 29 430 -0.93706294  NL2015W228 
232 NL 2015 f 29 425 -0.93706294  NL2015W228 
233 RUS 2014 m 29 843 -2.71391753  RUS2014N418 
234 RUS 2014 f 29 1020 -2.71391753  RUS2014N418 
235 RUS 2014 m 29 1100 -4.71391753  RUS2014N123 
236 RUS 2014 f 29 1100 -4.71391753  RUS2014N123 
237 RUS 2014 m 29 1000 -2.71391753  RUS2014N113 
238 RUS 2014 m 29 1160 -2.71391753  RUS2014N113 
239 RUS 2014 f 29 1000 -2.71391753  RUS2014N113 
240 RUS 2014 f 29 1055 -2.71391753  RUS2014N286 
241 RUS 2014 f 29 1100 -2.71391753  RUS2014N286 
242 RUS 2014 f 29 1125 -0.71391753  RUS2014NT7 
243 RUS 2014 f 29 985 -0.71391753  RUS2014N284 
244 RUS 2004 f 29 612 0.80000000 RUS2004N1040528 
245 RUS 2005 m 29 624 -0.20000000 RUS2005N1040150 
246 RUS 2005 f 29 510 -0.20000000 RUS2005N1040150 
247 RUS 2005 m 29 1000 -0.20000000 RUS2005N1040151 
248 RUS 2005 f 29 902 -0.20000000 RUS2005N1040151 
249 RUS 2014 f 29 1115 -2.71391753  RUS2014N672 
250 RUS 2014 f 29 1245 -0.71391753  RUS2014N616 
251 RUS 2014 m 29 1325 -0.71391753  RUS2014N239 
252 RUS 2004 f 29 860 3.20000000 RUS2004N1030484 
253 RUS 2005 m 29 708 -0.70000000 RUS2005N1040163 
254 RUS 2005 m 29 618 -0.20000000 RUS2005N1040082 
255 RUS 2005 f 29 910 -0.20000000 RUS2005N1040137 
264 RUS 2014 m 30 1170 0.28608247  RUS2014N61 
265 RUS 2004 f 30 1090 0.20000000 RUS2004N1030467 
266 RUS 2014 f 30 1030 -0.71391753  RUS2014N866 
267 RUS 2014 m 30 1025 -0.71391753  RUS2014N619 
268 RUS 2014 m 30 1120 7.28608247 RUS2014N1016 
269 RUS 2014 f 30 1000 7.28608247 RUS2014N1016 
270 RUS 2014 f 30 890 7.28608247 RUS2014N1016 
271 RUS 2004 m 30 954 -2.20000000 RUS2004N1040606 
272 RUS 2004 f 30 965 -2.20000000 RUS2004N1040606 
273 RUS 2004 m 30 948 -2.20000000 RUS2004N1040606 
274 RUS 2005 m 30 1238 -1.20000000 RUS2005N1040217 
275 RUS 2005 m 30 1260 -1.20000000 RUS2005N1040217 
276 RUS 2005 f 30 1146 -1.20000000 RUS2005N1040217 
277 RUS 2014 m 30 1182 -3.71391753  RUS2014N112 
279 RUS 2014 m 30 1260 -3.71391753  RUS2014N112 
281 RUS 2014 f 30 1200 -3.71391753  RUS2014N364 
282 RUS 2014 m 30 1110 -0.71391753  RUS2014N221 
283 RUS 2014 m 30 1235 -0.71391753  RUS2014N221 
284 RUS 2004 m 30 880 0.20000000 RUS2004N1030442 
285 RUS 2004 f 30 720 0.20000000 RUS2004N1030442 
286 RUS 2014 m 30 1022 -3.71391753  RUS2014N238 
287 RUS 2014 m 30 1120 -3.71391753  RUS2014N270 
288 RUS 2014 m 30 1175 -3.71391753  RUS2014N647 
289 RUS 2014 f 30 1100 -3.71391753  RUS2014N288 
290 RUS 2014 f 30 980 1.28608247 RUS2014N1032 
291 RUS 2004 f 30 840 0.20000000 RUS2004N1030449 
292 RUS 2005 m 30 1080 -1.40000000 RUS2005N1050085 
294 NL 2012 f 31 430 -3.13350126  NL2012W27 
295 NL 2012 m 31 405 -3.13350126  NL2012W27 
296 NL 2015 m 31 810 -2.93706294  NL2015E149 
297 NL 2015 m 31 740 -2.93706294  NL2015E149 
298 RUS 2014 f 31 1140 -0.71391753  RUS2014N914 
299 RUS 2014 m 31 1255 -0.71391753  RUS2014N914 
300 RUS 2014 f 31 1225 -0.71391753  RUS2014N914 
301 RUS 2014 m 31 1020 -0.71391753  RUS2014N411 
302 RUS 2014 m 31 1255 2.28608247  RUS2014N698 
303 RUS 2014 m 31 1235 2.28608247  RUS2014N698 
304 RUS 2014 m 31 1120 2.28608247  RUS2014N698 
305 RUS 2004 m 31 1204 -0.70000000 RUS2004N1040833 
306 RUS 2004 f 31 1024 -0.70000000 RUS2004N1040833 
307 RUS 2004 m 31 790 3.20000000 RUS2004N1030475 
308 RUS 2004 m 31 824 1.30000000 RUS2004N1042120 
309 RUS 2004 f 31 704 1.30000000 RUS2004N1042142 
318 NL 2012 f 32 418 -4.13350126  NL2012W70 
319 NL 2012 m 32 410 -4.13350126  NL2012W70 
320 RUS 2004 m 32 1340 -1.80000000 RUS2004N1030455 
321 RUS 2005 f 32 1140 2.10000000 RUS2005N1050173 
322 RUS 2005 m 32 1330 2.10000000 RUS2005N1050173 
323 RUS 2005 m 32 1300 2.10000000 RUS2005N1050173 
324 RUS 2005 m 32 1210 2.10000000 RUS2005N1050173 
325 RUS 2005 f 32 1070 2.10000000 RUS2005N1050173 
326 NL 2015 m 32 810 -3.93706294  NL2015W40 
327 NL 2012 m 32 408 -4.13350126  NL2012E25 
328 NL 2012 f 32 282 -4.13350126  NL2012E25 
330 RUS 2005 f 32 1050 2.10000000 RUS2005N1050505 
331 RUS 2005 f 32 1050 2.10000000 RUS2005N1050505 
332 RUS 2005 f 32 930 2.10000000 RUS2005N1050505 
333 RUS 2014 f 32 1125 -3.71391753  RUS2014N91 
334 RUS 2014 m 32 1402 -3.71391753  RUS2014N91 
335 RUS 2014 f 32 1085 -1.71391753  RUS2014N631 
336 RUS 2003 f 32 1140 -0.80000000 RUS2003N1030424 
337 RUS 2003 m 32 1100 -0.80000000 RUS2003N1030424 
338 RUS 2004 m 32 1010 0.20000000 RUS2004N1030457 
339 RUS 2005 m 32 1008 -3.20000000 RUS2005N1040180 
340 RUS 2005 f 32 830 -3.20000000 RUS2005N1040180 
342 RUS 2014 f 32 1140 -5.71391753  RUS2014N117 
343 NL 2004 f 32 530 17.50000000 NL2004N1041011 
344 RUS 2004 f 32 640 0.20000000 RUS2004N1030459 
348 RUS 2014 m 33 1265 -3.71391753  RUS2014N293 
349 RUS 2014 m 33 1190 -3.71391753  RUS2014N293 
350 RUS 2014 m 33 1225 -3.71391753  RUS2014N293 
351 RUS 2014 f 33 1090 -3.71391753  RUS2014N293 
352 RUS 2004 m 33 1160 -0.80000000 RUS2004N1030467 
354 RUS 2003 m 33 980 -1.80000000 RUS2003N1030415 
355 RUS 2004 f 33 476 -2.20000000 RUS2004N1040279 
356 RUS 2004 m 33 554 -2.20000000 RUS2004N1040279 
357 RUS 2014 f 33 1310 4.28608247 RUS2014N1000 
358 RUS 2014 f 33 1060 4.28608247 RUS2014N1000 
359 RUS 2003 m 33 842 -1.80000000 RUS2003N1030418 
360 RUS 2005 m 33 1050 -2.90000000 RUS2005N1050580 
361 RUS 2005 m 33 1226 -2.90000000 RUS2005N1050580 
362 RUS 2014 m 33 1190 -2.71391753  RUS2014N175 
363 RUS 2014 f 33 1105 4.28608247  RUS2014N755 
364 RUS 2014 m 33 1260 4.28608247  RUS2014N801 
365 RUS 2003 f 33 850 -1.80000000 RUS2003N1030422 
367 RUS 2004 m 33 1054 -2.20000000 RUS2004N1040478 
368 RUS 2004 f 33 810 0.20000000 RUS2004N1030456 
369 RUS 2004 m 33 944 1.80000000 RUS2004N1041049 
370 RUS 2004 m 33 1102 1.30000000 RUS2004N1042127 
371 RUS 2004 f 33 1050 1.80000000 RUS2004N1040821 
372 RUS 2004 f 33 935 1.80000000 RUS2004N1042131 
373 RUS 2005 m 33 868 -4.20000000 RUS2005N1040266 
376 NL 2012 m 34 270 -6.13350126  NL2012W15 
377 NL 2012 f 34 438 -6.13350126  NL2012W15 
379 NL 2012 m 34 440 -6.13350126  NL2012Wun15 
380 NL 2012 f 34 440 -6.13350126  NL2012Wun15 
383 RUS 2014 f 34 990 -4.71391753  RUS2014N216 
384 RUS 2014 f 34 1220 -3.71391753  RUS2014N106 
385 RUS 2014 f 34 1090 -3.71391753  RUS2014N106 
386 RUS 2014 m 34 1240 -0.71391753  RUS2014NT7 
387 RUS 2014 f 34 1085 3.28608247  RUS2014N896 
388 RUS 2014 m 34 1110 3.28608247  RUS2014N896 
389 RUS 2004 m 34 1074 -1.20000000 RUS2004N1040269 
390 RUS 2004 f 34 980 -1.20000000 RUS2004N1040269 
391 RUS 2004 f 34 930 0.20000000 RUS2004N1030466 
392 RUS 2004 f 34 1042 -3.20000000 RUS2004N1040455 
393 RUS 2004 m 34 815 0.80000000 RUS2004N1040516 
399 RUS 2014 m 35 1275 -1.71391753  RUS2014N332 
400 RUS 2014 f 35 1210 -1.71391753  RUS2014N332 
401 RUS 2014 m 35 1230 -1.71391753  RUS2014N332 
402 RUS 2014 m 35 1380 2.28608247  RUS2014N733 
403 RUS 2014 m 35 1410 2.28608247  RUS2014N733 
404 RUS 2014 f 35 1270 2.28608247  RUS2014N733 
405 RUS 2014 f 35 1040 2.28608247 RUS2014N1102 
406 RUS 2014 f 35 1080 2.28608247 RUS2014N1102 
407 RUS 2005 f 35 1150 -0.90000000 RUS2005N1051024 
408 RUS 2005 m 35 1390 -0.90000000 RUS2005N1051024 
409 NL 2012 m 35 455 -7.13350126  NL2012E121 
410 RUS 2014 m 35 1250 -3.71391753  RUS2014N397 
411 NL 2005 m 35 990 1.30000000 NL2005N1050244 
412 RUS 2004 f 35 1020 -2.20000000 RUS2004N1040437 
413 RUS 2005 m 35 1200 -6.40000000 RUS2005N1050422 
418 RUS 2004 m 36 1320 -1.80000000 RUS2004N1030455 
419 RUS 2004 m 36 1270 -1.80000000 RUS2004N1030455 
420 RUS 2004 m 36 1430 -1.80000000 RUS2004N1030455 
421 NL 2012 f 36 460 -8.13350126  NL2012Wun5 
422 NL 2012 m 36 505 -8.13350126  NL2012Wun5 
424 RUS 2004 m 36 916 -3.20000000 RUS2004N1040600 
425 RUS 2014 m 36 1300 1.28608247 RUS2014N1451 
426 RUS 2005 m 36 1420 -1.40000000 RUS2005N1050054 
427 RUS 2005 f 36 1170 -1.90000000 RUS2005N1050270 
432 RUS 2013 f 37 1030 -4.78111588  RUS2013N407 
433 RUS 2013 f 37 1050 -4.78111588  RUS2013N407 
434 RUS 2013 m 37 1140 -4.78111588  RUS2013N407 
439 RUS 2014 f 37 1250 0.28608247  RUS2014N422 
440 RUS 2004 f 37 1120 -2.20000000 RUS2004N1040480 
447 RUS 2014 m 38 1615 -4.71391753  RUS2014N351 
448 RUS 2014 f 38 1430 -4.71391753  RUS2014N351 
449 RUS 2014 f 38 1225 -0.71391753  RUS2014N386 
450 RUS 2014 f 38 1315 -0.71391753  RUS2014N386 
451 NL 2015 m 38 940 -2.93706294  NL2015E117 
452 NL 2012 m 38 1090 -5.13350126  NL2012E130 
453 RUS 2014 f 38 1225 -0.71391753  RUS2014N668 
454 RUS 2014 m 38 1430 -0.71391753  RUS2014N493 
461 NL 2012 f 39 535 -11.13350126  NL2012E31 
462 NL 2012 f 39 195 -11.13350126  NL2012Wun1 
463 RUS 2014 m 39 1440 -1.71391753  RUS2014N202 
464 RUS 2014 m 39 1250 -1.71391753  RUS2014N202 
465 NL 2015 m 39 600 2.06293706  NL2015W280 
466 NL 2012 f 39 1090 16.86649874  NL2012E323 
467 RUS 2014 f 39 1325 -1.71391753  RUS2014N266 
468 NL 2004 m 39 1050 9.00000000 NL2004N1040299 
475 RUS 2014 m 40 1480 -2.71391753  RUS2014N300 
476 RUS 2014 m 40 1450 -2.71391753  RUS2014N300 
477 RUS 2014 m 40 1475 -2.71391753  RUS2014N300 
478 RUS 2014 f 40 1230 -2.71391753  RUS2014N656 
479 RUS 2014 f 40 1300 -2.71391753  RUS2014N207 
480 RUS 2014 m 40 1480 -2.71391753  RUS2014N207 
481 RUS 2014 m 40 1310 -2.71391753  RUS2014N656 
482 NL 2012 m 40 805 -8.13350126  NL2012W39 
483 RUS 2014 m 40 1428 -2.71391753  RUS2014N273 
491 RUS 2014 m 41 1110 -3.71391753  RUS2014N615 
492 NL 2004 f 41 1000 7.00000000 NL2004N1040255 
502 NL 2012 f 44 700 -6.13350126  NL2012W15 
503 NL 2005 m 44 1160 -7.20000000 NL2005N1050197 
504 NL 2005 m 44 1020 -7.20000000 NL2005N1050197 
505 NL 2005 m 44 1240 -7.20000000 NL2005N1050197 
506 NL 2005 f 44 1050 -7.20000000 NL2005N1050197 
508 NL 2012 m 45 710 -7.13350126  NL2012W9 
509 NL 2012 f 45 680 -7.13350126  NL2012W9 
510 NL 2012 m 47 1100 -2.13350126  NL2012W154 
511 NL 2015 m 47 630 -5.93706294  NL2015W202 
512 NL 2012 m 47 1130 -2.13350126  NL2012E197 
513 NL 2004 f 47 1210 1.00000000 NL2004N1040149 
514 NL 2004 f 47 1250 1.00000000 NL2004N1040157 
519 NL 2004 f 50 1320 -2.00000000 NL2004N1040129 
520 NL 2004 m 50 1380 -2.00000000 NL2004N1040129 
521 NL 2012 f 50 1060 -8.13350126  NL2012E111 
522 NL 2004 m 50 1510 -2.00000000 NL2004N1040119 
523 NL 2004 f 50 940 -1.50000000 NL2004N1040102 
524 NL 2012 m 51 625 -3.13350126  NL2012W27 
525 NL 2012 f 51 1325 -6.13350126  NL2012E28 
527 NL 2012 f 52 1220 -1.13350126  NL2012E154 
528 NL 2004 m 52 1160 -5.00000000 NL2004N1040134 
529 NL 2012 m 53 1200 -2.13350126  NL2012W154 
530 NL 2012 f 53 880 -5.13350126  NL2012Wun9 
531 NL 2012 f 53 880 -5.13350126  NL2012Wun9 
532 NL 2004 m 53 1290 -5.00000000 NL2004N1040106 
533 NL 2004 m 53 1230 -5.00000000 NL2004N1040106 
534 NL 2012 m 53 790 -5.13350126  NL2012Wun12 
535 NL 2012 m 53 1130 -2.13350126  NL2012W57 
536 NL 2012 f 53 1300 2.86649874  NL2012Wun24 
537 NL 2004 m 53 1530 -5.00000000 NL2004N1040063 
538 NL 2004 m 54 1450 -5.00000000 NL2004N1040054 
539 NL 2004 m 54 1060 -5.00000000 NL2004N1040054 
540 NL 2004 f 54 1110 -5.00000000 NL2004N1040054 
541 NL 2012 f 54 695 -6.13350126  NL2012E131 
542 NL 2012 m 54 935 -6.13350126  NL2012W115 
543 NL 2012 f 54 640 -6.13350126  NL2012E131 
544 NL 2012 f 54 830 -6.13350126  NL2012W115 
545 NL 2004 m 54 1380 -5.00000000 NL2004N1040057 
546 NL 2004 f 54 910 -5.00000000 NL2004N1041151 
550 NL 2012 m 56 1325 -11.13350126  NL2012E45 
551 NL 2012 m 56 900 -5.13350126  NL2012E32 
552 NL 2012 f 56 1225 -5.13350126  NL2012E32 
553 NL 2015 m 56 1510 0.06293706  NL2015E209 
554 NL 2012 f 56 1280 -3.13350126  NL2012W203 
555 NL 2012 f 57 1180 -4.13350126  NL2012E25 
556 NL 2015 m 57 1180 -7.93706294  NL2015Wu 
557 NL 2015 f 57 1080 -0.93706294  NL2015W348 
559 NL 2015 f 58 980 -1.93706294  NL2015E93 
560 NL 2015 f 58 1040 -1.93706294  NL2015Eu 
562 NL 2015 f 59 1040 -2.93706294  NL2015W216 
563 NL 2015 f 59 1030 -2.93706294  NL2015W216 
564 NL 2015 f 59 1140 -2.93706294  NL2015W216 
565 NL 2015 m 59 1440 -2.93706294  NL2015E66 
566 NL 2012 f 59 1360 -8.13350126  NL2012W35 
567 NL 2012 m 60 1070 -15.13350126  NL2012W49 
569 NL 2012 m 62 1400 -11.13350126  NL2012E37") 

bmgrp <- groupedData(bm ~ age | year, data = bmdata) 
options(contrasts = c("contr.sum","contr.poly")) 
contrasts(bmgrp$pop); contrasts(bmgrp$sex) 
startvalues <- c(31.228925, 75.552237, 12.708210, 9.427097) 

cevap

0

Bazı fazla arama aşağıdaki makaleye götürdü: İşte

önceki R kodu verilerim ve bunun altında yapıdır Zhou vd. (2007): Isı stresi altındaki Holsteins ( http://newprairiepress.org/cgi/viewcontent.cgi?article=1113&context=agstatconference) sirkadiyen prolaktin konsantrasyonlarının sirkadiyen paternlerini tanımlamak için doğrusal olmayan bir rastgele etki modeli kullanmak. Çapraz rasgele efektler hakkında aşağıdakileri yazıyorlar: :
Doğrusal olmayan karma modellerin hem çapraz hem de iç içe rastgele efektlerle uydurulması hala istatistikte yeni ve zorlu bir konudur. […] R'deki NLME paketi, çok katmanlı doğrusal olmayan karışık efektler için çok güçlüdür. Yuvalanmış rastgele efektlere sahip modelleri, ancak rastgele rastgele efektler içeren doğrusal olmayan karışık efektli modeller 'a uymaz (Pinheiro ve Bates, 2000). Rasbash ve Goldstein (1994) , iç içe rastgele etkilerin tamamen hiyerarşik bir formülasyonu olarak çapraz rastgele efektlerle doğrusal bir karışık modelin nasıl yerleştirileceğini göstermektedir. Zhou, Parkhurst ve arkadaşları, (2006) ( http://newprairiepress.org/agstatconference/2006/proceedings/11/) , Rasbash ve Goldstein'ın doğrusal karışık etkiler modeli fikrine dayanan çapraz rastgele etkilerle R'nin NLME'yi doğrusal olmayan karma etkiler modeline uydurmasını sağlamak için bir yöntem geliştirmiştir. Bu yöntem, rastgele çapraz ve yuvalanmış rastgele efekt seviyeleriyle doğrusal olmayan karma efekt modeline uymak için kullanılabilir. Bununla birlikte, çapraz rastgele etkiler için sadece bir korelasyon tahmin edilebilir. Doğrusal olmayan karışık efekt modelini […] uydurmak için NLME kodu Ek'te belgelenmiştir.

# Feeding Event is specified as the lowest hierarchical level grouping factor 
# (hierarchical level 1 grouping factor) 
# Specify Pig as a standard hierarchical level 2 grouping factor 
# Create a new grouping factor as the highest hierarchical level 
# (hierarchical level 3 grouping factor) with one level spanning the entire data set 
newGF <- factor(rep(1,length(heat$Y))) 
# Specify that each level of Period has a coefficient random at newGF 
# “ -1” indicates that the specific term factor(Period) does not have an intercept 
# It is not possible to estimate the correlation associated with Period. 

full.nlme <- 
nlme(model = Y ~ Y0 + KG * (exp(-KD * X) - exp(-KG * X))/(KG - KD), 
fixed = Y0 + KG + KD ~ factor(Trt), 
random = list(newGF = pdIdent(Y0 ~ factor(Period) -1), 
newGF = pdIdent(KG ~ factor(Period) -1), 
newGF = pdIdent(KD ~ factor(Period) -1), 
Pig = pdDiag(Y0 + KG + KD ~ 1), 
Event = pdDiag(Y0 + KG + KD ~ 1)), 
start = c(39, 0, 0, 60, 0, 0, 20, 0, 0), data = heat) 

Bu sözdizimini durumuma uyguladım - ve işe yaradı! İşte burada:

fmbm1 <- nlme(bm ~ SSlogis(age, Asym, xmid, scal), data = bmgrp, 
      fixed = Asym + xmid + scal ~ 1, 
      random = list(dummy = pdIdent(Asym ~ factor(year) - 1), 
          dummy = pdIdent(xmid ~ factor(year) - 1), 
          dummy = pdIdent(scal ~ factor(year) - 1), 
          brood = pdDiag(Asym + xmid + scal ~ 1)), 
      start = coef(fmbml), na.action = na.omit) 

> summary(fmbm1) 
Nonlinear mixed-effects model fit by maximum likelihood 
    Model: bm ~ SSlogis(age, Asym, xmid, scal) 
Data: bmgrp 
     AIC  BIC logLik 
    5505.905 5546.235 -2742.952 

Random effects: 
Formula: Asym ~ factor(year) - 1 | dummy 
Structure: Multiple of an Identity 
     Asym.factor(year)2013 Asym.factor(year)2012 Asym.factor(year)2003 Asym.factor(year)2005 Asym.factor(year)2015 Asym.factor(year)2004 
StdDev:   0.004011662   0.004011662   0.004011662   0.004011662   0.004011662   0.004011662 
     Asym.factor(year)2014 
StdDev:   0.004011662 

Formula: xmid ~ factor(year) - 1 | dummy %in% dummy 
Structure: Multiple of an Identity 
     xmid.factor(year)2013 xmid.factor(year)2012 xmid.factor(year)2003 xmid.factor(year)2005 xmid.factor(year)2015 xmid.factor(year)2004 
StdDev:    8.630687    8.630687    8.630687    8.630687    8.630687    8.630687 
     xmid.factor(year)2014 
StdDev:    8.630687 

Formula: scal ~ factor(year) - 1 | dummy %in% dummy %in% dummy 
Structure: Multiple of an Identity 
     scal.factor(year)2013 scal.factor(year)2012 scal.factor(year)2003 scal.factor(year)2005 scal.factor(year)2015 scal.factor(year)2004 
StdDev:    1.890416    1.890416    1.890416    1.890416    1.890416    1.890416 
     scal.factor(year)2014 
StdDev:    1.890416 

Formula: list(Asym ~ 1, xmid ~ 1, scal ~ 1) 
Level: brood %in% dummy %in% dummy %in% dummy 
Structure: Diagonal 
       Asym  xmid  scal Residual 
StdDev: 2.176433e-05 5.079293 0.001926683 99.83194 

Fixed effects: Asym + xmid + scal ~ 1 
        Value Std.Error DF t-value p-value 
Asym.(Intercept) 1721.7518 123.05426 153 13.991810  0 
xmid.(Intercept) 32.1919 3.83007 153 8.405047  0 
scal.(Intercept) 11.5256 1.36451 153 8.446679  0 
Correlation: 
       As.(I) xm.(I) 
xmid.(Intercept) 0.495   
scal.(Intercept) 0.734 0.369 

Standardized Within-Group Residuals: 
     Min   Q1   Med   Q3   Max 
-2.20621393 -0.43418898 0.01076569 0.40318446 2.34353430 

Number of Observations: 417 
Number of Groups: 
            dummy       dummy.1 %in% dummy   dummy.2 %in% dummy.1 %in% dummy 
             1           1           1 
brood %in% dummy.2 %in% dummy.1 %in% dummy 
             262 
>