#hodnoty parametrov t<-c(0,0.467,25) #Emax model g<-function(x){ c(1,x/(x+t[3]),-x*t[2]/(x+t[3])^2) } #EDp-opt. navrh Xe<-c(0,150*t[3]/(150+2*t[3]),150) we<-c(1/4,1/2,1/4) #standardny navrh Xs<-c(0,10,25,50,100,150) ws<-rep(1/6,6) #informacna matica IM<-function(g,X,w){ m<-length(g(X[1])) n<-length(w) IM<-matrix(0, nrow=m, ncol=m) for (i in 1:n){ IM<-IM+w[i]*g(X[i])%*%t(g(X[i])) } IM } #gama gama<-function(p,t){ (1-p)*p*150^2/(t[3]+p*150+150)^2 } #EDp hodnota EDp<-function(IM,p,t){ c<-c(0,0,gama(p,t)) t(c)%*%solve(IM)%*%c } #EDp-eff eff<-EDp(IM(g,Xe,we),0.5,t)/EDp(IM(g,Xs,ws),0.5,t) #priemerovacie kriterium t1<-c(0,0.467,20) t2<-c(0,0.467,25) t3<-c(0,0.467,30) aved<-(EDp(IM(g,Xe,we),0.5,t1)+EDp(IM(g,Xe,we),0.5,t2)+EDp(IM(g,Xe,we),0.5,t3))/3 avs<-(EDp(IM(g,Xs,ws),0.5,t1)+EDp(IM(g,Xs,ws),0.5,t2)+EDp(IM(g,Xs,ws),0.5,t3))/3 t2<-20:30 b<-dbinom(20:30,50,0.5) ed<-0 for(i in 1:11) ed<-ed+b[i]*EDp(IM(g,Xe,we),0.5,c(0,0.467,t2[i])) s<-0 for(i in 1:11) s<-s+b[i]*EDp(IM(g,Xs,ws),0.5,c(0,0.467,t2[i])) #LOG-LINEARNY MODEL #hodnoty parametrov th0<-c(0,0.0797,1) #model f<-function(x) th0[1]+th0[2]*log(x+th0[3]) curve(f,0,150) #gradient g<-function(x,t){ c(1,log(x+t[3]),t[2]/(x+t[3])) } #EDp-opt. navrh xstar<-function(t) 1/150*t[3]*(150+t[3])*(log(150+t[3])-log(t[3]))-t[3] w1<-(log((xstar(th0)+t[3])/(150+t[3])))/(2*log(t[3]/(150+t[3]))) xED<-c(0,xstar(th0),150) wED<-c(w1,1/2,1/2-w1) #standardny navrh xS<-c(0,10,25,50,100,150) wS<-rep(1/6,6) #informacna matica IM<-function(g,X,w,t){ m<-length(g(X[1],t)) n<-length(w) IM<-matrix(0, nrow=m, ncol=m) for (i in 1:n){ IM<-IM+w[i]*g(X[i],t)%*%t(g(X[i],t)) } IM } #gama gama<-function(p,t){ (1-p)*p*150^2/(t[3]+p*150+150)^2 } #EDp hodnota EDp<-function(IM,p,t){ c<-c(0,0,gama(p,t)) t(c)%*%solve(IM)%*%c } #EDp-eff eff<-EDp(IM(g,xED,wED,th0),0.5,th0)/EDp(IM(g,xS,wS,th0),0.5,th0) #priemerovacie kriterium t1<-c(0,0.0797,0.5) t2<-c(0,0.0797,1) t3<-c(0,0.0797,1.5) aved<-(EDp(IM(g,xED,wED,t1),0.5,t1)+EDp(IM(g,xED,wED,t2),0.5,t2)+EDp(IM(g,xED,wED,t3),0.5,t3))/3 avs<-(EDp(IM(g,xS,wS,t1),0.5,t1)+EDp(IM(g,xS,wS,t2),0.5,t2)+EDp(IM(g,xS,wS,t3),0.5,t3))/3 th<-seq(0.5,1.5,by=0.1) b<-dbinom(10*seq(0.5,1.5,by=0.1),20,0.5) ed<-0 s<-0 for(i in 1:11){ t<- c(0,0.467,th[i]) ed<-ed+b[i]*EDp(IM(g,xED,wED,t),0.5,t) s<-s+b[i]*EDp(IM(g,xS,wS,t),0.5,t) }