Returns response-scale fitted values: a single matrix for a cross-sectional
(ame_als) fit, or a list of matrices for a longitudinal
(lame_als) fit.
Usage
# S3 method for class 'ame_als'
fitted(object, plug_in = NULL, ...)Arguments
- object
an
ame_alsobject.- plug_in
logical; for an empirical-Bayes binary or count fit, return the plug-in fitted values (
TRUE) or the predictive means that integrate the link over the uncertainty of the predictor (FALSE). The default isTRUEfor a Poisson fit andFALSEfor a binary fit.- ...
ignored.
Details
For a binary fit the fitted values are
predictive probabilities: the expectation of the response over the posterior
of the linear predictor, \(\Phi(m / \sqrt{1 + v})\) for a probit link, with
\(m\) the posterior mean and \(v\) the posterior variance of the predictor
(see predict.ame_als). For a Poisson fit they are the plug-in
mean counts, \(e^{\eta + v_e / 2}\) at the fitted
predictor \(\eta\) (the posterior mean) and the variance \(v_e\) of
the noise of the count, as the samplers report them and as the dynamic
empirical-Bayes fit does: the posterior predictive mean of a count is not
finite in this model (the inverse-gamma tail of \(v_e\), and the
inverse-Wishart tail of the scale of the factors for a cell the data do not
inform), so its value would be a property of the numerical integration and of
the prior; the plug-in mean is finite everywhere. plug_in = FALSE
returns the predictive mean of a count that the integration over the
predictor gives, \(e^{m + (v + v_e) / 2}\), and
plug_in = TRUE the plug-in values of a binary fit (the response mean
at the fitted predictor); the plug-in values are what fit$fitted and
fit$YPM hold and simulate() uses. residuals() follows
fitted(). The mean of a normal response is its
predictor, so a normal fit's fitted values are the posterior means of the
predictor, with or without plug_in.
A dynamic fit (lame(method = "als") with dynamic_ab,
dynamic_beta or dynamic_uv) follows the same rules. The
empirical-Bayes binary fit returns the predictive probability, with \(v\)
the variance of the cell's predictor: the additive effects given the
coefficients (for an actor with no observed cell, the prior variance: its
level variance plus the stationary variance of a moving path at the
values in fit$eb$ab_dynamics), the
product of the positions, and the coefficients' part at the design asked
for; plug_in = TRUE returns \(\Phi(m)\), which fit$fitted
keeps. A fit stored without the variance record is an error of class
"lame_predictive_missing". The empirical-Bayes count fit returns the
plug-in mean \(e^{\eta + v_e / 2}\) and the normal fit the
predictor. The dynamic route
has no exposure and no forecasts (predict(h > 0) is an error).