plrs {plrs} | R Documentation

## Fit a (constrained) piecewise linear regression spline

### Description

The function fits a piecewise linear regression spline to explain gene expression by the segmented DNA copy number. The called copy number values are used as a template for model building.

### Usage

    plrs(expr, cghseg, cghcall=NULL, probloss = NULL, probnorm = NULL,
    probgain = NULL, probamp = NULL, knots = NULL, continuous = FALSE,
    constr = TRUE, constr.slopes = 2, constr.intercepts = TRUE,
    min.obs = 3, discard.obs = TRUE)

### Arguments

`expr` | Vector of gene expression values
`cghseg` | Vector of segmented copy number values
`cghcall` | Vector of called copy number values. If not provided, we are reduced to a simple linear model.
`probloss` | Vector of call probabilities associated with state "loss". Default is `NULL`.
`probnorm` | Vector of call probabilities associated with state "normal". Default is `NULL`.
`probgain` | Vector of call probabilities associated with state "gain". Default is `NULL`.
`probamp` | Vector of call probabilities associated with state "amplification". Default is `NULL`.
`knots` | knots or change points. If `NULL` (default), there are estimated. See details.
`continuous` | Logical, whether the model is continuous (no jump) or not.
`constr` | Logical, whether the model is constrained or not. (this has been implemented to turn on and off easily the constraints)
`constr.slopes` | Type of non-negativity constraints applied on slopes. Either 1 or 2 (default). See details.
`constr.intercepts` | If `TRUE` (default) jumps from state to state are also constrained to be non-negative
`min.obs` | See `modify.conf`
`discard.obs` | See `modify.conf`

### Details

If `cghcall=NULL`, discrete copy number values are omitted, which results in fitting a simple linear model.
If `constr.slopes=1`, all slopes are constrained to be non-negative. If `constr.slopes=2`, the slope associated with state "normal" is constrained to be non-negative and all others are forced to be at least equal to the latter.
Two methods are implemented for the estimation of knots. If call probabilities are provided, a knot is determined so that the sum of (the two adjacent) states membership probabilities is maximized. Otherwise, this is defined as the midpoint of the interval between the two consecutive states.

The constrained least squares problem is solved using function `solve.QP` of package quadprog.

### Value

An object of class `plrs-class`

### Author(s)

Gwenael G.R. Leday g.g.r.leday@vu.nl

### Examples

    # Simulate data
    sim <- plrs.sim(n=80, states=4, sigma=0.5)

    # Fit a model
    model <- plrs(expr=sim$expr, cghseg=sim$seg, cghcall=sim$cal)
    model

    # Methods
    coef(model)
    effects(model)
    fitted(model)
    knots(model)
    model.matrix(model)
    plot(model)
    predict(model, newcghseg=seq(0,5, length.out=100))
    residuals(model)
    summary(model)

[Package plrs version 1.27.0 Index]