if (FALSE) {
## emaxsim changes the random number seed
doselev<-c(0,5,25,50,100,250)
n<-c(78,81,81,81,77,80)
dose<-rep(doselev,n)
### population parameters for simulation
e0<-2.465375
ed50<-67.481113
dtarget<-100
diftarget<-9.032497
emax<-solveEmax(diftarget,dtarget,log(ed50),1,e0)
sdy<-7.967897
pop<-c(led50=log(ed50),emax=emax,e0=e0)
meanresp<-emaxfun(dose,pop)
y<-rnorm(sum(n),meanresp,sdy)
nls.fit<-nls(y ~ e0 + (emax * dose)/(dose + exp(led50)),
start = pop, control = nls.control(
maxiter = 100),trace=TRUE,na.action=na.omit)
targetD(nls.fit,10,modType=3)
###
### apply targetD to an emaxsim object
###
nsim<-50
sdy<-25
gen.parm<-FixedMean(n,doselev,emaxfun(doselev,pop),sdy)
D4 <- emaxsim(nsim,gen.parm,modType=4)
summary(D4,testalph=0.05)
out<-NULL
for(i in 1:nsim){
out<-rbind(out,targetD(D4[i],target=4))
}
}
# \dontshow{
## emaxsim changes the random number seed
doselev<-c(0,5,25,50,100,250)
n<-c(78,81,81,81,77,80)
dose<-rep(doselev,n)
### population parameters for simulation
e0<-2.465375
ed50<-67.481113
dtarget<-100
diftarget<-9.032497
emax<-solveEmax(diftarget,dtarget,log(ed50),1,e0)
sdy<-7.967897
pop<-c(led50=log(ed50),emax=emax,e0=e0)
meanresp<-emaxfun(dose,pop)
y<-rnorm(sum(n),meanresp,sdy)
nls.fit<-nls(y ~ e0 + (emax * dose)/(dose + exp(led50)),
start = pop, control = nls.control(
maxiter = 100),trace=TRUE,na.action=na.omit)
targetD(nls.fit,10,modType=3)
# }
Run the code above in your browser using DataLab