hcg.replicate.weights: HCG parametric bootstrap replicate weights

View source: R/replicate-weights.R

hcg.replicate.weightsR Documentation

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
)

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).

Value

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

Examples

## Not run: 
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()
}

## End(Not run)

RDS documentation built on Sept. 11, 2024, 8:13 p.m.