Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed
> 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus For Scientists And Engineers Early Transcendentals

Authors: William L Briggs, Bernard Gillett, Bill L Briggs, Lyle Cochran

1st Edition

0321849213, 9780321849212

More Books

Students also viewed these Mathematics questions