习题答案 Ex4.2指数分布,λ的极大似然估计是n/sum(Xi) x-c(rep(5,365),rep(15,245),rep(25,150),rep(35,100),rep(45,70),rep(55,45),rep(65,25)) lamda-length(x)/sum(x);lamda[1] 0.05 Ex4.3Poisson分布P(x=k)=λ^k/k!*e^(-λ)其均数和方差相等,均为λ,其含义为平均每升水中大肠杆菌个数。取均值即可。 x-c(rep(0,17),rep(1,20),rep(2,10),rep(3,2),rep(4,1)) mean(x)[1] 1平均为1个。 Ex4.4 obj-function(x){f-c(-13+x[1]+((5-x[2])*x[2]-2)*x[2],-29+x[1]+((x[2]+1)*x[2]-14)*x[2]) ;sum(f^2)}? #其实我也不知道这是在干什么。所谓的无约束优化问题。 x0-c(0.5,-2) nlm(obj,x0)$minimum[1] 48.98425$estimate[1] 11.4127791 -0.8968052$gradient[1]? 1.411401e-08 -1.493206e-07$code[1] 1$iterations[
原创力文档

文档评论(0)