lm.gofN: Fit a linear model to the residuals in a gofN object.

lm.gofNR Documentation

Fit a linear model to the residuals in a gofN object.

Description

This non-method runs a properly weighted linear model on the raw residuals of a gofN simulation for a multi-network ERGM fit.

Usage

lm.gofN(formula, data, ...)

Arguments

formula

an lm-style formula. See Details for interpretation.

data

a gofN object.

...

additional arguments to lm(), excluding weights.

Details

The formula's RHS is evaluated in an environment comprising the network statistics used in the gofN() call (which refer to the raw residuals for the corresponding statistic) and the network attributes.

The LHS is handled in a nonstandard manner, designed to make it easier to reference the usually lengthy network statistics: first, it is evaluated in the formula's environment. If the evaluation is successful and the result is numeric, these numbers are used as indices of the statistics in the gofN object to use on the RHS. If it is a character vector, it is treated as names of these statistics.

Value

A list of lm objects, one for each element of the vector on the LHS.

See Also

gofN() and related methods.

Examples

data(samplk)
# Add time indices:
samplk1 %n% "t" <- 1
samplk2 %n% "t" <- 2
samplk3 %n% "t" <- 3

monks <- Networks(samplk1, samplk2, samplk3)

fit <- ergm(monks~N(~edges+nodematch("group")))
fit.gof <- gofN(fit) # GOF = original model

# Is there a time effect we should incorporate?
fit.gof.lm <- lm.gofN((1:2)~t, data=fit.gof)

lapply(fit.gof.lm, summary)


ergm.multi documentation built on May 29, 2024, 11:07 a.m.