Learn R Programming

svytest (version 1.1.0)

run_all_diagnostic_tests: Run All Diagnostic Tests for Informative Weights

Description

This function runs all implemented diagnostic tests: - wa_test() with types "DD", "PS1", "PS1q", "PS2", "PS2q", "WF" - diff_in_coef_test() - estim_eq_test() - perm_test() with stats "pred_mean" and "coef_mahal"

Usage

run_all_diagnostic_tests(model, alpha = 0.05, B = 1000)

# S3 method for run_all_diagnostic_tests print(x, ...)

Value

A list with:

results

Data frame of test names, statistics, p-values, reject indicator

recommendation

Character string with suggested action

raw

List of raw test outputs, including permutation test objects

Arguments

model

A fitted svyglm object.

alpha

Critical value for rejection (default 0.05).

B

Number of permutations for permutation tests (default 1000).

x

An object of class run_all_diagnostic_tests

...

Additional arguments passed to methods

See Also

wa_test, diff_in_coef_test, estim_eq_test, perm_test

Examples

Run this code
# Load in survey package (required) and load in example data
library(survey)
data(api, package = "survey")

# Create a survey design and fit a weighted regression model
des <- svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat)
fit <- svyglm(api00 ~ ell + meals, design = des)

# Run all diagnostic tests and return a list of statistics, including a recommendation
results <- run_all_diagnostic_tests(fit)
print(results)

Run the code above in your browser using DataLab