Question
USE RStudio 2. Using seed of 123, and rnorm function in R , generate a sample of size n=1000n=1000 of Xi?N(0,?2X)Xi where ?2X=4, and generate
USE RStudio
2. Using seed of 123, and rnorm function in R, generate a sample of size n=1000n=1000 of Xi?N(0,?2X)Xi where ?2X=4, and generate Yi=1.25?0.2Xi?i where ?i?N(0,?2?) and ?2?=1
a. Plot the scatter plot of X and Y.
b. Split the sample into 2 subsets of sizes 250 and 750. For each subset, run the regression of Y on X using lm. Add each fitted regression line (use color) to your plot from (a). Are the lines the same? Explain why/why not
c. Repeat the steps for different values of n, ?2X, and ?2?. Do you get similar results? What changes and why?
Below is the image of same questions as above:
2. (40 points) Using seed of 123, and rnorm function in R , generate a sample of size n = 1000 of X; ~ N(0, of ) where of = 4, and generate Y; = 1.25 - 0.2Xje; where &; ~~ N(0, of ) and of = 1 a. Plot the scatter plot of X and Y. b. Split the sample into 2 subsets of size 250 and 750. For each subset, run the regression of Y on X using 1m . Add each fitted regression line (use color) to your plot from (a). Are the lines the same? Explain why/why not c. Repeat the steps for different values of n, or, and o . Do you get similar results? What changes and whyStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started