[R] Loop within nlme
Scott Story
sstory at montana.edu
Wed Nov 30 16:25:02 CET 2005
I am trying to mimic the SAS code below in R. The trick is that each
row in the dataset has variable "t" which controls how many times the
do-loop below will be iterated (that is, the model is fit to the
response, ifate, 0 to t-1 times for each row of data). Is it possible to
incorporate a loop like this into nlme by writing a function? Can
anybody provide some hints to get me on my way? The code below is for a
very simple model, an intercept only model, but more complex models will
be evaluated (some potentially including random effects). The code is
used to model daily nest survival.
Proc Nlmixed data=Mall tech=quanew method=gauss maxiter=1000;
parms B0=0;
p=1;
do i=0 TO t-1;
logit=B0;
p=p*(exp(logit)/(1+exp(logit)));
end;
model ifate~binomial(1,p);
--
Scott Story
Graduate Student
MSU Ecology Department
319 Lewis Hall
Bozeman, Mt 59717
406.994.2670
sstory at montana.edu
More information about the R-help
mailing list