Learn R Programming

RDS (version 0.9-10)

hcg.replicate.weights: HCG parametric bootstrap replicate weights

Description

HCG parametric bootstrap replicate weights

Usage

hcg.replicate.weights(
  rds.data,
  outcome.variable,
  number.of.bootstrap.samples = 500,
  include.sample.weights = FALSE,
  N = NULL,
  small.fraction = FALSE
)

Value

A data.frame of replicate weights. If include.sample.weights is TRUE, the first column are the HCG weights for the observed sample.

Arguments

rds.data

An rds.data.frame

outcome.variable

The column name of the variable defining the groups for the homophily configuration graph

number.of.bootstrap.samples

The number of bootstrap replicate weights to be generated

include.sample.weights

If TRUE, the first column of the returned frame are the HCG weights for the sample

N

The population size

small.fraction

If TRUE, the sample size is assumed to be small compared to the population size

Details

This function generates bootstrap replicate weights which may be used to analyze RDS data in other packages or software systems (e.g. the survey package with svrepdesign).

Examples

Run this code
if (FALSE) {
data("fauxmadrona")
set.seed(1)
# Generate replicate weights
result <- hcg.replicate.weights(fauxmadrona, "disease", 50, TRUE)
# Analyze with survey package and compare to internal function
if(require(survey)){
  set.seed(1)
  design <- svrepdesign(fauxmadrona, type = "bootstrap", 
    weights= result[[1]], repweights = result[-1])
  svymean(~disease, design) |> print()
  RDS.bootstrap.intervals(fauxmadrona, "disease", "HCG", "HCG", 
  number.of.bootstrap.samples = 50) |> print()
}
}

Run the code above in your browser using DataLab