Learn R Programming

segmented (version 2.0-0)

seg: Specifying a segmented term in the segreg formula

Description

Function used to define the segmented term within the segreg formula. The function simply passes relevant information to proper fitter functions.

Usage

seg(x, psi = NA, npsi = 1, est = NA, R = NA, fixed.psi = NULL, by = NULL, f.x = I)

Value

The function simply returns the covariate with added attributes relevant to segmented term

Arguments

x

The segmented (numeric) covariate

psi

Possible starting value(s) for the breakpoint(s). If omitted, npsi has to be specified.

npsi

The number of breakpoints to estimate. Default npsi=1.

est

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.

R

Matrix to constrain the slopes. If provided, it overwrites the matrix coming from the specification of est

fixed.psi

Possible fixed breakpoint values. These will be accounted for in addition to the estimated ones; slope and plot.segmented will account for them correctly.

by

A possible factor meaning an interaction with the segmented term. It means that a different segmented relationship is fitted within each category.

f.x

an optional function meaning a function to apply to the covariate before fitting

Author

Vito Muggeo

Details

The function is used within segreg to 'build' information about the segmented relationships to fit.

See Also

segreg

Examples

Run this code
##see ?segreg

Run the code above in your browser using DataLab