localDepTest | R Documentation |
The function ciTest
takes a 3-way contingency table and tests
for the conditional independence of the first two variables given the
third. The function localDepTest
is a wrapper which builds the
table from factor variables. In psychometrics, when the third
variable represents a latent proficiency and the first two item
responses, this is sometimes called local independence.
localDepTest(obs1, obs2, prof)
ciTest(tab)
obs1 |
A factor variable representing the first observable outcome. |
obs2 |
A factor variable representing the second observable outcome. |
prof |
A factor variable representing the proficiency level, or
any variable that is thought to render |
tab |
A three-way table (see |
Let 1 and 2 represent obs1
and obs2
respectively and let
3 represent prof
. In the case of ciTest
, 1, 2 and 3
represent the first second and 3rd dimensions of tab
. These
function then compare the undirected model [13][23] (1 and 2 are
conditionally independent given 3) to the unrestricted model [123].
The result is a chi-square statistic comparing the two models, high
values of the chi-square statistic indicate a better fit of the
unrestricted model compared to the conditional independence model.
Note that the Cochran-Mantel-Haenszel statistic (see
mantelhaen.test
) is similar, but it assumes that
there is no three-way interaction, so it essentially tests [13][23]
versus [12][13][23].
A list with three elements:
G2 |
The chi-square comparison between the two models. |
df |
The degrees of freedom for the test. |
p |
The percentage point for |
Russell Almond
Bishop, Feinberg and Holland (1975). Discrete Multivariate Analysis: Theory and Practice. MIT Press.
buildFactorTab
, mantelhaen.test
,
UCBAdmissions
data(UCBAdmissions)
ciTest(UCBAdmissions)
data(ACED)
ACED.items$Correct <- rowSums(ACED.items[,-(1:3)],na.rm=TRUE)
table(ACED.items$tCommonRatio1a,ACED.items$tCommonRatio2a,
cut(ACED.items$Correct,3))
localDepTest(ACED.items$tCommonRatio1a,ACED.items$tCommonRatio2a,
cut(ACED.items$Correct,3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.