Learn R Programming

ILSAstats (version 0.4.5)

repprop: Proportions with Replicate Weights

Description

Estimates proportions using replicate weights for a variable or a group of plausible values variables and for one or more populations. For a detailed explanation on how the standard errors are estimated see repse.

Usage

repprop(
  x,
  categories = NULL,
  setup = NULL,
  repwt = NULL,
  repindex = NULL,
  wt,
  df,
  method,
  group = NULL,
  exclude = NULL,
  aggregates = c("pooled", "composite")
)

Value

a list.

Arguments

x

a string vector specifying variable names (within df) for analysis.

categories

a vector indicating all possible response categories. If NULL, categories will be derived from the data.

setup

an optional list produced by repsetup.

repwt

a string indicating the common names for the replicate weights columns (within df), or a data frame with the replicate weights.

repindex

a repweights.index object generated with repcreate(..., index = TRUE). Using this argument instead of repwt will speed up the estimations considerably.

wt

a string specifying the name of the column (within df) with the total weights.

df

a data frame.

method

a string indicating the name of the replication method. Available options are: "JK2-full", "JK2-half", "FAY-0.5", and "JK2-half-1PV".

Additionally, ILSA names can be used, defaulting into:

  • "TIMSS", "PIRLS", or "LANA" for "JK2-full";

  • "ICILS", "ICCS", or "CIVED" for "JK2-half";

  • "PISA" or "TALIS" for "FAY-0.5";

  • and "oldTIMSS", "oldPIRLS", or "RLII" for "JK2-half-1PV".

Note that "oldTIMSS" and "oldPIRLS" refer to the method used for TIMSS and PIRLS before 2015, where within imputation variance is estimated using only 1 plausible value.

group

a string specifying the variable name (within df) to be used for grouping. Categories in group are treated as independent, e.g., countries.

exclude

a vector indicating which groups (in the same format as group) should be excluded from the pooled and composite estimates.

aggregates

a string vector indicating which aggregates should be included, options are "pooled" and "composite", both options can be used at the same time. If NULL no aggregate will be estimated.

Examples

Run this code
# Creation of replicate weights
RW <- repcreate(df = repdata, # the data frame with all the information
                 wt = "wt", # the total weights column name
                 jkzone = "jkzones", # the jkzones column name
                 jkrep = "jkrep", # the jkreps column name
                 repwtname = "REPWT", # the desired name for the rep weights
                 reps = 50, # the number of replications
                 method = "ICILS") # the name of the method aka the study name

### No groups ----

# One variable - weights within df
repprop(x = c("item01"),
        repwt = "REPWT", wt = "wt", df = cbind(repdata,RW),
        method = "ICILS")

# One variable - weights weights as a separate data frame
repprop(x = c("item01"),
        repwt = RW, wt = "wt", df = repdata,
        method = "ICILS")

# Multiple variables - PVs are assumed
repprop(x = c("CatMath1","CatMath2","CatMath3"),
        repwt = RW, wt = "wt", df = repdata,
        method = "ICILS")

### Groups ----

# One variable - weights within df
repprop(x = c("item01"),
        group = "GROUP",
        repwt = "REPWT", wt = "wt", df = cbind(repdata,RW),
        method = "ICILS")

# One variable - weights weights as a separate data frame
repprop(x = c("item01"),
        group = "GROUP",
        repwt = RW, wt = "wt", df = repdata,
        method = "ICILS")

# Multiple variables - PVs are assumed
repprop(x = c("CatMath1","CatMath2","CatMath3"),
        group = "GROUP",
        repwt = RW, wt = "wt", df = repdata,
        method = "ICILS")

# Multiple variables - excluding one group
repprop(x = c("CatMath1","CatMath2","CatMath3"),
        group = "GROUP",
        exclude = "GR2",
        repwt = RW, wt = "wt", df = repdata,
        method = "ICILS")

Run the code above in your browser using DataLab