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]
|
Maintainer: | Andrés Christiansen <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.3.7 |
Built: | 2025-02-21 13:29:13 UTC |
Source: | CRAN |
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)
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, ... )
lmerPV( formula, data = NULL, weights = NULL, pvs, relatedpvs = TRUE, grandmean = NULL, groupmean = NULL, group = NULL, nullmodel = FALSE, ... )
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. |
... |
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
Creates replicate weights given jackknife replicates and jackknife zones.
repcreate( df, wt, jkzone, jkrep, repwtname, reps = NULL, method = c("TIMSS", "PIRLS", "ICILS", "ICCS") )
repcreate( df, wt, jkzone, jkrep, repwtname, reps = NULL, method = c("TIMSS", "PIRLS", "ICILS", "ICCS") )
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 large-scale assessment
to determine the replication method to use. Available options are:
|
a data frame.
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 = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS") )
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 = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS") )
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 large-scale assessment
to determine the replication method to use. Available options are:
|
a list with the standard errors and the total weights models.
# 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
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 = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS") )
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 = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS") )
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 large-scale assessment
to determine the replication method to use. Available 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, wt, df, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), var = c("unbiased", "ML"), group = NULL, by = NULL, exclude = NULL, zones = NULL )
repmean( x, PV = FALSE, setup = NULL, repwt, wt, df, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), var = c("unbiased", "ML"), group = NULL, by = NULL, exclude = NULL, zones = NULL )
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 |
wt |
a string specifying the name of the column (within |
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:
|
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 |
zones |
a string specifying the name of the variable containing the
replicate zones.
Used for calculating the number of zones to be used by variable and group.
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",zones = "jkzones") # One variable - weights as a separate data frame repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML",zones = "jkzones") # Multiple variables repmean(x = c("item01","item02","item03"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML",zones = "jkzones") # 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",zones = "jkzones") ### Groups ---- # One variable repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones") # One variable - weights as a separate data frame repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML",zones = "jkzones") # Multiple variables repmean(x = c("item01","item02","item03"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML",zones = "jkzones") # 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",zones = "jkzones") ### Groups ---- # One variable repmean(x = c("item01"), PV = FALSE, repwt = RW, wt = "wt", df = repdata, method = "ICILS",var = "ML",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", group = "GROUP", by = "GENDER", # results will be separated by GENDER exclude = "GR2") # GR2 will not be used for Pooled nor Composite
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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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",zones = "jkzones", 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, wt, df, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), group = NULL, exclude = NULL )
repprop( x, categories = NULL, setup = NULL, repwt, wt, df, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), group = NULL, exclude = NULL )
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 |
wt |
a string specifying the name of the column (within |
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:
|
group |
a string specifying the variable name (within |
exclude |
a vector indicating which groups
(in the same format as |
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")
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), PV = FALSE, setup = NULL, repwt, wt, df, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), group = NULL, by = NULL, exclude = NULL )
repquant( x, qtl = c(0.05, 0.25, 0.75, 0.95), PV = FALSE, setup = NULL, repwt, wt, df, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), 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). |
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 |
wt |
a string specifying the name of the column (within |
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:
|
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), PV = FALSE, 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), PV = FALSE, 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), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables 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), PV = FALSE, 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), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables 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), PV = FALSE, 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), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables 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
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), PV = FALSE, 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), PV = FALSE, 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), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables 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), PV = FALSE, 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), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables 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), PV = FALSE, 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), PV = TRUE, # if set to TRUE, PVs will be treated as separate variables 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 = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), group = NULL, exclude = NULL )
reprho( x = NULL, pv = NULL, pv2 = NULL, relatedpvs = TRUE, setup = NULL, repwt, wt, df, rho = c("pearson", "spearman", "polychoric"), method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), group = NULL, exclude = NULL )
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 in |
df |
a data frame. |
rho |
a string indicating the correlation coefficient to be computed:
|
method |
a string indicating the name of the large-scale assessment to
determine the replication method to use. Available options are:
|
group |
a string specifying the variable name (within |
exclude |
a vector indicating which groups (in the same format as |
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 = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS") ) repsecomp(se) pvse(PVse, PVe0, df = FALSE)
repse( er, e0, setup = NULL, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS") ) repsecomp(se) pvse(PVse, PVe0, df = FALSE)
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 large-scale assessment
to determine the replication method to use. Available options are:
|
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. |
The standard errors are calculated using a modifier , for TIMSS
and ICILS:
; for ICILS and ICCS:
; and for PISA and TALIS:
. 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, wt, df, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), group = NULL, exclude = NULL )
repsetup( repwt, wt, df, method = c("TIMSS", "PIRLS", "ICILS", "ICCS", "PISA", "TALIS"), group = NULL, exclude = NULL )
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 large-scale assessment
to determine the replication method to use. Available options are:
|
group |
a string specifying the variable name (within |
exclude |
a vector indicating which groups
(in the same format as |
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)
Fits a linear mixed-effects model using mix and plausible values.
WeMixPV(formula, data = NULL, weights = NULL, pvs, relatedpvs = TRUE, ...)
WeMixPV(formula, data = NULL, weights = NULL, pvs, relatedpvs = 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 |
... |
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