Question: Bonus Statistical Thinking Exercise: Here is a block of code that does something similar to what we did at the beginning of the chapter with
Bonus Statistical Thinking Exercise: Here is a block of code that does something similar to what we did at the beginning of the chapter with the madeup GPA data set:
set.seed(1)
betaVar <- scale(rbeta(50,shape1=1,shape2=10))
normVar <- rnorm(50)
poisVar <- scale(rpois(50,lambda=10))
noiseVar <- scale(runi(50))
depVar <- betaVar/2 + normVar/2 + poisVar/2 + noiseVar/2 oddData <- data.frame(depVar,betaVar,normVar,poisVar)
You can see by that final command that we are creating another madeup data set that is appropriately named “oddData,” as it consists of variables from several dif‑
ferent distributions. Explain what each line of code does. Explain why this data set causes some difficulties with conventional multiple regression analysis. Cut/paste or type in the code to create the data set, then run lm() on the data, using depVar as the dependent variable and betaVar, normVar, and poisVar as the predictors. Interpret the results. For a super bonus, run lmBF() on the data and also interpret those results.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
