###################### ## Harjoitukset 8 ## ###################### ######### ## 8.3 ## ######### x<-94 n<-200 a<-x*log(x/n)+(n-x)*log(1-x/n)-3.841/2 fn<-function(theta){x*log(theta)+(n-x)*log(1-theta)-a} curve(fn(x),0,1, lwd=2,xlab=expression(theta),main="tehtava 8.3") abline(h=0) abline(v=0.4) abline(v=0.539) uniroot(fn,c(0.3,0.5)) # $root # [1] 0.4015732 # # $f.root # [1] 0.001555483 # # $iter # [1] 6 # # $estim.prec # [1] 6.103516e-05 uniroot(fn,c(0.5,0.6)) # $root # [1] 0.5392163 # # $f.root # [1] 8.841595e-05 # # $iter # [1] 5 # # $estim.prec # [1] 8.836205e-05