ST758 -- Fall 2011 Homework #6 -- due Thursday, 03 November 2011 Exercises in Textbook: (*just turn in these) 10.2, 10.8 New Exercises: *1) (Variation on Exercise 10.2) Compute the integral of r^(d-1)exp(-cr)/((1+exp(-cr))^2) for 0 < r < infinity for d=1,2,3, where c=sqrt(2). Integrate using midpoint, trapezoid, or Simpson on (0,t). Take t big enough that you can bound the tail -- the integral (t,infinity) -- below .00001, by doing some calculus and then integrate on (0,t) to get the desired accuracy. Choose two interval sizes/number of points so that the difference in the computed integrals is below .00001. *2) Repeat the exercise above by generating from the exponential distribution. (Rewrite the integral so that it looks like the expectation of some function of an exponential random variable.) Estimate the variance of your estimate (you can use sample information), and determine the sample size needed to get the error below 1e-5. (Since the exponential distribution goes out to infinity, there's no need to fuss with the tail.) *3) The 'cross?.dat' files have tree (Eastern hemlock) height data measured for 25 months -- but not all -- see below. Fit a mixed model with a random intercept so that each tree follows the normal model Y ~ Normal_n( Xb, V) where X has an intercept column and covariates as given below and the covariance matrix V is Cov(Y) = V = sigma^2*I_n + gamma^2*ONE*ONE' where ONE is a vector of n ones. Here n=25. Find the maximum likelihood estimates for b, sigma^2, and gamma^2, and report standard errors based on asymptotics. Since the two variance parameters are supposed to be positive, transform using log/exp to allow the search to be unbounded. (But give standard errors in the original parameterization.) Here's the R code for the months and design matrix: months <- c(4:25,28,31,34) n <- length(months) X <- cbind(rep(1,25),pmin(pmax(0,months-5),4), pmin(pmax(0,months-17),4),pmin(pmax(0,months-29),4)) Use the last two digits of your student id to determine which of the four files: 0-24 use 1, 25-50 use 2, etc. cross1.dat has 8 trees (block #1) cross2.dat has 11 trees (block #2) cross3.dat has 12 trees (block #4) cross4.dat has 9 trees (block #5) These files are in the 'rfiles' directory. Further tips: 1) Using some linear algebra tricks that you learned in ST552, you can write the determinant and inverse of V directly. You don't have to do it this way, but it might help. 2) You can code your likelihood function with six parameters, (b and two variances) or do GLS yourself to get the MLE for b and concentrate/profile and reduce the search to just the two variance parameters.