qqnorm.emdi: Quantile-quantile Plots for an emdi Object

View source: R/qqnorm.R

qqnorm.emdiR Documentation

Quantile-quantile Plots for an emdi Object

Description

Normal quantile-quantile plots of the underlying model in the EBP (see also ebp) or Fay-Herriot (see also fh) approaches are obtained. The plots are obtained by ggplot.

Usage

## S3 method for class 'emdi'
qqnorm(y, color = c("blue", "lightblue3"), gg_theme = NULL, ...)

## S3 method for class 'ebp'
qqnorm(y, color = c("blue", "lightblue3"), gg_theme = NULL, ...)

## S3 method for class 'fh'
qqnorm(y, color = c("blue", "lightblue3"), gg_theme = NULL, ...)

## S3 method for class 'direct'
qqnorm(y, ...)

Arguments

y

a model object of type "emdi", either "ebp" or "fh", representing point and, if chosen, MSE estimates obtained by the EBP or Fay-Herriot approach (see also ebp and fh).

color

a character vector with two elements. The first element defines the color for the line in the QQ-plots, for the Cook's Distance plot and for the Box-Cox plot. The second element defines the color for the densities.

gg_theme

theme list from package ggplot2. For using this argument, package ggplot2 must be loaded via library(ggplot2). See also Example 4.

...

optional arguments passed to generic function.

Value

Two Q-Q plots in one grid obtained by ggplot.

See Also

emdiObject, ebp, fh

Examples


# Examples for models of type ebp
# Loading data - population and sample data
data("eusilcA_pop")
data("eusilcA_smp")

# With default setting but na.rm = TRUE; with Box-Cox transformation
emdi_model <- ebp(
  fixed = eqIncome ~ gender + eqsize + cash + self_empl +
    unempl_ben + age_ben + surv_ben + sick_ben + dis_ben + rent + fam_allow +
    house_allow + cap_inv + tax_adj, pop_data = eusilcA_pop,
  pop_domains = "district", smp_data = eusilcA_smp, smp_domains = "district",
  na.rm = TRUE
)

# Example 1: Creation of default diagnostic plots
qqnorm(emdi_model)

# Example for models of type fh

# Loading data - population and sample data
data("eusilcA_popAgg")
data("eusilcA_smpAgg")

# Combine sample and population data
combined_data <- combine_data(
  pop_data = eusilcA_popAgg,
  pop_domains = "Domain",
  smp_data = eusilcA_smpAgg,
  smp_domains = "Domain"
)

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

# Example 5: Creation of default diagnostic plots for Fay-Herriot model
qqnorm(fh_std)


SoerenPannier/emdi documentation built on Nov. 2, 2023, 7:54 p.m.