| Title: | Statistics for International Large-Scale Assessments (ILSA) |
|---|---|
| Description: | Calculates point estimates and standard errors using replicate weights and plausible values for International Large-Scale Assessments (ILSA), including: means, proportions, quantiles, correlations, singlelevel regressions, and multilevel regressions. |
| Authors: | Andrés Christiansen [aut, cre] (ORCID: <https://orcid.org/0000-0003-2692-7843>), Andrés Strello [ctb] (ORCID: <https://orcid.org/0000-0002-5613-8338>) |
| Maintainer: | Andrés Christiansen <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.4.5 |
| Built: | 2026-05-08 05:51:06 UTC |
| Source: | https://github.com/dopatendo/ilsastats |
Shows all options for the automatic functions: leaguetable, and proflevels.
autoILSA(func = c("leaguetable", "proflevels"), study = NULL)autoILSA(func = c("leaguetable", "proflevels"), study = NULL)
func |
a character value indicating the options of which function should be printed. |
study |
an optional character vector indicating the ILSA name. |
a list.
autoILSA()autoILSA()
Centers a vector, a matrix or a data frame to the grand mean or the group mean.
center(X, group = NULL, grandmean = NULL, groupmean = NULL, wt = NULL) grand.mean(x, wt = NULL) group.mean(x, group, wt = NULL) getgroup.mean(x, group, wt = NULL)center(X, group = NULL, grandmean = NULL, groupmean = NULL, wt = NULL) grand.mean(x, wt = NULL) group.mean(x, group, wt = NULL) getgroup.mean(x, group, wt = NULL)
X |
a matrix or a data frame. |
group |
a vector indicating the group for centering. |
grandmean |
a numeric or character vector indicating the number or the
the names of columns of |
groupmean |
a numeric or character vector indicating the number or the
the names of columns of |
wt |
a numeric vector of weights. |
x |
a vector, a matrix or a data frame. |
a data frame, or a vector.
# Less data for shorter example repdata2 <- repdata[1:10,c(1:3,6:10,51)] ### One variable ---- # grand-mean grand.mean(repdata2$item01) grand.mean(repdata2$item01,wt = repdata2$wt) # group-mean group.mean(repdata2$item01,group = repdata2$GROUP) group.mean(repdata2$item01,group = repdata2$GROUP,wt = repdata2$wt) ### More than one variable with the same rule ---- # grand-mean grand.mean(repdata2[,4:8]) grand.mean(repdata2[,4:8],wt = repdata2$wt) # group-mean group.mean(repdata2[,4:8],group = repdata2$GROUP) group.mean(repdata2[,4:8],group = repdata2$GROUP,wt = repdata2$wt) ### More than one variable with different rules ---- center(repdata2, group = repdata2$GROUP, grandmean = 4:5, groupmean = 6:8, wt = repdata2$wt) center(repdata2, group = repdata2$GROUP, grandmean = 6:8, groupmean = 4:5, wt = repdata2$wt) center(repdata2, group = repdata2$GROUP, wt = repdata2$wt, grandmean = paste0("item0",1:3), groupmean = paste0("item0",4:5)) center(repdata2, group = repdata2$GROUP, wt = repdata2$wt, grandmean = paste0("item0",4:5), groupmean = paste0("item0",1:3))# Less data for shorter example repdata2 <- repdata[1:10,c(1:3,6:10,51)] ### One variable ---- # grand-mean grand.mean(repdata2$item01) grand.mean(repdata2$item01,wt = repdata2$wt) # group-mean group.mean(repdata2$item01,group = repdata2$GROUP) group.mean(repdata2$item01,group = repdata2$GROUP,wt = repdata2$wt) ### More than one variable with the same rule ---- # grand-mean grand.mean(repdata2[,4:8]) grand.mean(repdata2[,4:8],wt = repdata2$wt) # group-mean group.mean(repdata2[,4:8],group = repdata2$GROUP) group.mean(repdata2[,4:8],group = repdata2$GROUP,wt = repdata2$wt) ### More than one variable with different rules ---- center(repdata2, group = repdata2$GROUP, grandmean = 4:5, groupmean = 6:8, wt = repdata2$wt) center(repdata2, group = repdata2$GROUP, grandmean = 6:8, groupmean = 4:5, wt = repdata2$wt) center(repdata2, group = repdata2$GROUP, wt = repdata2$wt, grandmean = paste0("item0",1:3), groupmean = paste0("item0",4:5)) center(repdata2, group = repdata2$GROUP, wt = repdata2$wt, grandmean = paste0("item0",4:5), groupmean = paste0("item0",1:3))
Calculates the intraclass correlation coefficient (ICC) fitting a linear mixed-effects model using lmer.
icc(x, PV = FALSE, group, data, weights = NULL, ...)icc(x, PV = FALSE, group, data, weights = NULL, ...)
x |
a string vector specifying variable names (within |
PV |
a logical value indicating if the variables in |
group |
a string specifying the variable name (within |
data |
an optional data frame containing the variables named in
|
weights |
an optional vector of ‘prior weights’ to be used
in the fitting process. Should be |
... |
Arguments passed on to
|
a numeric value or a list.
# ICC of one variable icc(x = "Math1",group = "GROUP", weights = repdata$wt, data = repdata) # ICC of more than one variable icc(x = c("Math1","Math2","Math3","Math4","Math5","SES"), group = "GROUP", weights = repdata$wt, data = repdata) # ICC of PVs icc(x = c("Math1","Math2","Math3","Math4","Math5"), PV = TRUE, group = "GROUP", weights = repdata$wt, data = repdata)# ICC of one variable icc(x = "Math1",group = "GROUP", weights = repdata$wt, data = repdata) # ICC of more than one variable icc(x = c("Math1","Math2","Math3","Math4","Math5","SES"), group = "GROUP", weights = repdata$wt, data = repdata) # ICC of PVs icc(x = c("Math1","Math2","Math3","Math4","Math5"), PV = TRUE, group = "GROUP", weights = repdata$wt, data = repdata)
Estimates the mean score for all countries within a cycle of an ILSA.
Arguments method, reps, and var, are extracted from
autoILSA and can be overridden by the user.
leaguetable( df, study = NULL, year, subject = NULL, specification = NULL, addCI = TRUE, alpha = 0.05, method = NULL, reps = NULL, fixN = TRUE )leaguetable( df, study = NULL, year, subject = NULL, specification = NULL, addCI = TRUE, alpha = 0.05, method = NULL, reps = NULL, fixN = TRUE )
df |
a data frame. |
study |
an optional character vector indicating the ILSA name, for a list of available
ILSA, check |
year |
a numeric vector indicating the ILSA name, for a list of available
cycles, check |
subject |
an optional character vector indicating the subject for a list of available
ILSA, check |
specification |
a character value indicating extra specification like grade
(e.g., |
addCI |
a logical value indicating if confidence intervals should be added.
Defaults is |
alpha |
a numeric value indicating confidence level. |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
reps |
an integer indicating the number of replications to be created.
If |
fixN |
a logical value indicating if data should be "fixed" to meet official criteria.
For example, reducing the sample for certain countries in TIMSS 1995. Default is |
a data frame.
data(timss99) leaguetable(df = timss99, year = 1999)data(timss99) leaguetable(df = timss99, year = 1999)
Fits a linear mixed-effects model using lmer and plausible values.
lmerPV( formula, data = NULL, weights = NULL, pvs, relatedpvs = TRUE, grandmean = NULL, groupmean = NULL, group = NULL, nullmodel = FALSE, barnardrubin = TRUE, ... )lmerPV( formula, data = NULL, weights = NULL, pvs, relatedpvs = TRUE, grandmean = NULL, groupmean = NULL, group = NULL, nullmodel = FALSE, barnardrubin = TRUE, ... )
formula |
a two-sided linear formula object describing both the
fixed-effects and random-effects part of the model, with the
response on the left of a |
data |
an optional data frame containing the variables named in
|
weights |
an optional vector of ‘prior weights’ to be used
in the fitting process. Should be |
pvs |
a list indicating which variables from |
relatedpvs |
a logical value indicating if |
grandmean |
a character vector indicating the names of columns of
|
groupmean |
a character vector indicating the names of columns of
|
group |
a string specifying the variable name (within |
nullmodel |
a logical value indicating if the null model should also be estimated. |
barnardrubin |
a logical value indicating if Barnard & Rubin adjustment
should be used for estimating the degrees of freedom. Default is |
... |
Arguments passed on to
|
a list.
# Null model - with PVs ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m1 <- lmerPV(formula = MATH ~ 1 + (1|GROUP), # Intercept varies across GROUP pvs = pvs, # Named list data = repdata, # Data frame weights = repdata$wt) # Weights vector m1 ## Fixed effects m1$fixef ## Random effects m1$ranef ## Models for each PV summary(m1$models) # Multiple regression ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m2 <- lmerPV(formula = MATH ~ 1 + GENDER + SES + schoolSES + (1|GROUP), pvs = pvs, # Named list data = repdata, # Data frame weights = repdata$wt) # Weights vector m2 # Multiple regression with grandmean centering ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m3 <- lmerPV(formula = MATH ~ 1 + GENDER + SES + schoolSES + (1|GROUP), pvs = pvs, # Named list data = repdata, # Data frame weights = repdata$wt, grandmean = c("SES","schoolSES")) m3 # Multiple regression with groupmean centering ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m4 <- lmerPV(formula = MATH ~ 1 + GENDER + SES + schoolSES + (1|GROUP), pvs = pvs, # Named list data = repdata, # Data frame weights = repdata$wt, grandmean = "schoolSES", groupmean = "SES", group = repdata$GROUP) m4# Null model - with PVs ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m1 <- lmerPV(formula = MATH ~ 1 + (1|GROUP), # Intercept varies across GROUP pvs = pvs, # Named list data = repdata, # Data frame weights = repdata$wt) # Weights vector m1 ## Fixed effects m1$fixef ## Random effects m1$ranef ## Models for each PV summary(m1$models) # Multiple regression ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m2 <- lmerPV(formula = MATH ~ 1 + GENDER + SES + schoolSES + (1|GROUP), pvs = pvs, # Named list data = repdata, # Data frame weights = repdata$wt) # Weights vector m2 # Multiple regression with grandmean centering ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m3 <- lmerPV(formula = MATH ~ 1 + GENDER + SES + schoolSES + (1|GROUP), pvs = pvs, # Named list data = repdata, # Data frame weights = repdata$wt, grandmean = c("SES","schoolSES")) m3 # Multiple regression with groupmean centering ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m4 <- lmerPV(formula = MATH ~ 1 + GENDER + SES + schoolSES + (1|GROUP), pvs = pvs, # Named list data = repdata, # Data frame weights = repdata$wt, grandmean = "schoolSES", groupmean = "SES", group = repdata$GROUP) m4
Modifies ILSA data to meet official participation cases, selects columns and transforms data into simple data frames converting missing values to NAs.
prepILSA( df, study = NULL, year = NULL, specification = NULL, fixN = TRUE, columns = NULL )prepILSA( df, study = NULL, year = NULL, specification = NULL, fixN = TRUE, columns = NULL )
df |
a data frame. |
study |
an optional character vector indicating the ILSA name, for a list of available
ILSA, check |
year |
a numeric vector indicating the ILSA name, for a list of available
cycles, check |
specification |
a character value indicating extra specification like grade
(e.g., |
fixN |
a logical value indicating if data should be "fixed" to meet official criteria.
For example, reducing the sample for certain countries in TIMSS 1995. Default is |
columns |
a character vector indicating which columns should be selected.
If |
data(timss99) head(timss99) newdata <- prepILSA(df = timss99, columns = paste0("BSMMAT0",1:5),fixN = FALSE) head(newdata)data(timss99) head(timss99) newdata <- prepILSA(df = timss99, columns = paste0("BSMMAT0",1:5),fixN = FALSE) head(newdata)
Estimates the proficiency levels for all countries within a cycle of an ILSA.
Arguments method, and reps, are extracted from
autoILSA and can be overridden by the user.
proflevels( df, study = NULL, year, subject = NULL, method = NULL, reps = NULL, type = c("long", "wide1", "wide2"), separateSE = TRUE, fixN = TRUE, accumulated = FALSE )proflevels( df, study = NULL, year, subject = NULL, method = NULL, reps = NULL, type = c("long", "wide1", "wide2"), separateSE = TRUE, fixN = TRUE, accumulated = FALSE )
df |
a data frame. |
study |
an optional character vector indicating the ILSA name, for a list of available
ILSA, check |
year |
a numeric vector indicating the ILSA name, for a list of available
cycles, check |
subject |
an optional character vector indicating the subject for a list of available
ILSA, check |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
reps |
an integer indicating the number of replications to be created.
If |
type |
a character value indicating the type of table to produce.
Options include: |
separateSE |
a logical value indicating if standard errors should be separated from
proportions, each as an element from a list. Only works for wide tables. Default is |
fixN |
a logical value indicating if data should be "fixed" to meet official criteria.
For example, reducing the sample for certain countries in TIMSS 1995. Default is |
accumulated |
a logical value indicating if proficiency levels should be accumulated. |
a data frame or a list.
data(timss99) proflevels(timss99,year = 1999,type = "long",subject = "math")data(timss99) proflevels(timss99,year = 1999,type = "long",subject = "math")
Converts ILSA scores into proficiency levels.
proflevels.get(df, study = NULL, subject = NULL, combine = TRUE)proflevels.get(df, study = NULL, subject = NULL, combine = TRUE)
df |
a data frame. |
study |
an optional character vector indicating the ILSA name, for a list of available
ILSA, check |
subject |
an optional character vector indicating the subject for a list of available
ILSA, check |
combine |
a logical value indicating if subjects should be combined in a single data frame. |
a data frame or a list.
data(timss99) proflevels.get(timss99, subject = "math")data(timss99) proflevels.get(timss99, subject = "math")
Creates replicate weights given jackknife replicates and jackknife zones.
repcreate( df, wt, jkzone, jkrep, repwtname = "RWT", reps = NULL, method, index = FALSE ) repcreateILSA(study, year, df, repwtname = "RWT", index = FALSE)repcreate( df, wt, jkzone, jkrep, repwtname = "RWT", reps = NULL, method, index = FALSE ) repcreateILSA(study, year, df, repwtname = "RWT", index = FALSE)
df |
a data frame. |
wt |
a string specifying the name of the column (within |
jkzone |
a string specifying the name of the column in |
jkrep |
a string specifying the name of the column in |
repwtname |
a string specifying the variable names for the replicate weights. |
reps |
an integer indicating the number of replications to be created.
If |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
index |
a logical value indicating if the result should be just an index
of zero and double weights instead of a matrix. Default is |
study |
a string indicating the study name. For checking available studies use
|
year |
a numeric value indicating the study year. For checking available
years use
|
a data frame or a list.
head(repdata) # 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 head(RW)head(repdata) # 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 head(RW)
Fits a generalized linear model using glm for replicate weights.
For a detailed explanation on how the standard errors are estimated
see repse.
repglm( formula, family = stats::gaussian, pvs = NULL, relatedpvs = TRUE, quiet = FALSE, summarize = TRUE, setup = NULL, df, wt, repwt, group = NULL, exclude = NULL, na.action = getOption("na.action"), method )repglm( formula, family = stats::gaussian, pvs = NULL, relatedpvs = TRUE, quiet = FALSE, summarize = TRUE, setup = NULL, df, wt, repwt, group = NULL, exclude = NULL, na.action = getOption("na.action"), method )
formula |
an object of class |
family |
a description of the error distribution and link
function to be used in the model. For |
pvs |
if plausible values are not used, this should be |
relatedpvs |
a logical value indicating if |
quiet |
a logical value indicating if progress status should be shown
while estimating models by group. Default is |
summarize |
a logical value indicating if |
setup |
an optional list produced by |
df |
a data frame. |
wt |
a string specifying the name of the column (within |
repwt |
a string indicating the common names for the replicate weights
columns (within |
group |
a string specifying the variable name (within |
exclude |
a vector indicating which groups
(in the same format as |
na.action |
a function which indicates what should happen
when the data contain |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
a list with the standard errors and the total weights models.
# Less data for shorter example repdata2 <- repdata[1:200,] # Creation of replicate weights RW <- repcreate(df = repdata2, # 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 ---- # Simple regression - default family = gaussian repglm(formula = GENDER ~ 1 + Math1, family = gaussian, # Link function wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Simple regression - change link function repglm(formula = GENDER ~ 1 + Math1, family = quasibinomial, # Link function wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Multiple regression repglm(formula = GENDER ~ 1 + Math1 + Reading1, family = quasibinomial, # Link function wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Multiple regression - with PVs ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3)) pvs repglm(formula = GENDER ~ 1 + Math + Reading1, # Math1 now is "Math" family = quasibinomial, # Link function wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list method = "ICILS") # the name of the method aka the study name# Less data for shorter example repdata2 <- repdata[1:200,] # Creation of replicate weights RW <- repcreate(df = repdata2, # 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 ---- # Simple regression - default family = gaussian repglm(formula = GENDER ~ 1 + Math1, family = gaussian, # Link function wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Simple regression - change link function repglm(formula = GENDER ~ 1 + Math1, family = quasibinomial, # Link function wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Multiple regression repglm(formula = GENDER ~ 1 + Math1 + Reading1, family = quasibinomial, # Link function wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Multiple regression - with PVs ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3)) pvs repglm(formula = GENDER ~ 1 + Math + Reading1, # Math1 now is "Math" family = quasibinomial, # Link function wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list method = "ICILS") # the name of the method aka the study name
Fits a linear model using lm for replicate weights.
For a detailed explanation on how the standard errors are estimated
see repse.
replm( formula, pvs = NULL, relatedpvs = TRUE, quiet = FALSE, summarize = TRUE, setup = NULL, df, wt, repwt, group = NULL, exclude = NULL, na.action = getOption("na.action"), method, aggregates = c("pooled", "composite") )replm( formula, pvs = NULL, relatedpvs = TRUE, quiet = FALSE, summarize = TRUE, setup = NULL, df, wt, repwt, group = NULL, exclude = NULL, na.action = getOption("na.action"), method, aggregates = c("pooled", "composite") )
formula |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
pvs |
if plausible values are not used, this should be |
relatedpvs |
a logical value indicating if |
quiet |
a logical value indicating if progress status should be shown
while estimating models by group. Default is |
summarize |
a logical value indicating if |
setup |
an optional list produced by |
df |
a data frame. |
wt |
a string specifying the name of the column (within |
repwt |
a string indicating the common names for the replicate weights
columns (within |
group |
a string specifying the variable name (within |
exclude |
a vector indicating which groups
(in the same format as |
na.action |
a function which indicates what should happen
when the data contain |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
aggregates |
a string vector indicating which aggregates should be
included, options are |
a list.
# Less data for shorter example repdata2 <- repdata[1:1000,] RW <- repcreate(df = repdata2, # 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 ---- # Simple regression - weights within df replm(formula = Math1 ~ 1 + GENDER, wt = "wt", # Name of total weight column within df repwt = "REPWT", # Common names of replicate weights within df df = cbind(repdata2,RW), # Data frame method = "ICILS") # the name of the method aka the study name # Simple regression - weights as a separate data frame replm(formula = Math1 ~ 1 + GENDER, wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Multiple regression replm(formula = Math1 ~ 1 + GENDER + Reading1, wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Multiple regression - with PVs ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading1, # Math1 now is "Math" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list method = "ICILS") # the name of the method aka the study name # Multiple regression - with more than one related PV variable ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3), Reading = paste0("Reading",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading, # Reading1 now is "Reading" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list method = "ICILS") # the name of the method aka the study name # Multiple regression - with more than UNrelated PV variables ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3), Reading = paste0("Reading",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading, # Reading1 now is "Reading" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list relatedpvs = FALSE, # Unrelated PVs method = "ICILS") # the name of the method aka the study name ### Groups ---- # Simple regression - weights within df replm(formula = Math1 ~ 1 + GENDER, wt = "wt", # Name of total weight column within df repwt = "REPWT", # Common names of replicate weights within df df = cbind(repdata2,RW), # Data frame group = "GROUP", method = "ICILS") # the name of the method aka the study name # Simple regression - weights as a separate data frame replm(formula = Math1 ~ 1 + GENDER, wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame group = "GROUP", method = "ICILS") # the name of the method aka the study name # Multiple regression replm(formula = Math1 ~ 1 + GENDER + Reading1, wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame group = "GROUP", method = "ICILS") # the name of the method aka the study name # Multiple regression - with PVs ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading1, # Math1 now is "Math" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list group = "GROUP", method = "ICILS") # the name of the method aka the study name # Multiple regression - with more than one related PV variable ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3), Reading = paste0("Reading",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading, # Reading1 now is "Reading" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list group = "GROUP", method = "ICILS") # the name of the method aka the study name # Multiple regression - with UNrelated PV variables ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3), Reading = paste0("Reading",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading, # Reading1 now is "Reading" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list relatedpvs = FALSE, # Unrelated PVs group = "GROUP", method = "ICILS") # the name of the method aka the study name# Less data for shorter example repdata2 <- repdata[1:1000,] RW <- repcreate(df = repdata2, # 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 ---- # Simple regression - weights within df replm(formula = Math1 ~ 1 + GENDER, wt = "wt", # Name of total weight column within df repwt = "REPWT", # Common names of replicate weights within df df = cbind(repdata2,RW), # Data frame method = "ICILS") # the name of the method aka the study name # Simple regression - weights as a separate data frame replm(formula = Math1 ~ 1 + GENDER, wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Multiple regression replm(formula = Math1 ~ 1 + GENDER + Reading1, wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame method = "ICILS") # the name of the method aka the study name # Multiple regression - with PVs ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading1, # Math1 now is "Math" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list method = "ICILS") # the name of the method aka the study name # Multiple regression - with more than one related PV variable ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3), Reading = paste0("Reading",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading, # Reading1 now is "Reading" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list method = "ICILS") # the name of the method aka the study name # Multiple regression - with more than UNrelated PV variables ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3), Reading = paste0("Reading",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading, # Reading1 now is "Reading" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list relatedpvs = FALSE, # Unrelated PVs method = "ICILS") # the name of the method aka the study name ### Groups ---- # Simple regression - weights within df replm(formula = Math1 ~ 1 + GENDER, wt = "wt", # Name of total weight column within df repwt = "REPWT", # Common names of replicate weights within df df = cbind(repdata2,RW), # Data frame group = "GROUP", method = "ICILS") # the name of the method aka the study name # Simple regression - weights as a separate data frame replm(formula = Math1 ~ 1 + GENDER, wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame group = "GROUP", method = "ICILS") # the name of the method aka the study name # Multiple regression replm(formula = Math1 ~ 1 + GENDER + Reading1, wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame group = "GROUP", method = "ICILS") # the name of the method aka the study name # Multiple regression - with PVs ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading1, # Math1 now is "Math" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list group = "GROUP", method = "ICILS") # the name of the method aka the study name # Multiple regression - with more than one related PV variable ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3), Reading = paste0("Reading",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading, # Reading1 now is "Reading" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list group = "GROUP", method = "ICILS") # the name of the method aka the study name # Multiple regression - with UNrelated PV variables ## Named list, with element names matching formula variables pvs = list(Math = paste0("Math",1:3), Reading = paste0("Reading",1:3)) pvs replm(formula = Math ~ 1 + GENDER + Reading, # Reading1 now is "Reading" wt = "wt", # Name of total weight column within df repwt = RW, # Data frame of weights df = repdata2, # Data frame pvs = pvs, # Named list relatedpvs = FALSE, # Unrelated PVs group = "GROUP", method = "ICILS") # the name of the method aka the study name
Estimates the mean, variance and standard deviation with replicate weights
for a variable or a group of variables and for one or more
populations. For a detailed explanation on how the standard errors are estimated
see repse.
repmean( x, PV = FALSE, setup = NULL, repwt = NULL, repindex = NULL, wt, df, method, var = c("unbiased", "ML", "none"), group = NULL, by = NULL, exclude = NULL, aggregates = c("pooled", "composite"), simplify = TRUE )repmean( x, PV = FALSE, setup = NULL, repwt = NULL, repindex = NULL, wt, df, method, var = c("unbiased", "ML", "none"), group = NULL, by = NULL, exclude = NULL, aggregates = c("pooled", "composite"), simplify = TRUE )
x |
a string vector specifying variable names (within |
PV |
a logical value indicating if the variables in |
setup |
an optional list produced by |
repwt |
a string indicating the common names for the replicate weights
columns (within |
repindex |
a |
wt |
a string specifying the name of the column (within |
df |
a data frame. |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
var |
a string indicating the method to use for the variance:
|
group |
a string specifying the variable name (within |
by |
a string specifying a second variable (within |
exclude |
a vector indicating which groups
(in the same format as |
aggregates |
a string vector indicating which aggregates should be
included, options are |
simplify |
a logical value indicating if only the summary
statistics should be printed. If |
a data frame or a list.
# 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 repmean(x = c("item01"), PV = FALSE, repwt = "REPWT", wt = "wt", df = cbind(repdata,RW), method = "ICILS",var = "ML") # One variable - weights as a separate data frame repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML") # Multiple variables repmean(x = c("item01","item02","item03"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML") # One PV variable repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML") ### Groups ---- # One variable repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite # Multiple variables repmean(x = c("item01","item02","item03"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite # One PV variable repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite ### Groups and By ---- # One variable repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite # One PV variable repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite# 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 repmean(x = c("item01"), PV = FALSE, repwt = "REPWT", wt = "wt", df = cbind(repdata,RW), method = "ICILS",var = "ML") # One variable - weights as a separate data frame repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML") # Multiple variables repmean(x = c("item01","item02","item03"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML") # One PV variable repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML") ### Groups ---- # One variable repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite # Multiple variables repmean(x = c("item01","item02","item03"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite # One PV variable repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite ### Groups and By ---- # One variable repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite # One PV variable repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite
Calculates the confidence intervals for a repmean object.
repmeanCI(x, alpha = 0.05, add = TRUE)repmeanCI(x, alpha = 0.05, add = TRUE)
x |
an object produced by |
alpha |
a numeric value indicating confidence level. |
add |
a logical value indicating if the confidence intervals should be added
to the object or not. Defaults is |
a data frame or a list.
# 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 ### Groups ---- # One variable reme <- repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeanCI(reme) # One PV variable reme <- repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeanCI(reme) ### Groups and By ---- # One variable reme <- repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeanCI(reme) # One PV variable reme <- repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeanCI(reme)# 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 ### Groups ---- # One variable reme <- repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeanCI(reme) # One PV variable reme <- repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeanCI(reme) ### Groups and By ---- # One variable reme <- repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeanCI(reme) # One PV variable reme <- repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeanCI(reme)
Estimates the mean difference for a single variable with replicate weights.
For a detailed explanation on how the standard errors are estimated
see repse.
repmeandif(x)repmeandif(x)
x |
a data frame produced by |
a data frame or a list.
# 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 ### Groups ---- # One variable reme <- repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeandif(reme) # One PV variable reme <- repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeandif(reme) ### Groups and By ---- # One variable reme <- repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeandif(reme) # One PV variable reme <- repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeandif(reme)# 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 ### Groups ---- # One variable reme <- repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeandif(reme) # One PV variable reme <- repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeandif(reme) ### Groups and By ---- # One variable reme <- repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeandif(reme) # One PV variable reme <- repmean(x = paste0("Math",1:5), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite repmeandif(reme)
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.
repprop( x, categories = NULL, setup = NULL, repwt = NULL, repindex = NULL, wt, df, method, group = NULL, exclude = NULL, aggregates = c("pooled", "composite") )repprop( x, categories = NULL, setup = NULL, repwt = NULL, repindex = NULL, wt, df, method, group = NULL, exclude = NULL, aggregates = c("pooled", "composite") )
x |
a string vector specifying variable names (within |
categories |
a vector indicating all possible response categories.
If |
setup |
an optional list produced by |
repwt |
a string indicating the common names for the replicate weights
columns (within |
repindex |
a |
wt |
a string specifying the name of the column (within |
df |
a data frame. |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
group |
a string specifying the variable name (within |
exclude |
a vector indicating which groups
(in the same format as |
aggregates |
a string vector indicating which aggregates should be
included, options are |
a list.
# 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")# 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")
Creates tables for proportions using replicate weights for a variable or a group of plausible values variables and for one or more populations.
repprop.table(x, type = c("long", "wide1", "wide2"), separateSE = TRUE)repprop.table(x, type = c("long", "wide1", "wide2"), separateSE = TRUE)
x |
a list produced by |
type |
a character value indicating the type of table to produce.
Options include: |
separateSE |
a logical value indicating if standard errors should be separated from
proportions, each as an element from a list. Only works for wide tables. Default is |
a adata frame or a list.
# 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 x = repprop(x = c("item01"), group = "GROUP", repwt = "REPWT", wt = "wt", df = cbind(repdata,RW), method = "ICILS") repprop.table(x, type = "long") repprop.table(x, type = "wide1", separateSE = TRUE) repprop.table(x, type = "wide1", separateSE = FALSE) repprop.table(x, type = "wide2", separateSE = TRUE) repprop.table(x, type = "wide2", separateSE = FALSE)# 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 x = repprop(x = c("item01"), group = "GROUP", repwt = "REPWT", wt = "wt", df = cbind(repdata,RW), method = "ICILS") repprop.table(x, type = "long") repprop.table(x, type = "wide1", separateSE = TRUE) repprop.table(x, type = "wide1", separateSE = FALSE) repprop.table(x, type = "wide2", separateSE = TRUE) repprop.table(x, type = "wide2", separateSE = FALSE)
Estimates quantiles with replicate weights
for a variable or a group of variables and for one or more
populations.
For a detailed explanation on how the standard errors are estimated
see repse.
repquant( x, qtl = c(0.05, 0.25, 0.75, 0.95), setup = NULL, repwt, wt, df, method, group = NULL, by = NULL, exclude = NULL )repquant( x, qtl = c(0.05, 0.25, 0.75, 0.95), setup = NULL, repwt, wt, df, method, group = NULL, by = NULL, exclude = NULL )
x |
a string vector specifying variable names (within |
qtl |
a numeric vector indicating the desired quantiles (between 0 and 1). |
setup |
an optional list produced by |
repwt |
a string indicating the common names for the replicate weights
columns (within |
wt |
a string specifying the name of the column (within |
df |
a data frame. |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
group |
a string specifying the variable name (within |
by |
a string specifying a second variable (within |
exclude |
a vector indicating which groups
(in the same format as |
a data frame or a list.
RWT <- 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 repquant(x = c("item01"), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = "REPWT", wt = "wt", df = cbind(repdata,RWT), method = "ICILS") # One variable - weights as a separate data frame repquant(x = c("item01"), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS") # One PV variable repquant(x = paste0("Math",1:5), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS") ### Groups ---- # One variable repquant(x = c("item01"), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite # One PV variable repquant(x = paste0("Math",1:5), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite ### Groups and By ---- # One variable repquant(x = c("item01"), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite # One PV variable repquant(x = paste0("Math",1:5), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor CompositeRWT <- 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 repquant(x = c("item01"), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = "REPWT", wt = "wt", df = cbind(repdata,RWT), method = "ICILS") # One variable - weights as a separate data frame repquant(x = c("item01"), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS") # One PV variable repquant(x = paste0("Math",1:5), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS") ### Groups ---- # One variable repquant(x = c("item01"), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite # One PV variable repquant(x = paste0("Math",1:5), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", exclude = "GR2") # GR2 will not be used for Pooled nor Composite ### Groups and By ---- # One variable repquant(x = c("item01"), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite # One PV variable repquant(x = paste0("Math",1:5), qtl = c(0.05, 0.25, 0.75, 0.95), repwt = RWT, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite
Estimates correlation coefficients using replicate weights.
For a detailed explanation on how the standard errors are estimated
see repse.
reprho( x = NULL, pv = NULL, pv2 = NULL, relatedpvs = TRUE, setup = NULL, repwt, wt, df, rho = c("pearson", "spearman", "polychoric"), method, group = NULL, exclude = NULL, aggregates = c("pooled", "composite") )reprho( x = NULL, pv = NULL, pv2 = NULL, relatedpvs = TRUE, setup = NULL, repwt, wt, df, rho = c("pearson", "spearman", "polychoric"), method, group = NULL, exclude = NULL, aggregates = c("pooled", "composite") )
x |
a string vector specifying variable names (within |
pv |
a string vector indicating the variable names for all plausible values
of a construct. If not |
pv2 |
a string vector indicating the variable names for all plausible values
of a second construct (distinct from |
relatedpvs |
a logical value indicating if |
setup |
an optional list produced by |
repwt |
a string indicating the common names for the replicate weights
columns (within |
wt |
a string specifying the name of the column (within |
df |
a data frame. |
rho |
a string indicating the correlation coefficient to be computed:
|
method |
a string indicating the name of the replication method.
Available options are:
Note that |
group |
a string specifying the variable name (within |
exclude |
a vector indicating which groups (in the same format as |
aggregates |
a string vector indicating which aggregates should be
included, options are |
a data frame.
# 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 ---- # Non PVs reprho(x = c("GENDER",paste0("Math",1:3)), pv = NULL, pv2 = NULL, rho = "pearson", repwt = RW, wt = "wt", df = repdata, method = "ICILS") # X var and PVs reprho(x = c("GENDER",paste0("Math",1:3)), pv = paste0("Reading",1:5), pv2 = NULL, rho = "pearson", repwt = RW, wt = "wt", df = repdata, method = "ICILS") # PVs and PVs (related) reprho(x = NULL, pv = paste0("Math",1:5), pv2 = paste0("Reading",1:5), rho = "pearson", repwt = RW, wt = "wt", df = repdata, method = "ICILS") # PVs and PVs (UNrelated) reprho(x = NULL, pv = paste0("Math",1:5), pv2 = paste0("Reading",1:5), relatedpvs = FALSE, rho = "pearson", repwt = RW, wt = "wt", df = repdata, method = "ICILS") ### Groups ---- # Non PVs reprho(x = c("GENDER",paste0("Math",1:3)), pv = NULL, pv2 = NULL, rho = "pearson", repwt = RW, wt = "wt", df = repdata, group = "GROUP", method = "ICILS") # X var and PVs reprho(x = c("GENDER",paste0("Math",1:3)), pv = paste0("Reading",1:5), pv2 = NULL, rho = "pearson", repwt = RW, wt = "wt", df = repdata, group = "GROUP", method = "ICILS") # PVs and PVs (related) reprho(x = NULL, pv = paste0("Math",1:5), pv2 = paste0("Reading",1:5), rho = "pearson", repwt = RW, wt = "wt", df = repdata, group = "GROUP", method = "ICILS") # PVs and PVs (UNrelated) reprho(x = NULL, pv = paste0("Math",1:5), pv2 = paste0("Reading",1:5), relatedpvs = FALSE, rho = "pearson", repwt = RW, wt = "wt", df = repdata, group = "GROUP", method = "ICILS")# 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 ---- # Non PVs reprho(x = c("GENDER",paste0("Math",1:3)), pv = NULL, pv2 = NULL, rho = "pearson", repwt = RW, wt = "wt", df = repdata, method = "ICILS") # X var and PVs reprho(x = c("GENDER",paste0("Math",1:3)), pv = paste0("Reading",1:5), pv2 = NULL, rho = "pearson", repwt = RW, wt = "wt", df = repdata, method = "ICILS") # PVs and PVs (related) reprho(x = NULL, pv = paste0("Math",1:5), pv2 = paste0("Reading",1:5), rho = "pearson", repwt = RW, wt = "wt", df = repdata, method = "ICILS") # PVs and PVs (UNrelated) reprho(x = NULL, pv = paste0("Math",1:5), pv2 = paste0("Reading",1:5), relatedpvs = FALSE, rho = "pearson", repwt = RW, wt = "wt", df = repdata, method = "ICILS") ### Groups ---- # Non PVs reprho(x = c("GENDER",paste0("Math",1:3)), pv = NULL, pv2 = NULL, rho = "pearson", repwt = RW, wt = "wt", df = repdata, group = "GROUP", method = "ICILS") # X var and PVs reprho(x = c("GENDER",paste0("Math",1:3)), pv = paste0("Reading",1:5), pv2 = NULL, rho = "pearson", repwt = RW, wt = "wt", df = repdata, group = "GROUP", method = "ICILS") # PVs and PVs (related) reprho(x = NULL, pv = paste0("Math",1:5), pv2 = paste0("Reading",1:5), rho = "pearson", repwt = RW, wt = "wt", df = repdata, group = "GROUP", method = "ICILS") # PVs and PVs (UNrelated) reprho(x = NULL, pv = paste0("Math",1:5), pv2 = paste0("Reading",1:5), relatedpvs = FALSE, rho = "pearson", repwt = RW, wt = "wt", df = repdata, group = "GROUP", method = "ICILS")
Calculates the standard error given a vector or list of previous estimations.
repse(er, e0, setup = NULL, method) repsecomp(se) pvse(PVse, PVe0, df = FALSE, n = NULL, k = NULL, barnardrubin = TRUE)repse(er, e0, setup = NULL, method) repsecomp(se) pvse(PVse, PVe0, df = FALSE, n = NULL, k = NULL, barnardrubin = TRUE)
er |
a vector or a list containing any statistic of interest
(e.g., percent, mean, variance, regression coefficient).
If it is a vector or list of |
e0 |
a numeric vector or a vector containing any statistic of interest
(e.g., percent, mean, variance, regression coefficient), computed using
total weights. For scenarios without plausible values,
|
setup |
an optional list produced by |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
se |
a numeric vector with standard errors,
used by |
PVse |
a numeric vector containing the standard errors of the estimates of each plausible value. |
PVe0 |
a numeric vector containing the point estimates of each plausible value. |
df |
a logical value indicating if degrees should be calculated. |
n |
a numeric value indicating the sample size. |
k |
a numeric value indicating the number of estimated parameters. |
barnardrubin |
a logical value indicating if Barnard & Rubin adjustment
should be used for estimating the degrees of freedom. Default is |
The standard errors are calculated using a modifier , for JK2-full: ;
for JK2-half: ; and for FAY-0.5:
. Depending on the statistic, one of the following
formulas is used.
The standard error not involving plausible values is calculated by:
The standard error involving plausibles values and replicate weights is calculated by:
The standard error involving plausibles values without replicate weights is calculated by:
The standard error of the difference of
two statistics ( and ) from independent samples is calculated by:
The standard error of the difference of
two statistics ( and ) from dependent samples
not involving plausible values
is calculated by:
The standard error of the difference of
two statistics ( and ) from dependent samples
involving plausible values
is calculated by:
The standard error of a composite estimate is calculated by:
The standard error of the difference between an element () of the composite
and the composite is calculated by:
Where
represents a statistic of interest,
the subindex indicates an estimate using the total weights,
indicates a replicate from a total of ,
indicates a plausible value from a total of ,
and indicates an element in a composite estimate from value a total of .
the standard error.
# 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 # Non-PVs ---- ## Mean with total weights E0 <- stats::weighted.mean(x = repdata$item01, w = repdata$wt, na.rm = TRUE) E0 ## Means by replication ER <- as.vector(apply(RW,2,function(i){ stats::weighted.mean(x = repdata$item01, w = i, na.rm = TRUE) })) ER ## Standard error by hand repse(er = ER, e0 = E0, method = "ICILS") ## Standard error with repmean() repmean(x = "item01",wt = "wt",repwt = RW,df = repdata, method = "ICILS") # PVs ---- ## Mean with total weights E0 <- sapply(1:5,function(i){ stats::weighted.mean(x = repdata[,paste0("Math",i)], w = repdata$wt, na.rm = TRUE) }) E0 ## Means by replication ER <- lapply(1:5, function(j){ as.vector(apply(RW,2,function(i){ stats::weighted.mean(x = repdata[,paste0("Math",j)], w = i, na.rm = TRUE) })) }) ER ## Standard error by hand repse(er = ER, e0 = E0, method = "ICILS") ## Standard error with repmean() repmean(x = paste0("Math",1:5),wt = "wt",repwt = RW,df = repdata, method = "ICILS",PV = TRUE)# 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 # Non-PVs ---- ## Mean with total weights E0 <- stats::weighted.mean(x = repdata$item01, w = repdata$wt, na.rm = TRUE) E0 ## Means by replication ER <- as.vector(apply(RW,2,function(i){ stats::weighted.mean(x = repdata$item01, w = i, na.rm = TRUE) })) ER ## Standard error by hand repse(er = ER, e0 = E0, method = "ICILS") ## Standard error with repmean() repmean(x = "item01",wt = "wt",repwt = RW,df = repdata, method = "ICILS") # PVs ---- ## Mean with total weights E0 <- sapply(1:5,function(i){ stats::weighted.mean(x = repdata[,paste0("Math",i)], w = repdata$wt, na.rm = TRUE) }) E0 ## Means by replication ER <- lapply(1:5, function(j){ as.vector(apply(RW,2,function(i){ stats::weighted.mean(x = repdata[,paste0("Math",j)], w = i, na.rm = TRUE) })) }) ER ## Standard error by hand repse(er = ER, e0 = E0, method = "ICILS") ## Standard error with repmean() repmean(x = paste0("Math",1:5),wt = "wt",repwt = RW,df = repdata, method = "ICILS",PV = TRUE)
Creates a list with common arguments used for analysis with replicate weights.
repsetup( repwt = NULL, repindex = NULL, wt, df, method, group = NULL, exclude = NULL ) repsetupILSA( study, year, repwt = NULL, repindex = NULL, df, group = NULL, exclude = NULL )repsetup( repwt = NULL, repindex = NULL, wt, df, method, group = NULL, exclude = NULL ) repsetupILSA( study, year, repwt = NULL, repindex = NULL, df, group = NULL, exclude = NULL )
repwt |
a string indicating the common names for the replicate weights
columns (within |
repindex |
a |
wt |
a string specifying the name of the column (within |
df |
a data frame. |
method |
a string indicating the name of the replication method.
Available options are:
Note that |
group |
a string specifying the variable name (within |
exclude |
a vector indicating which groups
(in the same format as |
study |
a string indicating the study name. For checking available studies use
|
year |
a numeric value indicating the study year. For checking available
years use
|
a list to be used in other functions.
# 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 ---- stp1 <- repsetup(repwt = RW, wt = "wt", df = repdata, method = "ICILS") stp1 ### Groups ---- stp2 <- repsetup(repwt = RW, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", exclude = "GR2") stp2 ### repmean ---- repmean(x = "Math1",setup = stp1) repmean(x = "Math1",setup = stp2)# 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 ---- stp1 <- repsetup(repwt = RW, wt = "wt", df = repdata, method = "ICILS") stp1 ### Groups ---- stp2 <- repsetup(repwt = RW, wt = "wt", df = repdata, method = "ICILS", group = "GROUP", exclude = "GR2") stp2 ### repmean ---- repmean(x = "Math1",setup = stp1) repmean(x = "Math1",setup = stp2)
Random TIMSS 99 data with 3000 cases and 3 countries
Fits a linear mixed-effects model using mix and plausible values.
WeMixPV( formula, data = NULL, weights = NULL, pvs, relatedpvs = TRUE, barnardrubin = TRUE, ... )WeMixPV( formula, data = NULL, weights = NULL, pvs, relatedpvs = TRUE, barnardrubin = TRUE, ... )
formula |
a formula object in the style of |
data |
a data frame containing the raw data for the model. |
weights |
a character vector of names of weight variables found in the data frame starts with units (level 1) and increasing (larger groups). |
pvs |
a list indicating which variables from |
relatedpvs |
a logical value indicating if |
barnardrubin |
a logical value indicating if Barnard & Rubin adjustment
should be used for estimating the degrees of freedom. Default is |
... |
Arguments passed on to
|
a list.
# Prepare data weights repdata2 <- repdata repdata2$wt1 <- repdata2$wt # weight level 1 repdata2$wt2 <- 1 # weight level 2 # Null model - with PVs ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m1 <- WeMixPV(formula = MATH ~ 1 + (1|GROUP), # Intercept varies across GROUP pvs = pvs, # Named list data = repdata2, # Data frame weights = c("wt1","wt2")) # Weights vector m1 ## Fixed effects m1$fixef ## Random effects m1$ranef ## Models for each PV summary(m1$models) # Multiple regression ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m2 <- WeMixPV(formula = MATH ~ 1 + GENDER + SES + schoolSES + (1|GROUP), pvs = pvs, # Named list data = repdata2, # Data frame weights = c("wt1","wt2")) # Weights vector m2# Prepare data weights repdata2 <- repdata repdata2$wt1 <- repdata2$wt # weight level 1 repdata2$wt2 <- 1 # weight level 2 # Null model - with PVs ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m1 <- WeMixPV(formula = MATH ~ 1 + (1|GROUP), # Intercept varies across GROUP pvs = pvs, # Named list data = repdata2, # Data frame weights = c("wt1","wt2")) # Weights vector m1 ## Fixed effects m1$fixef ## Random effects m1$ranef ## Models for each PV summary(m1$models) # Multiple regression ## Named list, with element names matching formula variables pvs = list(MATH = paste0("Math",1:5)) m2 <- WeMixPV(formula = MATH ~ 1 + GENDER + SES + schoolSES + (1|GROUP), pvs = pvs, # Named list data = repdata2, # Data frame weights = c("wt1","wt2")) # Weights vector m2