faulty power analysis

This commit is contained in:
mjgaughan 2023-11-14 09:01:02 -06:00
parent 48d1be7bf8
commit 48d4ea2851

View File

@ -17,14 +17,8 @@ l2p <- function(b) {
#Matt: #Matt:
makeDataNew <- function(n) { makeDataNew <- function(n) {
sDF <- data.frame( sDF <- data.frame(
sample(2793.638:3066.417, 1, replace = FALSE),
sample(27.6519:154.6866, 1, replace = FALSE),
sample(50.01884:96.77090, 1, replace = FALSE),
sample(c(1,2), 1, prob=(c(0.5,0.5)), replace = FALSE),
sample(1.610638: 1.684438, 1, replace = FALSE),
sample(-0.1961401:-0.1647757, 1, replace = FALSE)
) )
colnames(sDF) <- c('age', 'contributors', 'collaborators', 'milestones', 'mmt', 'up.fac.mean') colnames(sDF) <- c('formality', 'age', 'contributors', 'collaborators', 'milestones', 'mmt', 'up.fac.mean')
return(sDF) return(sDF)
} }
@ -38,8 +32,7 @@ powerCheck <- function(n, nSims) { #run a power calculation on the dataset given
for (s in 1:nSims) { # repeatedly we will.... for (s in 1:nSims) { # repeatedly we will....
simData <- makeDataNew(n) # make some data simData <- makeDataNew(n) # make some data
#have updated for kkex through here, now need to look at the underproduction work #have updated for kkex through here, now need to look at the underproduction work
m1.sim <- glm(up.fac.mean ~ ((mmt)/ (milestones/age)), # give the anticipated regression a try m1.sim <- lm(up.fac.mean ~ ((mmt)/ (milestones/age)), data=simData)
family=gaussian(link='identity'), data=simData)
p0 <- coef(summary(m1.sim))[1,4] p0 <- coef(summary(m1.sim))[1,4]
p1 <- coef(summary(m1.sim))[1,4] p1 <- coef(summary(m1.sim))[1,4]
p2 <- coef(summary(m1.sim))[1,4] p2 <- coef(summary(m1.sim))[1,4]