Question: i need a brief report on your simulation and regression. Your report should include: A brief description of the true difference between in your groups,

i need a brief report on your simulation and regression. Your report should include:

  • A brief description of the true difference between in your groups, and its size relative to the variance.
  • The plot of your data. It does not need to be pretty or well-labeled. It's just for exploration.
  • A paragraph reporting your linear regression results. Be sure to be clear about the direction of the estimate (which group had the larger mean).
  • A comparison of the results to the true difference you used to simulate the data. Did the regression go in the right direction? Was the difference the expected size?
  • A few sentences reflecting on the exercise: Was anything surprising, confusing, easier than expected, helpful...?
  • The script used in this question is
  • # set seed for reproducibility set.seed(123)

# create simulated data group1 <- rnorm(100, mean = 10, sd = 2) group2 <- rnorm(100, mean = 12, sd = 2) outcome <- c(group1, group2) group <- rep(c("Group 1", "Group 2"), each = 100)

# create data frame df <- data.frame(outcome, group)

# plot data library(ggplot2) ggplot(df, aes(x = group, y = outcome)) + geom_boxplot() + labs(x = "Group", y = "Outcome", title = "Simulated Data")

# run linear regression model <- lm(outcome ~ group, data = df) summary(model)

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!