Homework 14, Assigned 11/6/17, due Monday 11/13 in class ======================================================== 14 points (A) Consider the class discussion on "factors" and "contrasts" Show how you would change the "agegp", "alcgp" and "tobgp" to non-ordered factors in the data-frame "esoph" so that levels(agegp) consists of the values 30, 40, 50, 60, 70, 77 levels(alcgp) has values 10, 60, 110, 200 levels(tobgp) has values 4, 15, 28, 42 and so that all three factors have "helmert" contrasts. Re-do the logistic regression model fit, selecting the best AIC(., k=4) model with interactions up to 2nd order. Did this model differ from what you found as the best model in HW13 (B)? Use the model.matrix for your fitted model to show that you have coded the levels and contrasts correctly. (B) Consider the simulated dataset constructed by the following steps: > set.seed(33312) xvec = rpois(80, 2.3) (i) Find the MLE lam.hat by fitting this dataset of counts to Poisson(lambda). Find the Bayes minimum mean-squared error estimator lam.star for the same data, based on the prior density Gamma(1,.05) for the unknown lambda. (ii) Generate a `pseudo-sample' of size 800 in three different ways, based on this model- fitting exercise: (Parametric-bootstrap) iid Poisson with parameter lam.hat (Nonparametric-bootstrap) iid with replacement from the entries of xvec (Bayesian predictive): draw a single value lambda0 from the posterior density for lambda based on the prior indicated above and the Poisson(lambda) data-vector xvec, and then sample iid from Poisson(lambda0) Summarize descriptively the differences you see in the pseudo-samples generated these three ways.