Function used to define the segmented term within the segreg formula. The function simply passes relevant information to proper fitter functions.
seg(x, psi = NA, npsi = 1, est = NA, R = NA, fixed.psi = NULL, by = NULL, f.x = I)
The function simply returns the covariate with added attributes relevant to segmented term
The segmented (numeric) covariate
Possible starting value(s) for the breakpoint(s). If omitted, npsi
has to be specified.
The number of breakpoints to estimate. Default npsi=1
.
Possible vector (of length equal to npsi+1
) of 0/1 to indicate whether the slopes have to be estimated of fixed to zero.
If NA
, default, means all ones, namely every slope has to be estimated. Consecutive zeroes are not allowed.
Matrix to constrain the slopes. If provided, it overwrites the matrix coming from the specification of est
Possible fixed breakpoint values. These will be accounted for in addition to the estimated ones; slope
and plot.segmented
will account for them correctly.
A possible factor meaning an interaction with the segmented term. It means that a different segmented relationship is fitted within each category.
an optional function meaning a function to apply to the covariate before fitting
Vito Muggeo
The function is used within segreg
to 'build' information about the segmented relationships to fit.
segreg