Fit Birnbaum's three parameter model under the Item Response Theory approach.

```
tpm(data, type = c("latent.trait", "rasch"), constraint = NULL,
max.guessing = 1, IRT.param = TRUE, start.val = NULL,
na.action = NULL, control = list())
```

data

a `data.frame`

(that will be converted to a numeric matrix using
`data.matrix()`

) or a numeric `matrix`

of manifest variables.

type

a character string indicating the type of model to fit. Available options are `rasch' that assumes equal discrimination parameter among items, and `latent.trait' (default) that assumes a different discrimination parameter per item.

constraint

a three-column numeric matrix specifying fixed-value constraints. The first column represents
the item (i.e., \(1\) denotes the first item, \(2\) the second, etc.); the second column denotes the type
of parameter to fix for the item specified in the first column (i.e., \(1\) denotes the guessing parameters,
\(2\) the easiness parameters, and \(3\) the discrimination parameters); the third column specifies the value
at which the corresponding parameter should be fixed. See **Examples** for more info.

max.guessing

a scalar between 0 and 1 denoting the upper bound for the guessing parameters.

IRT.param

logical; if `TRUE`

then the coefficients' estimates are reported under the
usual IRT parameterization. See **Details** for more info.

start.val

the character string "random" or a numeric matrix supplying starting values with \(p\) rows and
3 columns, with \(p\) denoting the number of items. If `NULL`

starting values are automatically computed.
If "random", random starting values are used. If a matrix, then the first column should contain the guessing
parameter, the second \(\beta_{1i}\), and the third \(\beta_{2i}\) (see **Details**).
If `type == "rasch"`

, then the third should contain the same number \(p\) times.

na.action

the `na.action`

to be used on `data`

. In case of missing data, if
`na.action = NULL`

the model uses the available cases, i.e., it takes into account the observed
part of sample units with missing values (valid under MAR mechanisms if the model is correctly specified).
If you want to apply a complete case analysis then use `na.action = na.exclude`

.

control

a list of control values with elements,

- optimizer
a character string denoting the optimizer to use, either

`"optim"`

(default) or`"nlminb"`

.- iter.qN
scalar denoting the number of iterations in the optimization procedure. For

`optim()`

this is passed to the control argument `maxit', whereas for`nlminb()`

this is passed to both control arguments `iter.max' and `eval.max'. Default 1000.- GHk
scalar denoting the number of Gauss-Hermite quadrature points. Default 21.

- method
a character string denoting the optimization method to be used in

`optim()`

. Default "BFGS".- verbose
logical; if

`TRUE`

info about the optimization procedure are printed.- eps.hessian
the step-length to use in the central difference approximation that approximates the hessian. Default is

`1e-03`

.- parscale
a scaling numeric vector of length equal to the parameters to be estimated (taking into account any constraints). This is passed to either to the `parscale' control argument of

`optim()`

or to the `scale' argument of`nlminb()`

. Default is 0.5 for the guessing parameters and 1 for the discrimination and easiness parameters.

An object of class `tpm`

with components,

a matrix with the parameter values at convergence. These are always the estimates of
\(\beta_i, \beta\) parameters, even if `IRT.param = TRUE`

.

the log-likelihood value at convergence.

the convergence identifier returned by `optim()`

.

the approximate Hessian matrix at convergence obtained using a central difference approximation.

the number of function and gradient evaluations used by the optimization algorithm.

a list with two components: (i) `X`

: a numeric matrix
that contains the observed response patterns, and (ii) `obs`

: a numeric vector that contains the observed
frequencies for each observed response pattern.

a list with two components used in the Gauss-Hermite rule: (i) `Z`

: a numeric matrix that contains
the abscissas, and (ii) `GHw`

: a numeric vector that contains the corresponding weights.

the maximum absolute value of the score vector at convergence.

the value of the `type`

argument.

the value of the `constraint`

argument.

the value of the `max.guessing`

argument.

the value of the `IRT.param`

argument.

a copy of the response data matrix.

the values used in the `control`

argument.

the value of the `na.action`

argument.

the matched call.

The three parameter model is known to have numerical problems like non-convergence or convergence on the boundary,
especially for the guessing parameters. These problems usually result in a zero estimate for some guessing
parameters and/or in a non positive definite Hessian matrix or in a high absolute value for the score vector
(returned by the `summary`

method) at convergence. In case of estimates on the boundary, the `constraint`

argument can be used to set the guessing parameter(s) for the problematic item(s) to zero. In addition,
`tpm()`

has a number of control parameters that can be tuned in order to obtain successful convergence;
the most important of these are the starting values, the parameter scaling vector and the optimizer.

Birnbaum's three parameter model is usually employed to handle the phenomenon of non-random guessing in the case of difficult items.

The model is defined as follows $$\pi_i = c_i + (1 - c_i) \frac{\exp(\beta_{1i} + \beta_{2i} z)}{1 +
\exp(\beta_{1i} + \beta_{2i} z)},$$ where
\(\pi_i\) denotes the conditional probability of responding correctly to the \(i\)th item given \(z\),
\(c_i\) denotes the guessing parameter, \(\beta_{1i}\) is the easiness parameter,
\(\beta_{2i}\) is the discrimination parameter, and \(z\) denotes the
latent ability. In case `type = "rasch"`

, \(\beta_{2i}\) is assumed equal for all items.

If `IRT.param = TRUE`

, then the parameters estimates are reported under the usual IRT parameterization,
i.e., $$\pi_i = c_i + (1 - c_i) \frac{\exp[\beta_{2i} (z - \beta_{1i}^*)]}{1 +
\exp[\beta_{2i} (z - \beta_{1i}^*)]}.$$

The fit of the model is based on approximate marginal Maximum Likelihood, using the Gauss-Hermite quadrature rule for the approximation of the required integrals.

Baker, F. and Kim, S-H. (2004) *Item Response Theory*, 2nd ed.
New York: Marcel Dekker.

Birnbaum, A. (1968). Some latent trait models and their use in inferring an examinee's ability. In F. M. Lord and
M. R. Novick (Eds.), *Statistical Theories of Mental Test Scores*, 397--479. Reading, MA: Addison-Wesley.

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 10.18637/jss.v017.i05

`coef.tpm`

,
`fitted.tpm`

,
`summary.tpm`

,
`anova.tpm`

,
`plot.tpm`

,
`vcov.tpm`

,
`item.fit`

,
`person.fit`

,
`margins`

,
`factor.scores`

```
# NOT RUN {
# the three parameter model
tpm(LSAT)
# use 'nlminb' as optimizer
tpm(LSAT, control = list(optimizer = "nlminb"))
# the three parameter model with equal
# discrimination parameter across items
# fix the guessing parameter for the third item to zero
tpm(LSAT, type = "rasch", constraint = cbind(3, 1, 0))
# the three parameter model for the Abortion data
fit <- tpm(Abortion)
fit
# the guessing parameter estimates for items 1, 3, and 4 seem to be on
# the boundary; update the fit by fixing them to zero
update(fit, constraint = cbind(c(1, 3, 4), 1, 0))
# }
```

Run the code above in your browser using DataLab