Asked • 11/14/23

How does one calculate the non-centrality parameter (t-distribution) in R?

I’m trying to calculate this parameter to perform a power analysis. I want to know the power to detect a future hypothetical 30% increase in a continuous variable (density). I think my alternative=”less than”, but R returns a warning saying the ncp can’t be positive when alternative hypothesis is “less”, so I think my calculation of ncp may be incorrect. I’m using the pwrss::power.t.test and my ncp formula = mean2(the 30% increase of the mean) x sqrt(n) which I got from here: https://stats.stackexchange.com/questions/92993/noncentrality-parameter-what-is-it-what-does-it-do-what-would-be-a-suggested


mean1=0.38

mean2 (30% increase) = 0.4940

sample size per group = 47


> power.t.test(ncp = (0.4940*sqrt(47)),
+ df = 46,
+ alpha = 0.05,
+ alternative = "less",
+ plot = FALSE)

power ncp.alt ncp.null alpha df t.crit
0.9546192 3.387 0 0.05 46 1.67866

Warning message:
alternative = 'less' but non-centrality parameter is positive


Nathan L.

I also want to calculate the power of detecting a 30% decrease, and in both cases, my ncp calculation was positive. Therefore, even if my current question should be "greater" instead of "less" (which fixes the current issue), I still have to deal with the warning for calculating the power to detect a decline.
Report

11/14/23

1 Expert Answer

By:

Nicholas V. answered • 11/20/23

Tutor
4.9 (52)

expert computer science tutor

Nathan L.

Awesome, thank you!
Report

11/24/23

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.