Learn R Programming

nlfh (version 0.1.0)

fitted.nlfh_fit: Extract Fitted Values from a Nonlinear Fay-Herriot Model

Description

For fitted nlfh_fit objects, fitted values are posterior summaries of the area-level quantities theta_i. The posterior draws are stored in the fitted object as an n_areas by n_draws matrix.

Usage

# S3 method for nlfh_fit
fitted(
  object,
  statistic = c("mean", "median"),
  summary = TRUE,
  full = FALSE,
  ...
)

Value

If summary = TRUE and full = FALSE, a named numeric vector of posterior means or medians. If summary = TRUE and full = TRUE, a data frame of posterior summaries. If summary = FALSE, the posterior draw matrix for theta_i.

Arguments

object

An object inheriting from class nlfh_fit.

statistic

Character string selecting the posterior point summary to return when summary = TRUE. Options are "mean" and "median".

summary

Logical. If TRUE, return posterior summaries. If FALSE, return the posterior draw matrix for theta_i.

full

Logical. If TRUE and summary = TRUE, return a data frame with posterior mean, standard deviation, median, 2.5% quantile, and 97.5% quantile for each area.

...

Additional arguments passed to methods. Currently unused.