Learn R Programming

surveycore (version 0.8.3)

survey_replicate: Replicate Weights Survey Design

Description

A survey design object using replicate weights for variance estimation. Create with as_survey_replicate().

Usage

survey_replicate(
  data = data.frame(),
  metadata = survey_metadata(),
  variables = list(),
  groups = character(0),
  call = NULL
)

Value

A survey_replicate object.

Arguments

data

A data.frame containing the survey data. Prefer as_survey_replicate() over calling this constructor directly.

metadata

A survey_metadata object. Created automatically by as_survey_replicate().

variables

A named list of design specification (weights, repweights, type, scale, rscales, fpc, fpctype, mse). Set automatically by as_survey_replicate().

groups

Set by surveytidy's group_by(). Always character(0) in standalone surveycore use.

call

Language object capturing the construction call.

Design variables (<code>@variables</code>)

weights

Character string naming the weight column.

repweights

Character vector of replicate weight column names. The replicate weight matrix is computed on demand from design@data[, design@variables$repweights] — it is not stored as a property.

type

Replicate weight method: one of "JK1", "JK2", "JKn", "BRR", "Fay", "bootstrap", "ACS", "successive-difference", or "other".

scale

Numeric scaling factor for variance estimation.

rscales

Numeric vector of replicate-specific scales, or NULL.

fpc

FPC column name or NULL.

fpctype

"fraction" or "correction".

mse

Logical. Use MSE estimates?

See Also

as_survey_replicate() to create a survey_replicate object.

Other constructors: as_survey(), as_survey_nonprob(), as_survey_replicate(), as_survey_twophase(), survey_data(), survey_glm(), survey_glm_fit(), survey_nonprob(), survey_taylor(), survey_twophase()

Examples

Run this code
# Prefer as_survey_replicate() over calling survey_replicate() directly
set.seed(1)
df <- data.frame(y = rnorm(20), wt = runif(20, 1, 3),
                 rep1 = runif(20, 0.5, 2), rep2 = runif(20, 0.5, 2))
d <- as_survey_replicate(df, weights = wt,
                         repweights = starts_with("rep"), type = "BRR")
class(d)

Run the code above in your browser using DataLab