CAM: Conditional adjacency matrix (CAM) for dichotomously scored...

View source: R/CAM.R

CAMR Documentation

Conditional adjacency matrix (CAM) for dichotomously scored items.

Description

This function is used to calculate the conditional adjacency matrix (CAM) from a binary valued matrix with the responses of n individuals to N items (Post,1992). CAM in its (i,j)th element contains the conditional frequency that a subject from the sample will choose the row item i given that the column item j is chosen. The probability Pr(X_i=1 | X_j=1) is estimated from the data by dividing the joint frequency of choosing both items i and j by the relative frequency of choosing item j. Different orderings of the columns of the input matrix will result into different CAM matrices.

Usage

CAM(x)

Arguments

x

: A binary matrix or data frame containing the responses of nrow(data) persons to ncol(data) items. In this case, missing values in x are not allowed. Alternatively, x can be a fitted object of class "mdf" from the mudfold() function. Then the function will extract the CAM for the obtained MUDFOLD scale.

Details

It calculates the CAM based on the following equation,

{CAM}_{ij}=\ \frac{∑_{k=1}^n x_{ki} x_{kj} / n}{∑_{k=1}^n x_{kj} /n} = \frac{∑_{k=1}^n x_{ki} x_{kj} }{∑_{k=1}^n \ x_{kj} }, \ {for}\ i\neq j.

Value

A matrix of class 'cam.mdf', with ncol(x) rows and ncol(x) columns with missing values on the diagonal elements when x is a matrix or data frame. When x is an object of class "mdf" the dimension of the output matrix depends on the length of the obtained MUDFOLD scale. Rows and columns of the resulting CAM are ordered in the order of the columns of x when x is a matrix. When x is a fitted MUDFOLD object then the rows and columns of CAM are ordered in the obtained MUDFOLD order.

Author(s)

Spyros E. Balafas (s.balafas@rug.nl)

References

W.J. Post. (1992). Nonparametric Unfolding Models: A Latent Structure Approach. M & T series. DSWO Press.

W.J. Post. and T.AB. Snijders. (1993). Nonparametric unfolding models for dichotomous data. Methodika.

Examples

## load the ANDRICH data
data("ANDRICH")

## Calculate the CAM for the ANDRICH scale
CAM_andrch <- CAM(ANDRICH)

## Extract CAM from a fitted mudfold object 
mudf_andrich <- mudfold(ANDRICH)
CAM_andrch_mudfold <- CAM(mudf_andrich)

mudfold documentation built on Nov. 24, 2022, 5:09 p.m.