Title: | Weighted Rasch Modeling and Extensions using Conditional Maximum Likelihood |
---|---|
Description: | Rasch model and extensions for survey data, using Conditional Maximum likelihood (CML). Carlo Cafiero, Sara Viviani, Mark Nord (2018) <doi:10.1016/j.measurement.2017.10.065>. |
Authors: | Carlo Cafiero, Sara Viviani, Mark Nord |
Maintainer: | Sara Viviani <[email protected]> |
License: | GPL (>= 3.0.0) |
Version: | 2.0 |
Built: | 2025-02-12 04:41:07 UTC |
Source: | https://github.com/cran/RM.weights |
This package computes parameter estimates and assessment statistics of a single-parameter Rasch model for dichotomous and polytomous (partial credit) item responses using CML estimation, including optional use of sampling weights. Procedures to calculate prevalence rates of the phenomenon of interest (latent variable) and to equate item parameters across different contexts are implemented.
Package: | RM.weights |
Type: | Package |
Version: | 2.0 |
Date: | 2017-11-14 |
License: | GPL (>= 3) |
Carlo Cafiero, Mark Nord, Sara Viviani
Maintainer: Sara Viviani <[email protected]>
## Not run: data(data.FAO_country1_2013) # Questionnaire data and weights XX = data.FAO_country1_2013[,1:8] wt = data.FAO_country1_2013$wt # Fit weighted Rasch rr = RM.w(XX, wt) pp = prob.assign(rr, sthres = seq(-5, 5, 0.01)) ## End(Not run)
## Not run: data(data.FAO_country1_2013) # Questionnaire data and weights XX = data.FAO_country1_2013[,1:8] wt = data.FAO_country1_2013$wt # Fit weighted Rasch rr = RM.w(XX, wt) pp = prob.assign(rr, sthres = seq(-5, 5, 0.01)) ## End(Not run)
The dataset includes the FIES data (Food Insecurity Experience based Scale), sampling weights, and some demographic variables for a sample country (Country1). Data have been collected by the Gallup World Poll.
WORRIED |
FIES question n. 1. During the past 12 months, was there a time when you were worried you would run out of food because of lack of money or other resources? |
HEALTHY |
FIES question n. 2. During the past 12 months, was there a time when you were unable to eat healty and nutritious food because of lack of money or other resources? |
FEWFOOD |
FIES question n. 3. During the past 12 months, was there a time when you ate only few kinds of food because of lack of money or other resources? |
SKIPPED |
FIES question n. 4. During the past 12 months, was there a time when you had to skip a meal because of lack of money or other resources? |
ATELESS |
FIES question n. 5. During the past 12 months, was there a time when you ate less than you thought you should because of lack of money or other resources? |
RUNOUT |
FIES question n. 6. During the past 12 months, was there a time when your household ran out of food because of lack of money or other resources? |
HUNGRY |
FIES question n. 7. During the past 12 months, was there a time when you were hungry but did not eat because of lack of money or other resources? |
WHLDAY |
FIES question n. 8. During the past 12 months, was there a time when you went without eating for a whole day because of lack of money or other resources? |
gender |
Respondents' gender. |
age |
Respondents' age. |
education |
Respondents' education. |
urbanrural |
Respondents' area (urban or rural). |
wt |
Sampling weights. |
Sara Viviani [email protected]
## Not run: data(data.FAO_country1) # Matrix of questionnaire data and weights (for the Rasch analysis) XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt ## End(Not run)
## Not run: data(data.FAO_country1) # Matrix of questionnaire data and weights (for the Rasch analysis) XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt ## End(Not run)
The dataset includes the FIES data (Food Insecurity Experience based Scale), sampling weights, and some demographic variables for a sample country (Country2). Data have been collected by the Gallup World Poll.
WORRIED |
FIES question n. 1. During the past 12 months, was there a time when you were worried you would run out of food because of lack of money or other resources? |
HEALTHY |
FIES question n. 2. During the past 12 months, was there a time when you were unable to eat healty and nutritious food because of lack of money or other resources? |
FEWFOOD |
FIES question n. 3. During the past 12 months, was there a time when you ate only few kinds of food because of lack of money or other resources? |
SKIPPED |
FIES question n. 4. During the past 12 months, was there a time when you had to skip a meal because of lack of money or other resources? |
ATELESS |
FIES question n. 5. During the past 12 months, was there a time when you ate less than you thought you should because of lack of money or other resources? |
RUNOUT |
FIES question n. 6. During the past 12 months, was there a time when your household ran out of food because of lack of money or other resources? |
HUNGRY |
FIES question n. 7. During the past 12 months, was there a time when you were hungry but did not eat because of lack of money or other resources? |
WHLDAY |
FIES question n. 8. During the past 12 months, was there a time when you went without eating for a whole day because of lack of money or other resources? |
gender |
Respondents' gender. |
age |
Respondents' age. |
education |
Respondents' education. |
urbanrural |
Respondents' area (urban or rural). |
wt |
Sampling weights. |
Sara Viviani [email protected]
## Not run: data(data.FAO_country2) # Matrix of questionnaire data and weights (for the Rasch analysis) XX.country2 = data.FAO_country2[,1:8] wt.country2 = data.FAO_country2$wt ## End(Not run)
## Not run: data(data.FAO_country2) # Matrix of questionnaire data and weights (for the Rasch analysis) XX.country2 = data.FAO_country2[,1:8] wt.country2 = data.FAO_country2$wt ## End(Not run)
The dataset includes the FIES data (Food Insecurity Experience based Scale), sampling weights, and some demographic variables for a sample country (Country1). Data have been collected by the Gallup World Poll.
WORRIED |
FIES question n. 1. During the past 12 months, was there a time when you were worried you would run out of food because of lack of money or other resources? |
HEALTHY |
FIES question n. 2. During the past 12 months, was there a time when you were unable to eat healty and nutritious food because of lack of money or other resources? |
FEWFOOD |
FIES question n. 3. During the past 12 months, was there a time when you ate only few kinds of food because of lack of money or other resources? |
SKIPPED |
FIES question n. 4. During the past 12 months, was there a time when you had to skip a meal because of lack of money or other resources? |
ATELESS |
FIES question n. 5. During the past 12 months, was there a time when you ate less than you thought you should because of lack of money or other resources? |
RUNOUT |
FIES question n. 6. During the past 12 months, was there a time when your household ran out of food because of lack of money or other resources? |
HUNGRY |
FIES question n. 7. During the past 12 months, was there a time when you were hungry but did not eat because of lack of money or other resources? |
WHLDAY |
FIES question n. 8. During the past 12 months, was there a time when you went without eating for a whole day because of lack of money or other resources? |
gender |
Respondents' gender. |
age |
Respondents' age. |
education |
Respondents' education. |
urbanrural |
Respondents' area (urban or rural). |
wt |
Sampling weights. |
Sara Viviani [email protected]
## Not run: data(data.FAO_country3) # Matrix of questionnaire data and weights (for the Rasch analysis) XX.country3 = data.FAO_country3[,1:8] wt.country3 = data.FAO_country3$wt ## End(Not run)
## Not run: data(data.FAO_country3) # Matrix of questionnaire data and weights (for the Rasch analysis) XX.country3 = data.FAO_country3[,1:8] wt.country3 = data.FAO_country3$wt ## End(Not run)
The dataset includes the FIES data (Food Insecurity Experience based Scale), sampling weights, and some demographic variables for a sample country (Country4). Data have been collected by the Gallup World Poll.
WORRIED |
FIES question n. 1. During the past 12 months, was there a time when you were worried you would run out of food because of lack of money or other resources? |
HEALTHY |
FIES question n. 2. During the past 12 months, was there a time when you were unable to eat healty and nutritious food because of lack of money or other resources? |
FEWFOOD |
FIES question n. 3. During the past 12 months, was there a time when you ate only few kinds of food because of lack of money or other resources? |
SKIPPED |
FIES question n. 4. During the past 12 months, was there a time when you had to skip a meal because of lack of money or other resources? |
ATELESS |
FIES question n. 5. During the past 12 months, was there a time when you ate less than you thought you should because of lack of money or other resources? |
RUNOUT |
FIES question n. 6. During the past 12 months, was there a time when your household ran out of food because of lack of money or other resources? |
HUNGRY |
FIES question n. 7. During the past 12 months, was there a time when you were hungry but did not eat because of lack of money or other resources? |
WHLDAY |
FIES question n. 8. During the past 12 months, was there a time when you went without eating for a whole day because of lack of money or other resources? |
gender |
Respondents' gender. |
age |
Respondents' age. |
education |
Respondents' education. |
urbanrural |
Respondents' area (urban or rural). |
wt |
Sampling weights. |
Sara Viviani [email protected]
## Not run: data(data.FAO_country4) # Matrix of questionnaire data and weights (for the Rasch analysis) XX.country4 = data.FAO_country4[,1:8] wt.country4 = data.FAO_country4$wt ## End(Not run)
## Not run: data(data.FAO_country4) # Matrix of questionnaire data and weights (for the Rasch analysis) XX.country4 = data.FAO_country4[,1:8] wt.country4 = data.FAO_country4$wt ## End(Not run)
This function calibrates the measure derived by a scale applied in one context (for example, country) to the metric of a reference scale, or standard (for example, the scale applied in another country, or in the same country but through a different survey, or to any other standard). The main output is the prevalence rate in the country of interest calculated at specified thresholds along the latent trait.
equating.fun(rr1, st=NULL, tol = .35, spec.com1 = 1:8, spec.com2=1:8, thres = NULL, maxuniq=3, write.file=FALSE, plot=FALSE, iterative=TRUE, excl.prior1=NULL, excl.prior2=NULL, wt.spec=NULL)
equating.fun(rr1, st=NULL, tol = .35, spec.com1 = 1:8, spec.com2=1:8, thres = NULL, maxuniq=3, write.file=FALSE, plot=FALSE, iterative=TRUE, excl.prior1=NULL, excl.prior2=NULL, wt.spec=NULL)
rr1 |
The Rasch model fitted with the |
st |
Item severity parameter estimates for the reference country or the standard. The number of items for the standard may differ from the number of items of the country of interest. If left unspecified, the 2014-2016 FAO global standard for the Food Insecurity Experience Scale (FIES) is set as default. |
tol |
Tolerance expressed in the metric of the standard, above which items are considered unique (i.e. not contributing to the common metric between the two countries). Default is |
spec.com1 |
A priori numbered set of comparable items for the country of iterest to the standard. Items must be specified in the same order as they are used for the comparison. |
spec.com2 |
A priori set of comparable items for the standard. The length of |
thres |
Thresholds (along the latent trait) corresponding to which the comparable prevalence rates of the phenomenon of interest is calculated. Default is set to the 5-th
and the 8-th item of the standard specified in |
maxuniq |
A priori maximum number of unique items allowed. |
write.file |
Logical argument. If |
plot |
Logical argument. If |
iterative |
Logical argument. If |
excl.prior1 |
Numbered set of fixed unique items for the country of interest. It needs to be specified only if |
excl.prior2 |
Numbered set of fixed unique items for the standard. It needs to be specified only if |
wt.spec |
Specified post-stratification sampling weights. If left unspecified, prevalence rates will be calculated using the weighting variable |
scale |
Scale parameter to be applied to the metric of the country of interest to be considered equivalent to the standard. |
shift |
Shift parameter to be applied to the metric of the country of interest to be considered equivalent to the reference country. The standardized item parameters for the country of interest will be: b.country.st=shift+scale*b.country where b.country are estimated item severities for the country of interest. |
common |
Vector of characters indicating if the item in the country of interest is common compared with the standard. |
prevs |
Prevalence rates for the country of interest, calculated at the adjusted thresholds. |
probs.rs |
Probability of being bejond the adjusted thresholds calculated at each raw score. |
cor.comm.items |
Correlation between common items. |
adj.thres |
Adjusted (equated) thresholds on the country metric. |
standard |
The standard against which the country is compared. If the |
Sara Viviani [email protected]
prob.assign
data(data.FAO_country1) XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt rr1=RM.w(XX.country1, wt.country1) data(data.FAO_country2) XX.country2 = data.FAO_country2[,1:8] wt.country2 = data.FAO_country2$wt rr2=RM.w(XX.country2, wt.country2) # Iterative equating ee1=equating.fun(rr1, st=rr2$b, thres=c(-0.28, 1.85), spec.com1=c(1:8),spec.com2=c(1:8)) # Not iterative equating: fixing WORRIED unique ee2=equating.fun(rr1, st=rr2$b, thres=c(-0.28, 1.85),spec.com1=c(1:8), spec.com2=c(1:8), tol = .4,iterative=FALSE,excl.prior1=1,excl.prior2=1) # Prevalence rates ee1$prevs ee2$prevs
data(data.FAO_country1) XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt rr1=RM.w(XX.country1, wt.country1) data(data.FAO_country2) XX.country2 = data.FAO_country2[,1:8] wt.country2 = data.FAO_country2$wt rr2=RM.w(XX.country2, wt.country2) # Iterative equating ee1=equating.fun(rr1, st=rr2$b, thres=c(-0.28, 1.85), spec.com1=c(1:8),spec.com2=c(1:8)) # Not iterative equating: fixing WORRIED unique ee2=equating.fun(rr1, st=rr2$b, thres=c(-0.28, 1.85),spec.com1=c(1:8), spec.com2=c(1:8), tol = .4,iterative=FALSE,excl.prior1=1,excl.prior2=1) # Prevalence rates ee1$prevs ee2$prevs
This function performs a Wald test of sampling independence on item severity parameters.
EWaldtest(b1, b2, se1, se2)
EWaldtest(b1, b2, se1, se2)
b1 |
Item severity vector estimated on the first sample subset. |
b2 |
Item severity vector estimated on the second sample subset (complementary to the one used to estimate |
se1 |
Item standard errors (first sub-sample). |
se2 |
Item standard errors (second sub-sample). |
This function computes the Wald test to check if the sampling independence assumption holds. The test statistics is
where and
are the ML item parameter estimates computed on two, randomly extracted and complementary, sub-samples of the overall sample, and
and
the corresponding variances.
The null hypothesis is of parameter estimates equality while the alternative hypothesis is bilateral ().
The sampling independence assumption implies that item severity parameter estimates do not depend on the analysed samples, but only on the severity of the items themselves. One way to check for this assumption is to extract two (complementary) random samples from the original sample and run the Wald test, or, more accurately, to extract B
random sub-samples and observe the p-values distribution for each item.
A list with the following elements:
z |
The z-statistics of the Wald test. |
p |
Computed p-value of the Wald test. |
tab |
Descriptive table with test results. |
Sara Viviani [email protected]
data(data.FAO_country3) # Questionnaire data and weights XX.country3 = data.FAO_country3[,1:8] wt.country3 = data.FAO_country3$wt # Split the sample in two random sub-samples n = nrow(XX.country3) samp1 = sample(1:n, n/2) samp2 = setdiff(1:n, samp1) # Fit two Rasch models on the two sub-samples rr1 = RM.w(XX.country3[samp1, ], wt.country3[samp1]) rr2 = RM.w(XX.country3[samp2, ], wt.country3[samp2]) # Test sampling independence EWaldtest(rr1$b, rr2$b, rr1$se.b, rr2$se.b)$tab
data(data.FAO_country3) # Questionnaire data and weights XX.country3 = data.FAO_country3[,1:8] wt.country3 = data.FAO_country3$wt # Split the sample in two random sub-samples n = nrow(XX.country3) samp1 = sample(1:n, n/2) samp2 = setdiff(1:n, samp1) # Fit two Rasch models on the two sub-samples rr1 = RM.w(XX.country3[samp1, ], wt.country3[samp1]) rr2 = RM.w(XX.country3[samp2, ], wt.country3[samp2]) # Test sampling independence EWaldtest(rr1$b, rr2$b, rr1$se.b, rr2$se.b)$tab
Computation and plotting of item caracteristic curves (ICCs) under conditional maximum likelihood (CML).
ICC.fun(b, plot = FALSE)
ICC.fun(b, plot = FALSE)
b |
Item severity vector estimated under CML. |
plot |
Logical. If |
icc |
Matrix of item characteristic curves. Coloumns are items and rows are severity levels. |
Sara Viviani [email protected]
data(data.FAO_country2) # Questionnaire data and weights XX.country2 = data.FAO_country2[,1:8] wt.country2 = data.FAO_country2$wt # Fit weighted Rasch rr.country2 = RM.w(XX.country2, wt.country2) b=rr.country2$b # ICC values icc = ICC.fun(b)$icc # ICC plot icc = ICC.fun(b, plot = TRUE)
data(data.FAO_country2) # Questionnaire data and weights XX.country2 = data.FAO_country2[,1:8] wt.country2 = data.FAO_country2$wt # Fit weighted Rasch rr.country2 = RM.w(XX.country2, wt.country2) b=rr.country2$b # ICC values icc = ICC.fun(b)$icc # ICC plot icc = ICC.fun(b, plot = TRUE)
This function estimates item and raw score parameters of a partial credit Rasch model which may include both dichotomous and polytomous item responses by using weighted CML estimation. The maximum number of response categories allowed is 4. Input data should be a 0/1 matrix (1 = Yes) for the dichotomous items and 0/1/2 or 0/1/2/3 for the polytomous items. Residual correlation, fit statistics and Rasch reliability are also reported.
PC.w(XX, wt=NULL, extr=NULL, maxiter=100,minconv=.00001,country=NULL, write.file=FALSE, recode = 0, write.iteration=FALSE)
PC.w(XX, wt=NULL, extr=NULL, maxiter=100,minconv=.00001,country=NULL, write.file=FALSE, recode = 0, write.iteration=FALSE)
XX |
Input data matrix or data frame. Rows represent respondents, columns represent items. Dichotomous items are coded 0/1, polytomous items are coded 0/1/2 or 0/1/2/3; negative responses must be coded as 0s. Missing values must be coded as |
wt |
Vector of sampling weights.
The length must be the same as the number of rows of |
extr |
Optional vector for the assumption on the extreme raw score parameters. Default is |
maxiter |
Maximum number of iterations for convergence when parameter estimation is performed. |
minconv |
Minimum difference between parameter estimates considering two consecutive iterations for convergence. |
country |
Optional (character) name of the dataset. |
write.file |
If |
recode |
It can be 0, 1, 2 or 3. |
write.iteration |
If set |
The weighted CML method is used to estimate the item and Rasch-Thurstone parameters. Respondent parameters are estimated post-hoc as maximum likelihood given the item parameters. Cases with missing responses to some items can be included, but will not be used to estimate the Rasch model. Missing responses should be coded as NA
in the input data file. If the total possible raw score is higher than 15, computer precision limits may distort results.
As the parameters for the extreme raw scores (0
and k
), are undefined under the CML, some assumptions are needed unless the proportions of respondents with those raw scores are so small that they can be considered to be measured without error.
Vector extr
gives the option to include one assumption on the pseudo-raw-score on which raw score zero will be based and one assumption on the pseudo-raw-score on which raw score k
will be based. The assumption for raw score zero can be a number between 0 and 1 (extremes excluded). The assumption for raw score k
can be a number between k-1
and k
(extremes excluded).
A list with the following elements:
b |
Matrix of Rasch-Thurstone (R-T) thresholds (corresponding to item severity parameters in a Rasch model for dichotomous data). |
se.b |
Matrix of standard errors for R-T thresholds. |
infit |
Infit statistics corresponding to each R-T threshold. |
outfit |
Outfit statistics corresponding to each R-T threshold. |
reliab |
Rasch reliability. |
reliab.fl |
Rasch reliability (equally weighted across raw scores). To be used for comparisons. |
RS_distr |
Distribution of cases across raw scores (weighted and unweighted). |
res.cor |
Matrix of residual correlation. |
a |
Vector of raw score parameters. |
se.a |
Vector of raw score parameter errors (or measurement errors). |
XX |
Data matrix (after recoding). |
wt |
Vector of sampling weights. |
d |
Pseudo-raw-scores used for the estimation of extreme parameters. |
N_valid_w |
Number of cases with any valid response. |
Perc_valid_w |
Percentage of cases with any valid response. |
N_tot |
Total sample size. |
N_compl |
Number of complete non-extreme cases. |
Sara Viviani [email protected], Mark Nord [email protected]
data(data.FAO_country1) # Questionnaire data and weights XX.country1 = data.FAO_country1[,1:8] XX.country1[,c(7,8)] = cbind(rbinom(nrow(XX.country1), 3, .5), rbinom(nrow(XX.country1), 3, .4)) wt.country1 = data.FAO_country1$wt # Fit weighted partial credit model with aggregation of the two more severe categories rr.country1.pol2 = PC.w(XX.country1, wt.country1, recode = 1)
data(data.FAO_country1) # Questionnaire data and weights XX.country1 = data.FAO_country1[,1:8] XX.country1[,c(7,8)] = cbind(rbinom(nrow(XX.country1), 3, .5), rbinom(nrow(XX.country1), 3, .4)) wt.country1 = data.FAO_country1$wt # Fit weighted partial credit model with aggregation of the two more severe categories rr.country1.pol2 = PC.w(XX.country1, wt.country1, recode = 1)
This function assigns cases probabilistically to classes of severity along the latent trait. This procedure is useful when different (cultural-geographical-linguistic) contexts are compared in terms of the prevalence of some phenomenon.
prob.assign(rr=NULL, rwthres = NULL, sthres = NULL, eps.a = NULL, flex = list(a=NULL, se.a=NULL, d=NULL, XX=NULL, wt=NULL))
prob.assign(rr=NULL, rwthres = NULL, sthres = NULL, eps.a = NULL, flex = list(a=NULL, se.a=NULL, d=NULL, XX=NULL, wt=NULL))
rr |
An object of |
rwthres |
Raw score thresholds. If this argument is specified, corresponding thresholds on the latent trait ( |
sthres |
Alternative argument to |
eps.a |
Tolerance for the algorithm that estimates thresholds on the latent trait corresponding to the specified thresholds in terms of raw score ( |
flex |
Alternative argument to |
The probabilistic assignment procedure is particularly useful when comparing results between different populations that might have interpreted some items of a scale differently. The distribution of the raw score is assumed to be a mixture of Gaussian densities, each centred on the raw score parameters (estimated using the Rasch model) and scaled with corresponding measurement errors. The resulting (complementary) cumulative prevalence, weighted by the proportion of individuals in each raw score, is as follows:
where is the probability density function (and
is the cumulative distribution function) of severity levels centred on raw score parameter
and scaled with the corresponding measurement error,
is the proportion observed in raw score
, and
is the maximum number of items. The function
can be used to trace a continuous profile of prevalence on the latent trait for the phenomenon of interest. It allows to equate different metrics and it facilitates cross-cultural comparisons.
The
prob.assign
function can be used in two ways: providing the rwthres
argument, i.e. specifying thresholds in terms of raw score, it provides the estimation of the thresholds on the latent trait that correspond to the raw score thresholds; providing the sthres
argument, i.e. specifying thresholds on the latent trait, it provides the probability of being beyond the specified thresholds for the population of interest.
A list with the following elements:
sprob |
Estimated weighted probability of being beyond thresholds provided in sthres ( ). If sthres argument is not specified, the sprob value is NULL . |
thres |
Thresholds on the latent trait calculated corresponding to thresholds in terms of raw-score specified in rwthres . |
f |
Probability of being beyond the thres thresholds distributed across raw scores. If more than one assumption on the exreme raw scores is made in rr , it is a list of a number of elements equal to the number of assumptions made. |
p |
Empirical (weighted) distribution beyond the raw scores specified in rwthres . If only one assumption on the extreme raw scores is made, then
colSums(f) is approximately equal to p , where the order of approximation depends on
eps.a . |
f_j |
Empirical (weighted) distribution across the raw scores. |
Sara Viviani [email protected], Mark Nord [email protected]
data(data.FAO_country1) # Questionnaire data and weights XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt # Fit weighted Rasch rr.country1 = RM.w(XX.country1, wt.country1) # Thresholds on the latent trait corresponding to a given raw score pp.country1 = prob.assign(rr.country1, rwthres = c(3, 7)) # Table with prevalences and thresholds tab = cbind("Raw score" = c(3, 7), "Latent trait" = pp.country1$thres, "Prevalence" = colSums(pp.country1$f)) rownames(tab) = c("Thres 1","Thres 2") tab # Pre-defined thresholds on the latent trait sthresh = c(-0.25, 1.81) pp.country1.2 = prob.assign(rr.country1, sthres = sthresh)$sprob # Probability of being beyond -0.25 on the latent trait in country 1 pp.country1.2[1]*100 # Probability of being beyond 1.81 on the latent trait in country 1 pp.country1.2[2]*100 # More than 2 extremes # Fit the model rr.country1.d = RM.w(XX.country1, wt.country1, .d = c(0.5, 7.5, 7.7)) # Probabilistic assignment pp.country1.d = prob.assign(rr.country1.d, sthres = sthresh)$sprob # Probability of being beyond -0.25 on the latent trait in country 1 # using upper assumption on the extreme raw score parameter 8 pp.country1.d[[1]]*100 # Probability of being beyond -0.25 on the latent trait in country 1 # using lower assumption on the extreme raw score parameter 8 pp.country1.d[[2]]*100
data(data.FAO_country1) # Questionnaire data and weights XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt # Fit weighted Rasch rr.country1 = RM.w(XX.country1, wt.country1) # Thresholds on the latent trait corresponding to a given raw score pp.country1 = prob.assign(rr.country1, rwthres = c(3, 7)) # Table with prevalences and thresholds tab = cbind("Raw score" = c(3, 7), "Latent trait" = pp.country1$thres, "Prevalence" = colSums(pp.country1$f)) rownames(tab) = c("Thres 1","Thres 2") tab # Pre-defined thresholds on the latent trait sthresh = c(-0.25, 1.81) pp.country1.2 = prob.assign(rr.country1, sthres = sthresh)$sprob # Probability of being beyond -0.25 on the latent trait in country 1 pp.country1.2[1]*100 # Probability of being beyond 1.81 on the latent trait in country 1 pp.country1.2[2]*100 # More than 2 extremes # Fit the model rr.country1.d = RM.w(XX.country1, wt.country1, .d = c(0.5, 7.5, 7.7)) # Probabilistic assignment pp.country1.d = prob.assign(rr.country1.d, sthres = sthresh)$sprob # Probability of being beyond -0.25 on the latent trait in country 1 # using upper assumption on the extreme raw score parameter 8 pp.country1.d[[1]]*100 # Probability of being beyond -0.25 on the latent trait in country 1 # using lower assumption on the extreme raw score parameter 8 pp.country1.d[[2]]*100
This function computes item and raw score parameter estimates of a Rasch model for binary item responses by using weighted CML estimation. Input data should be a 0/1 matrix (1 = Yes). Residual correlation, fit statistics and corresponding standard errors, Rasch reliability and individual fit statistics are also reported.
RM.w(.data, .w = NULL, .d=NULL, country=NULL, se.control = TRUE, quantile.seq = NULL, write.file = FALSE, max.it=100)
RM.w(.data, .w = NULL, .d=NULL, country=NULL, se.control = TRUE, quantile.seq = NULL, write.file = FALSE, max.it=100)
.data |
Input 0/1 data matrix or data frame;
affirmative responses must be coded as 1s. Rows represent respondents, columns represent items. Missing values must be coded as |
.w |
Vector of sampling weights.
The length must be the same as the number of rows of |
.d |
Optional vector for the assumption on the extreme raw score parameters.
Default is |
country |
Optional (character) name of the dataset. |
se.control |
Are the measurement errors for respondent extreme parameters to be calculated based on raw scores |
quantile.seq |
Quantiles corresponding to the observed and the expected
individual fit statistic distributions. Default is |
write.file |
If |
max.it |
Maximum number of iterations item parameters' estimation. |
The weighted CML method is used to estimate the item parameters. Respondent parameters are estimated post-hoc as maximum likelihood given the item parameters. Cases with missing responses to some items can be included in the input data, but will not be used to estimate the Rasch model. Missing responses should be coded as NA
in the input data file.
As the parameters for the extreme raw scores (0
and k
), are undefined under the CML, some assumptions are needed unless the proportions of respondents with those raw scores are so small that they can be considered to be measured without error.
Vector .d
gives the option to include up to four alternative assumptions on the pseudo-raw-scores on which calculation of parameters for extreme raw scores will be based. More in detail, .d
can be a two, three or four element vector:
If length(.d) = 4
, then the first two elements must refer to the assumptions for raw score 0, and the second two elements for raw score k
. For instance .d = c(0.1, 0.7, 7.1, 7.6)
, if the maximum raw score is 8.
If length(.d) = 3
, then the first two elements can either refer to the assumptions upon raw score 0
or raw score k
, and the last one is defined accordingly. For instance .d = c(0.1, 7.1, 7.6)
or .d = c(0.1, 0.7, 7.6)
, if the maximum raw score is 8.
If length(.d) = 2
, then the first element must refer to the assumption for raw score 0
, and the second element for raw score k
. For instance .d = c(0.1, 7.6)
, if the maximum raw score is 8.
A list with the following elements:
country |
Name of the country or the application. |
b |
Item severity parameters. |
a |
Raw score severity parameters. |
se.b |
Item severities' standard error. |
se.a |
Raw score parameters' standard error. |
infit |
Items' infit statistics. |
outfit |
Items' outfit statistics. |
reliab |
Rasch reliability. |
reliab.fl |
Rasch reliability (equally weighted across raw scores). |
infit.person |
Respondents' infits. |
outfit.person |
Respondents' outfits. |
q.infit.theor |
Quintiles of theoretical person infits. |
q.infit |
Quintiles of person infits. |
q.outfit.theor |
Quintiles of theoretical person outfits. |
q.outfit |
Quintiles of person outfits. |
res.corr |
Residual correlation matrix. |
se.infit |
Standard errors of infits. |
mat.res |
Matrix of individual residuals for each item. |
d |
Pseudo raw scores for the calculation of extreme raw score parameters. |
XX |
Data matrix. |
wt |
Vector of post-stratification sampling weights. |
n.compl |
Number of complete, non-extreme cases. |
wt.rs |
Weighted (absolute) distribution of respondents across raw scores. |
wt.rs |
Weighted (relative) distribution of respondents across raw scores. |
converged |
Character indicating if the item estimation algorithm has reached convergence or the maximum number of iterations has been reached without convergence. |
Sara Viviani [email protected], Mark Nord [email protected]
data(data.FAO_country1) # Questionnaire data and weights XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt # Fit weighted Rasch rr.country1 = RM.w(XX.country1, wt.country1) # Fit unweighted Rasch rr.country1.nw = RM.w(XX.country1) # Item severity rr.country1$b # Item standard error rr.country1$se.b # Respondent severity for each raw score rr.country1$a # Respondent measurement error for each raw score rr.country1$se.a # Item infit rr.country1$infit # Item outfit rr.country1$outfit # Rasch reliability based on observed distribution of cases across raw scores rr.country1$reliab # Rasch reliability based on equal proportion of cases in each # non-extreme raw score (more comparable across datasets) rr.country1$reliab.fl # Checking conditional independence: residual correlation matrix rr.country1$res.cor
data(data.FAO_country1) # Questionnaire data and weights XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt # Fit weighted Rasch rr.country1 = RM.w(XX.country1, wt.country1) # Fit unweighted Rasch rr.country1.nw = RM.w(XX.country1) # Item severity rr.country1$b # Item standard error rr.country1$se.b # Respondent severity for each raw score rr.country1$a # Respondent measurement error for each raw score rr.country1$se.a # Item infit rr.country1$infit # Item outfit rr.country1$outfit # Rasch reliability based on observed distribution of cases across raw scores rr.country1$reliab # Rasch reliability based on equal proportion of cases in each # non-extreme raw score (more comparable across datasets) rr.country1$reliab.fl # Checking conditional independence: residual correlation matrix rr.country1$res.cor
Computes the Rasch-Thurstone thresholds for the CML estimation, starting from Rasch thresholds of a trichotomous scale.
RT.thres(R.thres)
RT.thres(R.thres)
R.thres |
Vector of rasch thresholds of a trichotomous scale, i.e. points on the latent trait corresponding to which the caracteristic curves of two consecutive categories cross. |
The Rasch-Thurstone (R-T) threshold for a given response category of an item is defined as the point on the latent trait at which the combined probability of response in that category and all more severe categories is .5. Conceptually, an R-T threshold for a given response category for a trichotomous item is comparable with the item severity parameter estimated for a dichotomous item coded 1 for that and all more severe categories and 0 for all less severe categories.
A list with the following elements:
b1.rt |
R-T threshold for the first category. |
b2.rt |
R-T threshold for the second category. |
b12.rt |
Vector of R-T thresholds for the first and second category. |
Sara Viviani [email protected], Mark Nord [email protected]
This function computes the main descriptive tables (number of affirmative responses to each item, weighted and unweighted distribution across raw scores, etc.), weighted and unweighted, for Rasch scale items and respondents. It also computes (univariate or bivariate) tables for user-specified variables.
tab.weight(variab, wt, XX = NULL)
tab.weight(variab, wt, XX = NULL)
variab |
It could be a single variable, or a list of two variables,
of |
wt |
Vector of sampling weights. |
XX |
0/1 data matrix or data frame of responses to the questionnaire. Affirmative responses must be coded as 1s. If left unspecified, basic descriptive statistics for Rasch analysis (number of Yes per item, weighted and unweighted distribution across raw scores, etc.) are not computed. |
RS.abs.w |
Absolute weighted distribution across raw scores. Only computed when |
RS.rel.w |
Relative weighted distribution across raw scores. Only computed when |
RS.abs |
Absolute unweighted distribution across raw scores. Only computed when |
RS.rel |
Relative unweighted distribution across raw scores. Only computed when |
Perc.Yes |
Proportion of Yes responses to each item. Only computed when |
Perc.Yes.w |
Weighted proportion of Yes responses to each item. Only computed when |
rv |
Vector of raw scores. |
tab.ext.w |
Weighted table for the variable |
Sara Viviani [email protected]
data(data.FAO_country1) XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt gender = data.FAO_country1$gender urbanrural = data.FAO_country1$urbanrural # Univariate weighted table by gender tab.weight(gender, wt.country1)$tab.ext.w # Bivariate weighted table by gender and urban/rural tab.weight(list(gender,urbanrural), wt.country1)$tab.ext.w # Fit Rasch descriptives fit.descr = tab.weight(wt = wt.country1, XX = XX.country1) # Weighted distribution across raw-scores (absolute and relative) cbind("Abs.RS distrib." = fit.descr$RS.abs.w, "Rel.RS distrib." = fit.descr$RS.rel.w) # Weighted and unweighted percentage of Yes per item cbind("Weighted perc. of Yes" = fit.descr$Perc.Yes.w, "Unweighted perc. of Yes" = fit.descr$Perc.Yes)
data(data.FAO_country1) XX.country1 = data.FAO_country1[,1:8] wt.country1 = data.FAO_country1$wt gender = data.FAO_country1$gender urbanrural = data.FAO_country1$urbanrural # Univariate weighted table by gender tab.weight(gender, wt.country1)$tab.ext.w # Bivariate weighted table by gender and urban/rural tab.weight(list(gender,urbanrural), wt.country1)$tab.ext.w # Fit Rasch descriptives fit.descr = tab.weight(wt = wt.country1, XX = XX.country1) # Weighted distribution across raw-scores (absolute and relative) cbind("Abs.RS distrib." = fit.descr$RS.abs.w, "Rel.RS distrib." = fit.descr$RS.rel.w) # Weighted and unweighted percentage of Yes per item cbind("Weighted perc. of Yes" = fit.descr$Perc.Yes.w, "Unweighted perc. of Yes" = fit.descr$Perc.Yes)