Take a random sample from a bivariate normal data based on a student ID number a
ID: 3293222 • Letter: T
Question
Take a random sample from a bivariate normal data based on a student ID number as follows:
set.seed(2000166068)
x = rnorm(500)
y = 2 * x + rnorm(500)
Note: DO NOT print out the data. You should not have the same data as anyone else.
1. For your sample, use R to finnd the mean of x, the mean of y, the standard deviation
of x, the standard deviation of y, and the correlation between x and y. (You must give R
code for credit.)
2. Find the equation of the regression line to predict y from x.
3. select a point (xi; yi) from the parent population of your data. Suppose xi = 1.
What is the probability that yi is greater than 3? (You may find this either by using theory
or based on your data.)
4. Find a 95% con dence interval for the slope coefficient of the regression line pre-
dicting y from midterm x.
Explanation / Answer
x = rnorm(500)
> y = 2 * x + rnorm(500)
1)
> mean(y)
[1] -0.0556165
> mean(x)
[1] -0.02089259
> sd(x)
[1] 1.008574
> sd(y)
[1] 2.26125
> cor(x,y)
[1] 0.89876
2)
lm(y~x)
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
-0.01352 2.01504
hence y = -0.01352 + 2.0154*x
3)X -N(0,1)
Y = 2X + N(0,1) = 3X
E(Y) = 0
sd(Y) = sqrt(3)
Z = (Y -0)/sqrt(3)
P(Y> 3) = P(Z> sqrt(3))
= 0.0416
4)
confint(lm(y~x) , level = 0.95)
2.5 % 97.5 %
(Intercept) -0.1007355 0.07370141
x 1.9284981 2.10158806
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.