data(Ecoli)
fnx <- function(days,B1,B2,B3) {
if (length(B1) > 1) {
B2 <- B1[2]
B3 <- B1[3]
B1 <- B1[1]
}
B1/(1+exp(B2+B3*days))
}
nl1 <- nls(cells~fnx(days,B1,B2,B3),data=Ecoli,start=list(B1=6,B2=7.2,B3=-1.45))
if (require(nlstools)) {
nl1.boot <- nlstools::nlsBoot(nl1,niter=99) # way too few
confint(nl1.boot,"B1")
confint(nl1.boot,c(2,3))
confint(nl1.boot,conf.level=0.90)
predict(nl1.boot,fnx,days=3)
predict(nl1.boot,fnx,days=1:3)
htest(nl1.boot,1,bo=6,alt="less")
}
Run the code above in your browser using DataLab