s-news
[Top] [All Lists]

Laird and Ware again

To: s-news@lists.biostat.wustl.edu
Subject: Laird and Ware again
From: "paul hughes" <u7n96@hotmail.com>
Date: Fri, 15 Dec 2000 00:33:33 -0000
Dear S users,
I am still having problems with this function:

y2<-function(n,i,v1,v2,v3,v4)
{
q<-c(1:n)
a<-c(0,cumsum(rexp(n-1)))
x<-ifelse(c(rep(c(sample(1:i)),n/i)) > i/2, 1, 0)
t<- cumsum(c(v1,v2,v3,v4))
s<-outer(a,t,"+")
y<-2+3*a+4*s+5*x
assign( "df", data.frame(q=q,a=a,x=x,s=s,y=y), 0 )
fit1<-lme(fixed=y~a+x+s,cluster=~q,data=df)
return(df,fit1)
}

For example:
y2(20,10,1,1,1,1)

Results in:

Error in lme.formula(fixed = y ~ a + x + s, cl..: Length of variable 1 i
s 3 != length of row names (20)
Dumped

I have tried reassigning <-outer(a,t,"+") to a different name("e",say) but then I get this message:

Error in lme.formula(fixed = y ~ a + x + e, cl..: Object "e" not found
Dumped

Does anyone have a clue how to fix this? Any help is useful, but please no hints, I know that some people know exactly what is going on but I don't and thats why I am asking this newsgroup for help.

THANKYOU ALL IN ADVANCE

Paul H



_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com


<Prev in Thread] Current Thread [Next in Thread>