Learn R Programming

ILSAstats (version 0.3.8)

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,
  wt,
  df,
  method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"),
  group = NULL,
  exclude = NULL
)

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.

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 large-scale assessment to determine the replication method to use. Available options are: "TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", and "TALIS". Note that "TIMSS" and "PIRLS" refer to the method used from 2016 onwards. Their method has not yet been implemented for previous cycles.

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.

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