LinearRegressionByClass | R Documentation |
Fit linear regressions to node data by class.
LinearRegressionByClass(community, X, Y, class)
community |
an object of class |
X |
Independent variable. A property name that must meet the criteria of
the |
Y |
Dependent variable. A property name that must meet the criteria of
the |
class |
The property over which linear regressions are fitted. |
A linear model is fitted through all data points and through each
subset of the data given by class
. A list of lm
objects is
returned. The list will contain NULL
if it is not possible to fit a
linear regression to that class; this will happen for classes that contain
just a single node or that contain all or all but one nodes where X
and/or Y
is NA
.
A list
of lm
objects.
Lawrence Hudson
Community
,
ApplyByClass
,
NPS
,
NvMLinearRegressions
,
lm
data(TL84)
# Regressions fitted to log10(Biomass) versus log10(M) data.
models <- LinearRegressionByClass(TL84, 'Log10M', 'Log10Biomass',
'category')
# 'all', 'producer', 'invertebrate', 'vert.ecto'
names(models)
# Extract slopes and intercepts
sapply(models, coef)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.