Construct a 10 Times 3 predictor matrix X by filling the first column with ones
ID: 3673093 • Letter: C
Question
Construct a 10 Times 3 predictor matrix X by filling the first column with ones (constant), the second with the numbers (5,15, ...,95) (Dose), and the third with 10 rounded random numbers from the N(50,20^2) distribution (Age). Construct a random vector of length 10 by sampling from {28,29,30,31,32,33} with replacement in order to represent the totals. Use the true beta^T = c(-2.0,0,1,0) to construct the true probabilities pi and Use the R function rbinon to simulate the response according to the logistic regression model for each repeat in the simulation. Consider the design matrix X to be fixed throughout. Note that simulation is frequently used for deeper understanding of properties of statistical modeling. Feel free to Use R functions a much as you consider convenient. Programme 1000 repeats of logistic regression analysis of the simulated response given the fixed matrix X using the glm function of R or your own. Keep track of the P-value from the likelihood ratio test, the AIC values from the correct model and the suggested incorrect model. Use significance level alpha = 0.05 to compare the accuracy of the likelihood ratio test with that of minimum AIC. What do you conclude?Explanation / Answer
T = [ 1 1 1 1;5 15 20 25; 10 20 30 40 ]
T =
1 1 1 1
5 15 20 25
10 20 30 40