[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    [R] Loop within nlme
From:       Scott Story <sstory () montana ! edu>
Date:       2005-11-30 15:25:02
Message-ID: 438DC44E.5070109 () montana ! edu
[Download RAW message or body]

	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@montana.edu

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic