NvMLinearRegressions {cheddar} | R Documentation

## NvMLinearRegressions

### Description

Creation and analysis of linear regressions fitted to log10- transformed numerical abundance versus log10-transformed body mass.

### Usage

    NvMLinearRegressions(community, class)

    NvMSlope(community)
    NvMIntercept(community)
    NvMSlopeAndIntercept(community)

    NvMSlopeByClass(community, class)
    NvMInterceptByClass(community, class)
    NvMSlopeAndInterceptByClass(community, class)

### Arguments

`community` | an object of class `Community`.
`class` | the property over which linear regressions are fitted. Defaults to 'category' if the community has a node property with that name.

### Value

`NvMLinearRegressions` returns a `list` of `lm` objects, one for each `class` and one fitted to all data. 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`.

`NvMSlope`, `NvMIntercept` and `NvMSlopeAndIntercept` return the slope, intercept and both, respectively, of a single linear regression fitted to all data. `NvMSlopeByClass`, `NvMInterceptByClass` and `NvMSlopeAndInterceptByClass` return the slope, intercept and both, respectively, of linear regressions fitteed to each `class` and one to all data. For classes where it is not possible to fit a linear regression (for the reasons given above), `NvMSlopeByClass`, `NvMInterceptByClass` and `NvMSlopeAndInterceptByClass` will return `NA`.

### Author(s)

Lawrence Hudson

### See Also

`Community`, `CommunityCollection` `ApplyByClass`

### Examples

    data(TL84)

    models <- NvMLinearRegressions(TL84)

    # 'all', 'producer', 'invertebrate', 'vert.ecto'
    names(models)

    # Extract slopes and intercepts
    sapply(models, coef)

    # Slopes and intercepts through all data for each web in the pHWebs
    # collection
    data(pHWebs)
    CollectionCPS(pHWebs, properties=c('NvMSlope'))
    CollectionCPS(pHWebs, properties=c('NvMIntercept'))
    CollectionCPS(pHWebs, properties=c('NvMSlopeAndIntercept'))

    # Slopes and intercepts through each category for each web in pHWebs
    CollectionCPS(pHWebs, properties=c('NvMSlopeAndInterceptByClass'))

[Package cheddar version 0.1-633 Index]