seg | R Documentation |
Function used to define a segmented (stepmented) term within the segreg (stepreg) formula. The function simply passes relevant information to proper fitter functions.
seg(x, npsi = 1, psi = NA, est = NA, R = NA, fixed.psi = NULL, by = NULL, f.x = I)
x |
The segmented/stepmented (numeric) covariate |
npsi |
The number of breakpoints/jumpoints to estimate. Default to |
psi |
Numerical vector indicating possible starting value(s) for the breakpoint(s). When provided, |
est |
Possible vector (of length equal to |
R |
Matrix to constrain the slopes. If provided, it overwrites the matrix (which is built internally) coming from the specification of |
fixed.psi |
Possible fixed breakpoint values to be accounted for in addition to those being estimated. If |
by |
A possible factor meaning an interaction with the segmented term |
f.x |
an optional function meaning a function to apply to the covariate before fitting. |
The function is used within segreg
and stepreg
to 'build' information about the segmented relationships to fit.
Note that, when a grouping variable has been specified in by
, npsi
can be specified as a vector, and est
, if specified, should be a list.
The function simply returns the covariate with added attributes relevant to segmented term
If any value is provided in fix.psi
, the corresponding slope difference coefficient will be labelled by *.fixed.*
. The slope
function will compute the 'right' slopes also accounting for the fixed breakpoints.
Vito Muggeo
segreg
##see ?segreg
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.