margins | R Documentation |

Checks the fit on the two- and three-way margins for `grm`

, `ltm`

, `rasch`

and `tpm`

objects.

margins(object, ...) ## S3 method for class 'gpcm' margins(object, type = c("two-way", "three-way"), rule = 3.5, ...) ## S3 method for class 'grm' margins(object, type = c("two-way", "three-way"), rule = 3.5, ...) ## S3 method for class 'ltm' margins(object, type = c("two-way", "three-way"), rule = 3.5, nprint = 3, ...) ## S3 method for class 'rasch' margins(object, type = c("two-way", "three-way"), rule = 3.5, nprint = 3, ...) ## S3 method for class 'tpm' margins(object, type = c("two-way", "three-way"), rule = 3.5, nprint = 3, ...)

`object` |
an object inheriting either from class |

`type` |
the type of margins to be used. See |

`rule` |
the rule of thumb used in determining the indicative goodness-of-fit. |

`nprint` |
a numeric value determining the number of margins with the largest Chi-squared residuals
to be printed; only for |

`...` |
additional argument; currently none is used. |

Rather than looking at the whole set of response patterns, we can look at the two- and three-way margins.
For the former, we construct the *2 by 2* contingency tables obtained by taking
the variables two at a time. Comparing the observed and expected two-way margins is analogous to comparing
the observed and expected correlations when judging the fit of a factor analysis model. For Bernoulli and
Ordinal variates, the comparison is made using the so called Chi-squared residuals. As a rule of thumb residuals
greater than 3.5 are indicative of poor fit. For a more strict rule of thumb use the `rule`

argument.
The analogous procedure is followed for the three-way margins.

An object of either class `margins.ltm`

if `object`

inherits from class `ltm`

, class `rasch`

or class `tpm`

,
or an object of class `margins.grm`

if `object`

inherits from class `grm`

, with components,

`margins` |
for |

`type` |
the type of margins that were calculated. |

`nprint` |
the value of the |

`combs` |
all possible two- or three-way combinations of the items; returned only from |

`rule` |
the value of the |

`nitems` |
the number of items in |

`names` |
the names of items in |

`call` |
a copy of the matched call of |

Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl

Bartholomew, D. (1998) Scaling unobservable constructs in social science.
*Applied Statistics*, **47**, 1–13.

Bartholomew, D. and Knott, M. (1999) *Latent Variable Models
and Factor Analysis*, 2nd ed. London: Arnold.

Bartholomew, D., Steel, F., Moustaki, I. and Galbraith, J. (2002)
*The Analysis and Interpretation of Multivariate Data for
Social Scientists*. London: Chapman and Hall.

Rizopoulos, D. (2006) **ltm**: An R package for latent variable modelling and item response theory analyses.
*Journal of Statistical Software*, **17(5)**, 1–25. URL doi: 10.18637/jss.v017.i05

`person.fit`

,
`item.fit`

,
`GoF.rasch`

,

## Two- and Three-way residuals for the Rasch model fit <- rasch(LSAT) margins(fit) margins(fit, "three") ## Two- and Three-way residuals for the one-factor model fit <- ltm(WIRS ~ z1) margins(fit) margins(fit, "three") ## Two- and Three-way residuals for the graded response model fit <- grm(Science[c(1,3,4,7)]) margins(fit) margins(fit, "three")

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.