Please answer problem 3 using the information from problem 2 2. Once again, it\'
ID: 3376119 • Letter: P
Question
Please answer problem 3 using the information from problem 2 2. Once again, it's time to simply make up data! You work for "Oh (Ginger) Snap! Cookies" and you want to create a study that shows cookies are associated with higher happiness ratings. Here is how you'll make the data set: You'll make up data for 202 people: for each person, you'll have their average cookie consumption per week and their average happiness (on a 0- 20 scale) .The cookie consumption values will be uniformly distributed over the interval [0,15] If someone eats no cookies per week, their happiness should be around 10 (middle of the scale) You want the data to roughly show that every five additional cookies consumed (on average) per week wil increase your happiness by one point on the happiness scale You need to make sure the data look a little noisy, so when you create the y values using the above bullet points, you'll add some random noise to each value you create. This random value will come from the distribution N(0,?), where you'll decide on the value of ? below When you run the analysis to see if your study increases happiness ratings, you want the results to come out with a P-value close to 0.001, so the results are super clear to America What value should you use for ? so that all the bullet points are met? (Note: This is not intended to be an R problem (see question 3). You can do this without any fancy technology.)
Explanation / Answer
n=202
cv=floor(runif(202,0,15))
ah=c();
for (i in 1:n)
{
if(cv[i]<=0)
{ah[i]=runif(1,11,20)+rnorm(1,0,1)}
else
{ah[i]=10+rnorm(1,0,1)}
}
LM=lm(ah~cv)
summary(LM)
Call:
lm(formula = ah ~ cv)
Residuals:
Min 1Q Median 3Q Max
-3.2409 -0.9842 -0.0288 0.6791 6.1680
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.07326 0.18485 59.904 < 2e-16 ***
cv -0.09896 0.02171 -4.558 8.98e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.359 on 200 degrees of freedom
Multiple R-squared: 0.0941, Adjusted R-squared: 0.08957
F-statistic: 20.78 on 1 and 200 DF, p-value: 8.979e-06