Learn R Programming

RDS (version 0.9-9)

bootstrap.contingency.test: Performs a bootstrap test of independance between two categorical variables

Description

Performs a bootstrap test of independance between two categorical variables

Usage

bootstrap.contingency.test(
  rds.data,
  row.var,
  col.var,
  number.of.bootstrap.samples = 1000,
  weight.type = c("HCG", "RDS-II", "Arithmetic Mean"),
  table.only = FALSE,
  verbose = TRUE,
  ...
)

Arguments

rds.data

an rds.data.frame

row.var

the name of the first categorical variable

col.var

the name of the second categorical variable

number.of.bootstrap.samples

The number of simulated boootstrap populations

weight.type

The type of weighting to use for the contningency table. Only large sample methods are allowed.

table.only

only returns the weighted table, without bootstrap.

verbose

level of output

...

Additional parameters for compute_weights

Details

This function first estimates a Homophily Configuration Graph model for the underlying network under the assumption that the two variables are independant and that the population size is large. It then draws bootstrap RDS samples from this population distribution and calculates the chi.squared statistic on the weighted contingency table. Weights are calculated using the HCG estimator assuming a large population size.

Examples

Run this code
data(faux)
bootstrap.contingency.test(rds.data=faux, row.var="X", col.var="Y",
  number.of.bootstrap.samples=50, verbose=FALSE)

Run the code above in your browser using DataLab