Question: NEED R CODE FOR 8.!! Test next the reliability of the function ML_rule (obtained in Question 1) through a simulation study. Implement the simulation study

NEED R CODE FOR 8.!!

NEED R CODE FOR 8.!! Test next the reliability of the function

Test next the reliability of the function ML_rule (obtained in Question 1) through a simulation study. Implement the simulation study by repeating the following two steps 1000 times for i=1,,1000 : (a) Generate 150 observations from a population 1 with normal distribution N(1,2) where 1=1 and 2=1, and 150 observations from a population 2 with normal distribution N(2,2) where 2=2 and variance 2=1. For each iteration, set the seed of the simulations equal to 1+i. (b) Use the function ML_rule 1 to implement the ML rule and obtain the estimated missclassification probabilities p12 and p21 from the simulated data. Compare the distribution of p12 (you can calculate the kernel density from the 1000 values of p12 from the simulations) with the true probability p12, and compare the distribution of p21 with the true probability p21. Note that since the data is generated we can compute the true missclassification probabilities as p12=p21=(212), where () is the cumulative distribution function of the standard normal distribution (i.e. N(0,1) ) Comment on the results

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!