BradleyTerryScalable (version 0.1.0)

vcov.btfit: Calculate variance-covariance matrix for a btfit object

Description

vcov method for class "btfit"

Usage

# S3 method for btfit
vcov(object, subset = NULL, ref = NULL, ...)

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.

...

other arguments

Value

A square numeric matrix, which is a non-full-rank variance-covariance matrix for the estimates in coef(object, subset = subset, ref = ref); or a list of such matrices if object has more than one component. The rows and columns of the matrix (or matrices) are arranged in the same order as the object$pi vector(s). -#' @author David Firth, Ella Kaye

Details

N.B. this can be slow when there are a large number of items in any component.

See Also

btfit, coef.btfit, summary.btfit

Examples

Run this code
citations_btdata <- btdata(BradleyTerryScalable::citations)
#' fit1 <- btfit(citations_btdata, 1)
#' vcov(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)
vcov(fit2a)
vcov(fit2a, subset = function(x) length(x) > 3)
vcov(fit2a, subset = function(x) "Cyd" %in% names(x))
fit2b <- btfit(toy_btdata, 1.1)
vcov(fit2b, ref = "Cyd")

Run the code above in your browser using DataLab