<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Courier New" size=2>Dear R-list members,</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Some months ago I wrote a message on the
usage of gnls (nlme library) and here I come again.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Let me give an example:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>I have a 10 year length-at-age data set of
10 fishes (see growth.dat at the end of this message) and I want to fit a von
Bertalanffy growth model, Li= Linf*(1-exp(-k*(ti-t0))) where Li =
length at age i, Linf= asymptotic length, k= curvature parameter, ti= age i, and
t0= age of length 0.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>I'd solved the problem using nls but the
points are not independent. The length-at-age data are correlated for each fish
because I'm following the growth history of each specimen.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Trying to use gnls I wrote to R-list
and to Mr. Jose Pinheiro who kindly advised me on this matter. The problem
was that using S-Plus he could fit the model and I, using R with the same
commands, got an error message:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><FONT color=#ff0000>> growth.gnls <-
gnls(lt ~ Linf*(1-exp(-K*(age-t0))),<BR>+ data=growth.dat, params= Linf +K + t0
~ 1, start=list(Linf=500,K=0.2,t0=0),<BR>+ control = list(returnObject = T),
corr = corAR1(form=~fish|age))</FONT><BR></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" color=#000080 size=2>Error in
"[<-.factor"(*tmp*, , value = grpShrunk[revOrderShrunk]) :
<BR> Argument "i" is missing, with no
default<BR></FONT></DIV>
<DIV><FONT face="Courier New" size=2>If I use nls function I can estimate the
parameters:</DIV></FONT>
<DIV><FONT face="Courier New" color=#000080 size=2> </DIV></FONT>
<DIV><FONT face="Courier New" color=#ff0000 size=2>> growth.nls <- nls(lt
~ Linf*(1-exp(-K*(age-t0))),<BR>+ data=growth.dat,
start=list(Linf=500,K=0.2,t0=0))<BR></FONT></DIV>
<DIV><FONT face="Courier New" color=#ff0000 size=2>>
summary(growth.nls)</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" color=#000080 size=2>Formula: lt ~ Linf * (1 -
exp(-K * (age - t0)))</FONT></DIV>
<DIV><FONT face="Courier New" color=#000080 size=2></FONT> </DIV>
<DIV><FONT face="Courier New" color=#000080
size=2>Parameters:<BR> Estimate Std. Error t value
Pr(>|t|) <BR>Linf 509.72841 7.93394
64.247 < 2e-16 ***<BR>K
0.19888 0.00764 26.031 < 2e-16
***<BR>t0 0.29873 0.04462
6.696 1.4e-09 ***<BR>---<BR>Signif. codes: 0 `***' 0.001 `**' 0.01
`*' 0.05 `.' 0.1 ` ' 1 </FONT></DIV>
<DIV><FONT face="Courier New" color=#000080 size=2></FONT> </DIV>
<DIV><FONT face="Courier New" color=#000080 size=2>Residual standard error:
10.32 on 97 degrees of freedom</FONT></DIV>
<DIV><FONT face="Courier New" color=#000080 size=2></FONT> </DIV>
<DIV><FONT face="Courier New" color=#000080 size=2>Correlation of Parameter
Estimates:<BR> Linf
K<BR>K -0.9631 <BR>t0 -0.6472
0.7827<BR></FONT></DIV>
<DIV><FONT face="Courier New" size=2>Well, I would be grateful to receive any
help.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Best regards,</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Antonio Olinto</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Fisheries Institute</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Sao Paulo - BRASIL</FONT></DIV>
<DIV><FONT face="Courier New" color=#000080 size=2></FONT> </DIV>
<DIV><FONT face="Courier New" color=#000080 size=2>-------------</FONT></DIV>
<DIV><FONT face="Courier New" color=#ff0000 size=2></FONT> </DIV>
<DIV><FONT face="Courier New" color=#ff0000 size=2>> growth.dat</FONT></DIV>
<DIV><FONT face="Courier New" color=#000080 size=2></FONT> </DIV>
<DIV><FONT face="Courier New" color=#000080 size=2> fish
age lt<BR>1 1
1 65.3<BR>2 1 2
144.1<BR>3 1 3
208.6<BR>4 1 4
261.4<BR>5 1 5
304.7<BR>6 1 6
340.1<BR>7 1 7
369.1<BR>8 1 8
392.8<BR>9 1 9
412.2<BR>10 1 10
428.1<BR>11 2 1
68.5<BR>12 2 2
149.8<BR>13 2 3
215.0<BR>14 2 4
267.3<BR>15 2 5
309.3<BR>16 2 6
343.0<BR>17 2 7
370.1<BR>18 2 8
391.8<BR>19 2 9
409.2<BR>20 2 10
423.2<BR>21 3 1
60.4<BR>22 3 2
134.4<BR>23 3 3
196.3<BR>24 3 4
248.0<BR>25 3 5
291.1<BR>26 3 6
327.2<BR>27 3 7
357.3<BR>28 3 8
382.5<BR>29 3 9
403.5<BR>30 3 10
421.0<BR>31 4 1
64.1<BR>32 4 2
142.2<BR>33 4 3
206.7<BR>34 4 4
260.0<BR>35 4 5
304.1<BR>36 4 6
340.6<BR>37 4 7
370.8<BR>38 4 8
395.8<BR>39 4 9
416.4<BR>40 4 10
433.5<BR>41 5 1
71.4<BR>42 5 2
156.0<BR>43 5 3
223.9<BR>44 5 4
278.5<BR>45 5 5
322.2<BR>46 5 6
357.3<BR>47 5 7
385.5<BR>48 5 8
408.1<BR>49 5 9
426.3<BR>50 5 10
440.8<BR>51 6 1
66.6<BR>52 6 2
147.0<BR>53 6 3
212.8<BR>54 6 4
266.7<BR>55 6 5
310.8<BR>56 6 6
346.9<BR>57 6 7
376.5<BR>58 6 8
400.7<BR>59 6 9
420.5<BR>60 6 10
436.7<BR>61 7 1
64.5<BR>62 7 2
143.0<BR>63 7 3
207.9<BR>64 7 4
261.5<BR>65 7 5
305.9<BR>66 7 6
342.6<BR>67 7 7
373.0<BR>68 7 8
398.1<BR>69 7 9
418.8<BR>70 7 10
436.0<BR>71 8 1
66.0<BR>72 8 2
146.3<BR>73 8 3
212.7<BR>74 8 4
267.6<BR>75 8 5
313.0<BR>76 8 6
350.6<BR>77 8 7
381.6<BR>78 8 8
407.3<BR>79 8 9
428.5<BR>80 8 10
446.1<BR>81 9 1
74.2<BR>82 9 2
162.3<BR>83 9 3
232.9<BR>84 9 4
289.6<BR>85 9 5
335.1<BR>86 9 6
371.6<BR>87 9 7
400.9<BR>88 9 8
424.4<BR>89 9 9
443.3<BR>90 9 10 458.5<BR>91
10 1 62.2<BR>92 10 2
138.4<BR>93 10 3 202.1<BR>94
10 4 255.3<BR>95 10 5
299.7<BR>96 10 6 336.8<BR>97
10 7 367.8<BR>98 10 8
393.7<BR>99 10 9 415.3<BR>100 10
10 433.4</DIV></FONT></BODY></HTML>