0

I am trying to fit a Linear Mixed Effect model in nlme package. My data is:

x=1:100
y.1=rbeta(x,2,3)
y.2=rbeta(x,2,3)
y.3=rbeta(x,2,3)
y.4=rbeta(x,2,3)
y.5=rbeta(x,2,3)
x=t(rbind(rep(x,5)))
X=cbind(rep(1,length(x)),x,x,x,x,x)
colnames(X)=c("intercept","X1","X2","X3","X4","X5")
y=rbind(y.1,y.2,y.3,y.4,y.5)
y=t(y)
y=as.data.frame(y)
y=data.frame(stack(y[1:ncol(y)]))
y=as.matrix(y[1])


n=500    
dummy <- rep(1, n)
dimnames(y)[[1]] <- 1:n
tendon <- groupedData(y~X|dummy,data=data.frame(X, y))
colnames(tendon)[7]="y"
fit=lme(y~-1+X,data=tendon,method = "REML")

And then the above error is showing up. Can anyone have any idea regarding this.

  • Your code doesn't run (without errors). Please edit your question to make it reproducible. – Roman Luštrik Jan 20 '18 at 09:10
  • sorry about that, But I have edited the code. Please have look. – Mithun Ghosh Jan 20 '18 at 19:31
  • 1
    can you say a little more about what you're trying to do? (1) having five identical predictor variables will almost certainly break stuff; (2) lme prefers data to be specified by formula; also, I prefer *not* using the built-in groupedData machinery, I would do something like `lme(y~X1+X2+X3+X4+X5-1, random=~1|dummy, data=tendon, method="REML")` – Ben Bolker Jan 20 '18 at 19:56
  • Actually I want find the fitted value along with its confidence band. I use formula you wrote @Ben but its showing the same error as mentioned. – Mithun Ghosh Jan 21 '18 at 18:34

0 Answers0