BradleyTerryScalable (version 0.1.0)

summary.btfit: Summarizing Bradley-Terry Fits

Description

summary method for class "btfit"

Usage

# S3 method for btfit
summary(object, subset = NULL, ref = NULL, SE = FALSE,
  ...)

Arguments

object

An object of class "btfit", typically the result ob of ob <- btfit(..). See btfit.

subset

A condition for selecting one or more subsets of the components. This can either be a character vector of names of the components (i.e. a subset of names(object$pi)), a single predicate function (that takes a vector of object$pi as its argument), or a logical vector of the same length as the number of components, (i.e. length(object$pi)).

ref

A reference item. Either a string with the item name, or the number 1, or NULL. If NULL, then the coefficients are constrained such that their mean is zero. If an item name is given, the coefficient estimates are shifted so that the coefficient for the ref item is zero. If there is more than one component, the components that do not include the ref item will be treated as if ref = NULL. If ref = 1, then the first item of each component is made the reference item.

SE

Logical. Whether to include the standard error of the estimate in the item_summary table. Default is FALSE. N.B. calculating the standard error can be slow when the number of items is large. See vcov.btfit.

...

other arguments

Value

An S3 object of class "summary.btfit". It is a list containing the following components:

item_summary

A tibble with columns for the item name, its coefficient, the standard error and the component it is in. Within each component, the items are arranged by estimate, in descending order. Note that the estimate is NOT the same as the values in summary$pi. See Details.

component_summary

A tibble with a row for each component in the btfit object (named according to the original btdata$components, with the number of items in the component, the number of iterations the fitting algorithm ran for, and whether it converged.

Details

Note that the values given in the estimate column of the item_summary element are NOT the same as the values in object$pi. Rather, they are the \(\lambda_i\), where \(\lambda_i = \log{\pi_i}\) (i.e. the coefficients as found by They are the coefficients, as found by coef.btfit.). By default, these are normalised so that mean(\(\lambda_i\)) = 0. However, if ref is not equal to NULL, then the \(\lambda_i\) in the component in which ref appears are shifted to \(\lambda_i - \lambda_{ref}\), for \(i = 1, \dots, K_c\), where \(K_c\) is the number of items in the component in which ref appears, and \(\lambda_{ref}\) is the estimate for the reference item.

See Also

btfit, coef.btfit, vcov.btfit

Examples

Run this code
citations_btdata <- btdata(BradleyTerryScalable::citations)
fit1 <- btfit(citations_btdata, 1)
summary(fit1)
toy_df_4col <- codes_to_counts(BradleyTerryScalable::toy_data, c("W1", "W2", "D"))
toy_btdata <- btdata(toy_df_4col)
fit2a <- btfit(toy_btdata, 1)
summary(fit2a)
fit2b <- btfit(toy_btdata, 1.1)
summary(fit2b, SE = TRUE)
fit2c <- btfit(toy_btdata, 1)
summary(fit2c, subset = function(x) "Amy" %in% names(x))
summary(fit2c, subset = function(x) length(x) > 3, ref = "Amy")

Run the code above in your browser using DataLab