Description Usage Arguments Value Examples
addLm
takes a segment table (with start/end columns) or a
result object from code dpseg
, calls base R function
lm
for each segment, and adds slope, intercept, r2 and
variance of residuals to the segment table. This data is required
for plot and predict method, eg. when dpseg
was called with
a pre-calculated scoring matrix, or alternative scoring functions
or recursion.
1 |
dpseg |
result object (class "dpseg") returned by function
|
x |
original x-data used |
y |
original y-data used |
Returns the input dpseg
object or segment table, but
with original xy
data and fit
results from a
linear regression with base R (lm(y~x)
) added to the
results and linear regression coefficient and goodness of fit
meaurs in the main segments
table.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## 1: run dpseg with store.matrix=TRUE to allow re-rung
segs <- dpseg(x=oddata$Time, y=log(oddata$A3), store.matrix=TRUE)
## 2: run dpseg with score function matrix input
segr <- dpseg(y=segs$SCR, P=0.0001, verb=1)
## NOTE: only data indices i and j are provided in results
print(segr)
## 3: add original data and linear regression for segments
## NOTE: now also plot and predict methods work
segr <- addLm(segr, x=oddata$Time, y=log(oddata$A3))
print(segr)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.