pwr.seg | R Documentation |
Given the appropriate input values, the function computes the power (sample size) corresponding to the specifed sample size (power). If a segmented fit object is provided, the power is computed taking the parameter estimates as input values.
pwr.seg(oseg, pow, n, z = "1:n/n", psi, d, s, n.range = c(10,300),
X = NULL, break.type=c("break","jump"), alpha = 0.01, round.n = TRUE,
alternative = c("two.sided", "greater", "less"), msg = TRUE, ci.pow=0)
oseg |
The fitted segmented object. If provided, the power is computed at the model parameter estimates, and all the remaining arguments but |
pow |
The desired power level. If provided |
n |
The fixed sample size. If provided |
z |
The covariate understood to have a segmented effect. Default is |
psi |
The breakpoint value within the covariate range |
d |
The slope difference |
s |
The response standard deviation |
n.range |
When |
X |
The design matrix including additional linear variables in the regression equation. Default to |
break.type |
Type of breakpoint. |
alpha |
The type-I error probability. Default to 0.01. |
round.n |
logical. If |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided", "greater" or "less". Note, this refers to the sign of the slope difference. |
msg |
logical. If |
ci.pow |
Numerical. If |
The function exploits the sampling distribution of the pseudo Score statistic under the alternative hypothesis of one breakpoint.
The computed power or sample size, with or without message (depending on msg
)
Currently the function assumes just 1 breakpoint in one covariate
Nicoletta D'Angelo and Vito Muggeo
D'Angelo N, Muggeo V.M.R. (2021) Power analysis in segmented regression, working paper
https://www.researchgate.net/publication/355885747.
Muggeo, V.M.R. (2016) Testing with a nuisance parameter present only under the alternative: a score-based approach with application to segmented modelling. J of Statistical Computation and Simulation, 86, 3059–3067.
pscore.test
## pwr.seg(pow=.7, psi=.5, d=1.5, s=.5) #returns the sample size
## pwr.seg(n=219, psi=.5, d=1.5, s=.5) #returns the power
## pwr.seg(n=20,z="qnorm(p, 2,5)", psi=3, d=.5, s=2) #the covariate is N(2,5)
## pwr.seg(n=20,z="qexp(p)", psi=.1, d=.5, s=.1) #the covariate is Exp(1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.