Extract prediction band from lme fit

Warning: Read this thread on r-sig-mixed models before doing this. Be very careful when you interpret the resulting prediction band. From r-sig-mixed models FAQ adjusted to your example: set.seed(42) x <- rep(0:100,10) y <- 15 + 2*rnorm(1010,10,4)*x + rnorm(1010,20,100) id<-rep(1:10,each=101) dtfr <- data.frame(x=x ,y=y, id=id) library(nlme) model.mx <- lme(y~x,random=~1+x|id,data=dtfr) #create data.frame with new values for … Read more

Accuracy Score ValueError: Can’t Handle mix of binary and continuous target

Despite the plethora of wrong answers here that attempt to circumvent the error by numerically manipulating the predictions, the root cause of your error is a theoretical and not computational issue: you are trying to use a classification metric (accuracy) in a regression (i.e. numeric prediction) model (LinearRegression), which is meaningless. Just like the majority … Read more

How does predict.lm() compute confidence interval and prediction interval?

When specifying interval and level argument, predict.lm can return confidence interval (CI) or prediction interval (PI). This answer shows how to obtain CI and PI without setting these arguments. There are two ways: use middle-stage result from predict.lm; do everything from scratch. Knowing how to work with both ways give you a thorough understand of … Read more