repse | R Documentation |
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)
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 m
, for TIMSS
and ICILS: m = 0.5
; for ICILS and ICCS: m = 1
; and for PISA and TALIS:
\frac{1}{R(1-0.5)^2}
. Depending on the statistic, one of the following
formulas is used.
The standard error not involving plausible values is calculated by:
\sqrt{m\times \sum_{r=1}^{R}(\varepsilon_r-\varepsilon_0)^2}.
The standard error involving plausibles values and replicate weights is calculated by:
\sqrt{\left[ \sum_{p=1}^{P} \left( m\times \sum_{r=1}^{R}(\varepsilon_{rp}-\varepsilon_{0p})^2 \right) \dfrac{1}{P}\right]+ \left[ \left(1+ \dfrac{1}{P} \right) \dfrac{\sum_{p=1}^{P} (\varepsilon_{0p}-\overline{\varepsilon}_{0p})^{2}}{P-1} \right]}.
The standard error involving plausibles values without replicate weights is calculated by:
\sqrt{ \dfrac{\sum_{p=1}^{P} SE^2_{\varepsilon_{0P}}}{P}+ \left[ \left(1+ \dfrac{1}{P} \right) \dfrac{\sum_{p=1}^{P} (\varepsilon_{0p}-\overline{\varepsilon}_{0p})^{2}}{P-1} \right]}.
The standard error of the difference of
two statistics (a
and b
) from independent samples is calculated by:
\sqrt{SE_a^{2}+SE_b^{2}}.
The standard error of the difference of
two statistics (a
and b
) from dependent samples
not involving plausible values
is calculated by:
\sqrt{m\times \sum_{r=1}^R((a_r-b_r)-(a_0-b_0))^2}.
The standard error of the difference of
two statistics (a
and b
) from dependent samples
involving plausible values
is calculated by:
\sqrt{\left[ \sum_{p=1}^{P} \left( m\times \sum_{r=1}^{R}((a_{rp}-b_{rp})-(a_{0p}-b_{0p}))^2 \right) \dfrac{1}{P}\right]+ \left[ \left(1+ \dfrac{1}{P} \right) \dfrac{\sum_{p=1}^{P} \left((a_{0p}-b_{0p})- ( \overline{a}_{0p}-\overline{b}_{0p}) \right)^{2}}{P-1} \right]}.
The standard error of a composite estimate is calculated by:
\sqrt{\dfrac{\sum_{c=1}^CSE^2_{\varepsilon_c}}{C^{2}}}.
The standard error of the difference between an element (a
) of the composite
and the composite is calculated by:
\sqrt{\dfrac{\sum_{c=1}^CSE^2_{\varepsilon_c}}{C^{2}}+\left(\dfrac{(C-1)^2-1}{C^2}\right)SE^2_a}.
Where
\varepsilon
represents a statistic of interest,
the subindex 0
indicates an estimate using the total weights,
r
indicates a replicate from a total of R
,
p
indicates a plausible value from a total of P
,
and c
indicates an element in a composite estimate from value a total of C
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.