Question: This is a. R Studio question. Set a seed equal to the number contained in your NetID (ie my NetID is tar310, so I would

This is a. R Studio question.

  1. Set a seed equal to the number contained in your NetID (ie my NetID is tar310, so I would type set.seed(310)). Create a new variable in your data set called "Sex_Randomized" and randomly assign each observation to be male or female. You can do this in the following way:

set.seed(zh2108)

My_data$Sex_Randomized = sample(My_Data$Sex, size = length(My_Data$Sex))

a. Find the difference between the mean of education for those randomly assigned "male" and those randomly assigned "female"

b. Find the difference between the s-squared for the sample of observations randomly assigned male and the sample randomly assigned female

2. Set your seed to 2108 again. Immediately after setting the seed, write a loop that does the following things 1,000 times

  • Create a random assignment of sex in the same way you did in question a and b.
  • Compute the difference in mean of education between those randomly assigned "Male" and "Female" the same way you did in a and store that difference in a vector.
  • Compute the difference in s-squared of education between those randomly assigned "Male" and "Female" the same way you did in b and store that difference in a vector.

After completing that loop report the following things:

example:

This is a. R Studio question.Set a seed equal to the number

> set.seed(310) > d2$Random_Acid = sample(d2$Acid, size = length(d2$Acid)) I 4 I > head(d2) Acid Survived Patient Random_Acid 1 1 1 1 1 2 1 1 2 0 3 1 1 3 0 4 0 0 4 0 5 1 l 5 1 6 0 1 6 0 > d2 %>% summarise("Acid Survival" = mean(Survived[Random_Acid == + "No Acid Survival" = mean(Survived[Random_Acid + "Diff" = \"Acid Survival\" - 'No Acid Survival') Acid Survival No Acid Survival Diff 1 0.7 0.7142857 -0.01428571 1]): 0])

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 Mathematics Questions!