0

I desperately need help. I have a continuous Response variable, a fixed Treatment effect (factor variable with three levels), a fixed Time effect (factor variable with nine fixed time points), and a Subject effect which is the random effect (I have 34 subjects, basically every subject tries each Treatment at each Time point). I am trying to fit a mixed model with unstructured covariance, using the following command and I keep getting the error below. Also, it takes for EVER for R to return the error. The problem seems to be in the corSymm aspect. I have never done this before and R is still pretty hard for me, so any help would be greatly appreciated. Thank you!

cs1 <- corSymm(form = ~ 1 | Subject)                                                                    
cs1 <- Initialize(cs1, data = Mydata)                                    
model <- gls(Response ~ Time+Treatment+Treatment*Time, correlation = cs1,                                                           data = Mydata) 
anova(model)

Error in gls(Response ~ Time + Treatment + Treatment * Time, correlation = cs1, : function evaluation limit reached without convergence (9)

aosmith
  • 34,856
  • 9
  • 84
  • 118
user3339391
  • 11
  • 1
  • 2
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Explicitly list any non-base R packages that you are using so we know where these functions are coming from. – MrFlick Mar 13 '19 at 18:24
  • If every subject tries every treatment at each time point, you have 27 observations per subject. And if you use the general (unstructured) correlation structure via `corSymm()`, you are allowing every pair of observations to have a unique within-subject correlation. If I got this right, you are trying to estimate 27 choose 2 = 351 (!) unique correlations. I'm guessing this is why you are having problems. Are you sure this is the correlation structure you need? – aosmith Mar 13 '19 at 18:31

0 Answers0