Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/model.depends.R

Given a fitted model (of any kind), identify which of the covariates is involved in each term of the model.

1 2 3 4 5 | ```
model.depends(object)
model.is.additive(object)
model.covariates(object, fitted=TRUE, offset=TRUE)
has.offset.term(object)
has.offset(object)
``` |

`object` |
A fitted model of any kind. |

`fitted,offset` |
Logical values determining which type of covariates to include. |

The `object`

can be a fitted model of any kind,
including models of the classes `lm`

, `glm`

and `ppm`

.

To be precise,
`object`

must belong to a class for which there are methods
for `formula`

, `terms`

and `model.matrix`

.

The command `model.depends`

determines the relationship between
the original covariates (the data supplied when `object`

was
fitted) and the canonical covariates (the columns of the design matrix).
It returns a logical matrix, with one row for each canonical
covariate, and one column for each of the original covariates,
with the `i,j`

entry equal to `TRUE`

if the
`i`

th canonical covariate depends on the `j`

th
original covariate.

If the model formula of `object`

includes offset terms
(see `offset`

), then the return value of `model.depends`

also has an attribute `"offset"`

. This is a logical value or
matrix with one row for each offset term and one column for each of
the original covariates, with the `i,j`

entry equal to `TRUE`

if the
`i`

th offset term depends on the `j`

th
original covariate.

The command `model.covariates`

returns a character vector
containing the names of all (original) covariates that were actually
used to fit the model. By default, this includes all covariates that
appear in the model formula, including offset terms as well as
canonical covariate terms. To omit the offset terms, set
`offset=FALSE`

. To omit the canonical covariate terms,
set `fitted=FALSE`

.

The command `model.is.additive`

determines whether the model
is additive, in the sense that there is no canonical covariate that
depends on two or more original covariates. It returns a logical value.

The command `has.offset.term`

is a faster way to determine whether the
model *formula* includes an `offset`

term.

The functions `model.depends`

and `has.offset.term`

only detect `offset`

terms which are present
in the model formula. They do not detect numerical offsets in the
model object, that were inserted using the `offset`

argument
in `lm`

, `glm`

etc. To detect the presence of offsets
of both kinds, use `has.offset`

.

A logical value or matrix.

and \rolf

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
x <- 1:10
y <- 3*x + 2
z <- rep(c(-1,1), 5)
fit <- lm(y ~ poly(x,2) + sin(z))
model.depends(fit)
model.covariates(fit)
model.is.additive(fit)
fitoff1 <- lm(y ~ x + offset(z))
fitoff2 <- lm(y ~ x, offset=z)
has.offset.term(fitoff1)
has.offset(fitoff1)
has.offset.term(fitoff2)
has.offset(fitoff2)
``` |

spatstat documentation built on Aug. 16, 2017, 5:07 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.