as.matrix,Response_set-method {irt}R Documentation

Convert a Response_set-class object into a matrix

Description

This function converts Response_set-class objects to a matrix object.

Usage

## S4 method for signature 'Response_set'
as.matrix(x, ..., output = "score", ip = NULL)

Arguments

x

A Response_set-class object

...

additional arguments

output

Contents of the matrix. The default value is "score". Other options are:

"score"

Matrix of item scores.

"raw_response"

Matrix of raw responses.

"item_id"

Matrix of item ids.

"testlet_id"

Matrix of testlet ids.

"response_time"

Matrix of response times.

"order"

Matrix of item orders.

misc

If all responses has the same 'misc' field, then the matrix of that misc field can be extracted.

ip

An Itempool-class object to use for adding item_id's as column names. If there are items that are in the item pool but not in the response data, those items will be added and all values will be NA.

Value

A matrix of examinee item scores within each row and items in each column.

Author(s)

Emre Gonulates

Examples

ip <- generate_ip(n = 15)
resp_set <- generate_resp_set(ip = ip, theta = rnorm(30), prop_missing = .5)
# Matrix of item scores
as.matrix(resp_set)

# If the item pool object provided, the column names will have the same
# order as the item order in item pool
as.matrix(resp_set, ip = ip)

# Matrix of raw responses
as.matrix(resp_set, output = "raw_response")

# Matrix of item order
as.matrix(resp_set, output = "order")

# Matrix of item ids
as.matrix(resp_set, output = "item_id")



[Package irt version 0.2.9 Index]