CrumpLab / psyc3400

Website for Psyc 3400 Statistics @ Brooklyn College (Taught by Matt Crump)
16 stars 15 forks source link

Lab 4 Confusion #16

Closed AlbertAini closed 5 years ago

AlbertAini commented 6 years ago

I am really confused about how to do the generalization exercises of this lab. I believe I have the beginning portion correct but at the end I just can't seem to get it. I messed around with the code as much as I could and I can't attend lab because of the holidays...so this is my only hope. Any help would be appreciated.

This is my code:


 # get 1000 samples with 10 scores each

scores <- rnorm(1000*10,100,25)
samples <- rep(1:1000,each=10)
my_df <- data.frame(samples,scores)

# get the means of the samples

sample_means <- my_df %>%
                group_by(samples) %>%
                summarise(means=mean(scores))

# make a histogram

 ggplot(sample_means, aes(x=means))+
  geom_histogram(color="white")+
  theme_classic()

 #mean of sample means 

meanofmeans <- sample_means[,2] %>%
                 summarise(meanofmeans=mean(means))

meanofmeans

sdofmeans <- sample_means[,2] %>%
                 summarise(sdofmeans=sd(means))

sdofmeans

Attached are screenshots of the results I am getting.

Thank you for your time.

screen shot 2018-09-27 at 11 15 36 pm screen shot 2018-09-27 at 11 15 20 pm screen shot 2018-09-27 at 11 15 24 pm