Compute a confidence interval from sample data assuming unknown distribution

If you don’t know the underlying distribution, then my first thought would be to use bootstrapping: https://en.wikipedia.org/wiki/Bootstrapping_(statistics) In pseudo-code, assuming x is a numpy array containing your data: import numpy as np N = 10000 mean_estimates = [] for _ in range(N): re_sample_idx = np.random.randint(0, len(x), x.shape) mean_estimates.append(np.mean(x[re_sample_idx])) mean_estimates is now a list of 10000 … Read more

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