Skip to content

Saving p values in power simulation  #15

@mhorger

Description

@mhorger

Hi! I'm trying to run the simulated power curve and I can't get the p value from my ANOVA table (2x2 between and within subs).

Here's the code:
sim_power <- function(x){ TDsleep <- rnorm(n = 25, mean=-0.1, sd = 0.2) DSsleep <- rnorm(n = 25, mean=-0.5, sd = 0.2) TDwake <- rnorm(n = 25, mean=-0.4, sd = 0.2) DSwake <- rnorm(n = 25, mean=-0.2, sd = 0.2) scores <- c(TDsleep, TDwake,DSsleep, DSwake ) cond<- rep(rep(c("SLEEP", "WAKE"), each = 25), 4) gru<- rep(rep(c("TD", "DS"), each = 50), 2) subs<-as.factor(rep(seq(1:50), 2)) DF<- data.frame(subs, scores, cond, gru) novaresults<- summary(aov(scores~gru*cond + Error(subs/(cond)), DF) ) novaresults<-str(novaresults) return(novaresults[[1]][["Pr(>F)"]][1]) }

Every other piece of the function seems to work when I run it independently, but I get NULL when I try indexing the p value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions