I'm trying to do a simple calculation of power for future data, but recently learned that both the stats
and pwrss
package have a test with the same name. They produce different power calculations though, so I need help deciding which one fits my problem best.
I want to calculate the power to detect a 30% (hypothetical) decline in density (count/sample area), but don't fully understand either function. I'm also probably getting the "one.sample"/"less than" jargon mixed up...(any help there is also appreciated).
stats::power.t.test(n = 47,
sd = 0.4352092,
delta = 0.1139639,
alternative = "one.sided",
type = "one.sample")
pwrss::power.t.test(ncp = (0.2659157*sqrt(47)), # <- tells the direction! (positive must = "greater"!)
# + ...
# + alternative = "less",
# Warning message:
# alternative = 'less' but non-centrality parameter is positive
df = 46,
alpha = 0.05,
alternative = "greater",
plot = FALSE)
Source for ncp definition: statistical power - Noncentrality Parameter - what is it, what does it do, what would be a suggested value? - Cross Validated
Data:
N=47 (Same 47 sites each time = paired test)
mean_log_den = mean (log transformed) density of 47 sites
sd = standard deviation
ln_down = hypothetical 30% decline of mean (log transformed) density
delta = change in delta
structure(list(Season = "DRY", assem = "Far", n = 47L, mean_log_den = 0.379879532043208,
sd = 0.435209207239454, ln_down = 0.265915672430246, delta = 0.113963859612963), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"), row.names = c(NA, -1L), groups = structure(list(
Season = "DRY", .rows = structure(list(1L), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -1L), .drop = TRUE))