Learn R Programming

emdi (version 2.2.1)

getVarCov: Extract Variance-covariance Matrix from an emdi Object

Description

Methods getVarCov.ebp and getVarCov.fh extract the variance-covariance matrix from a fitted model of class "ebp" or "fh".

Usage

# S3 method for ebp
getVarCov(obj, individuals = 1, type = "random.effects", ...)

# S3 method for fh getVarCov(obj, individuals = 1, type = "random.effects", ...)

Value

A variance-covariance matrix or a list of variance-covariance matrices, if more than one individual is selected. For method getVarCov.ebp, the dimensions of the matrices are 1 x 1 for type "random.effects" and number of in-sample domains x number of in-sample domains for types "conditional" and "marginal". For method getVarCov.fh, for all types the dimensions of the matrices are 1 x 1. For type "marginal" the diagonal elements of the variance covariances matrices are returned for the chosen individual. Please note, if the correlation argument of the "fh" object is set to spatial, the variance covariance matrix has non-zero off-diagonal elements, because the assumption of independence of the error terms does not hold. For the non-spatial models, the off-diagonal elements are zero.

Arguments

obj

an object of type "emdi", either "ebp" or "fh".

individuals

vector of levels of the in-sample domains can be specified for the types "conditional" or "marginal".

type

a character that determines the type of variance-covariance matrix. Types that can be chosen (i) random-effects variance-covariance matrix ("random.effects"), (ii) conditional variance-covariance matrix ("conditional"), (iii) marginal variance-covariance matrix ("marginal"). Defaults to "random.effects".

...

additional arguments that are not used in this method.

Details

The generic function getVarCov is imported from package nlme and re-exported to make the S3-methods available, even though the nlme package itself is not loaded or attached. For default documentation, see getVarCov.

See Also

ebp, fh, getVarCov

Examples

Run this code
# \donttest{
# Example for class fh
combined_data <- combine_data(
  pop_data = eusilcA_popAgg,
  pop_domains = "Domain",
  smp_data = eusilcA_smpAgg,
  smp_domains = "Domain"
)

fh_std <- fh(
  fixed = Mean ~ cash + self_empl, vardir = "Var_Mean",
  combined_data = combined_data, domains = "Domain",
  method = "ml", MSE = TRUE
)

getVarCov(fh_std)
# }

Run the code above in your browser using DataLab