From 343b6238918cceb671e3659c67ff6c64d5b3c047 Mon Sep 17 00:00:00 2001 From: Matthew Gaughan Date: Fri, 10 Nov 2023 12:00:45 -0600 Subject: [PATCH] running into issues in powerCheck --- R/calculatePower.R | 1 + R/powerAnalysis.R | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/calculatePower.R b/R/calculatePower.R index 471b1fa..07f0c80 100644 --- a/R/calculatePower.R +++ b/R/calculatePower.R @@ -25,6 +25,7 @@ data2 <- read_csv('/data_ext/users/kcz1100/kaylea_dissertation/collabnetXS/raw_d #levels(d$source) <- c("IP-based Editors", "New Editors", "Registered Editors", "Tor-based Editors") data1$up.fac.mean <- as.numeric(data2$up.fac.mean[match(data1$pkg, data2$pkg)]) +data1$milestones <- as.numeric(data1$milestones > 0) + 1 # (2) - Run the model on the pilot data pilotM <- glm(up.fac.mean ~ ((mmt) / (milestones/age)), # give the anticipated regression a try family=gaussian(link='identity'), data=data1) diff --git a/R/powerAnalysis.R b/R/powerAnalysis.R index fdb60dc..3c7d440 100644 --- a/R/powerAnalysis.R +++ b/R/powerAnalysis.R @@ -41,9 +41,9 @@ powerCheck <- function(n, nSims) { #run a power calculation on the dataset given m1.sim <- glm(up.fac.mean ~ ((mmt)/ (milestones/age)), # give the anticipated regression a try family=gaussian(link='identity'), data=simData) p0 <- coef(summary(m1.sim))[1,4] - p1 <- coef(summary(m1.sim))[2,4] - p2 <- coef(summary(m1.sim))[3,4] - p3 <- coef(summary(m1.sim))[4,4] + p1 <- coef(summary(m1.sim))[1,4] + p2 <- coef(summary(m1.sim))[1,4] + p3 <- coef(summary(m1.sim))[1,4] signif0[s] <- p0 <=.05 signif1[s] <- p1 <=.05 signif2[s] <- p2 <=.05