I have 50 of randomly generated numbers with my set parameters. I want to randomly sample the 50 random numbers into 10 groups of 5 (without replacement)
I want to store the 10 groups as matrix/dataframe and run an ANOVA test on the groups, then repeat the whole process 1000 times storing the F, F Critical, P values from each iteration.
I have the following
samp <- rnorm(50,3.47,0.0189) # 50 samples, mean of 3.47 and SD of 0.0189
for (i in 1:10){
x <- sample(samp, 5, replace = F)
}
x <- #all my random samples
my anova code that I usually use when data is in a list with a second column identifying the group
Samp_lm <- lm(Samp_lm ~ factor(group), data = x)
AnovaResults <- anova(Samp_lm)
criticalValues <- cbind(AnovaResults, 'F Critical Value' = qf(1 - 0.05, test.Aov[1, 1], test.Aov[2, 1]))
AnovaStats <- cbind(criticalValues[1,4],criticalValues[1,5],criticalValues[1,6]
Not sure where to go from here.
Aucun commentaire:
Enregistrer un commentaire