Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this exercise we are going to use simulation to verify the result of exercise 3. In R sample x1, . . . , x100
In this exercise we are going to use simulation to verify the result of exercise 3. In R sample x1, . . . , x100 from a normal distribution with mean 2 and standard deviation 1.5. These numbers will stay fix for the rest of the exercise. In R sample 1, . . . , 100 from a uniform distribution on the interval [0.9, 1.1]. These numbers will stay fix for the rest of the exercise. Sample now i, for i = 1, . . . , 100, from a normal distribution with mean 0 and standard deviation i. Calculate yi = 2 3xi i. Now compute the value of the estimator 0 using these data (x1, y1), . . . , (x100, y100). You can use the R built-in function lm if you want or use the formula given in class. Repeat the process 1000 times and record in a vector the 1000 obtained 0. (Advice: To do that create a function that samples the values of and return the value of 0. Use then function replicate to apply the function created 1000 times. Remember that you can always use ?replicate to ask R for help). Attention: Every
Step 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