Power Analysis in segmented regression
pwr.seg.RdGiven 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.
Arguments
- oseg
The fitted segmented object. If provided, the power is computed at the model parameter estimates, and all the remaining arguments but
alternativeandalphaare ignored.- pow
The desired power level. If provided
nhas to be missing- n
The fixed sample size. If provided
powhas to be missing- z
The covariate understood to have a segmented effect. Default is
"1:n/n", i.e. equispaced values in (0,1). More generally a string indicating the quantile function havingpand possible other numerical values as arguments. For istance"qunif(p,0,1)","qnorm(p,2,5)", or"qexp(p)"."qunif(p,1,n)"can be also specified, but attention should be paid to guaranteepsiwithin the covariate range. Finally, it could be also a numerical vector meaning the actual covariate, butpowhas to be missing. Namely if the covariate is supplied (and n is known), only the relevant power can be estimated.- psi
The breakpoint value within the covariate range
- d
The slope difference
- s
The response standard deviation
- n.range
When
powis provided and the relevant sample size estimate has to be returned, the function evaluates 50 sample sizes equally spaced inn.range. However the function can also compute, via spline interpolation, sample sizes outside the specified range.- X
The design matrix including additional linear variables in the regression equation. Default to
NULLwhich means intercept and linear term for the segmented covariate.- break.type
Type of breakpoint.
break.type='break'means piecewise linear (segmented),break.type='jump'refers to piecewise constant.- alpha
The type-I error probability. Default to 0.01.
- round.n
logical. If
TRUEthe (possible) returned sample size value is rounded.- 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
TRUEthe output is returned along with a simple message, otherwise only the values are returned- ci.pow
Numerical. If
oseghas been supplied,ci.powreplicates are drawn to build a 95% confidence interval for the power.
Details
The function exploits the sampling distribution of the pseudo Score statistic under the alternative hypothesis of one breakpoint.
References
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.