I'm following the suggestion from this post https://www.cmm.bristol.ac.uk/forum/vie ... a976#p4572 to replicate the standardised residual vs predicted value within R.

I am two models. Model 1 is a 2-level random slope model with continuous outcome and IGLS is used to estimate the model. Model 2 is a 2-level random coefficient cumulative logit model with a ordinal outcome with 3 categories and MCMC estimation is used.

I have no problem to calculate the predicted value for Model 1 using the following code:

Code: Select all

```
pred <- data.frame(level2 = model1@data$lv2, pred.outcome = predict(model1))
pred.outcome.mean <- summaryBy(pred.outcome ~ level2, data = pred, FUN = mean)$pred.outcome.mean
```

Code: Select all

`pred <- data.frame(level2 = model2@data$lv2, pred.outcome = predict(model2))`

I've also tried to add type = "response" in the predict(), the same error appeared.Error in `[.data.frame`(indata, x.names) : undefined columns selected

Anyone has any idea?

Thanks a lot.

Vivian