if( !require('drc') ){ install.packages('drc', dependencies=TRUE, repos="http://cran.rstudio.com/") } library(drc) # get the dataset vinclozolin if( !require('nlme') ){ install.packages('nlme', dependencies=TRUE, repos='http://cran.rstudio.com/') } library(nlme) # I fit a model with all three parameters have randomized effects: # fit = nlme(effect ~ d/(1+exp(b*(log(conc)-log(e)))), fixed = list(b~1, d~1, e~1), random=b+d+e~1|exper, start = c(1, 1000, 0.1), data = vinclozolin) print(summary(fit)) # Fit a model where only two parameters have randomized effects: # fit_b_fixed = nlme(effect ~ d/(1+exp(b*(log(conc)-log(e)))), fixed = list(b~1, d~1, e~1), random=d+e~1|exper, start = c(1, 1000, 0.1), data = vinclozolin) print(summary(fit_b_fixed)) print(anova(fit_b_fixed, fit)) # the restricted model(with a larger RSS)is first