`coef`

method for class "btfit"

# S3 method for btfit coef(object, subset = NULL, ref = NULL, as_df = FALSE, ...)

object | An object of class "btfit", typically the result |
---|---|

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 |

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. |

as_df | Logical scalar, determining class of output. If TRUE, the function returns a data frame. If FALSE (the default), the function returns a named vector (or list of such vectors). |

... | other arguments |

If as_df = TRUE, a data frame a numeric vector of estimated coefficients, where the first column is the component the item is in, the second column in the item and the third column in the coefficient. If as_df = FALSE, then a numeric vector is returned if the model is fitted on the full dataset, or else a list of numeric vectors is returned, one for each fully connected component. Within each component, the items are arranged by estimate, in descending order.

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}\). 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.

citations_btdata <- btdata(BradleyTerryScalable::citations) fit1 <- btfit(citations_btdata, 1) coef(fit1)#> JRSS-B Biometrika JASA Comm Statist #> 1.0604065 0.7897537 0.3095638 -2.1597241toy_df_4col <- codes_to_counts(BradleyTerryScalable::toy_data, c("W1", "W2", "D")) toy_btdata <- btdata(toy_df_4col) fit2a <- btfit(toy_btdata, 1) coef(fit2a)#> $`2` #> Han Gal Fin #> 0.6956415 0.4125361 -1.1081777 #> #> $`3` #> Cyd Amy Ben Dan #> 0.59239992 0.03250119 -0.24307179 -0.38182932 #>coef(fit2a, subset = function(x) length(x) > 3, as_df = TRUE)#> # A tibble: 4 x 3 #> component item coef #> <chr> <chr> <dbl> #> 1 3 Cyd 0.59239992 #> 2 3 Amy 0.03250119 #> 3 3 Ben -0.24307179 #> 4 3 Dan -0.38182932coef(fit2a, subset = function(x) "Amy" %in% names(x))#> $`3` #> Cyd Amy Ben Dan #> 0.59239992 0.03250119 -0.24307179 -0.38182932 #>coef(fit2a, as_df = TRUE)#> # A tibble: 7 x 3 #> component item coef #> <chr> <chr> <dbl> #> 1 2 Han 0.69564153 #> 2 2 Gal 0.41253614 #> 3 2 Fin -1.10817768 #> 4 3 Cyd 0.59239992 #> 5 3 Amy 0.03250119 #> 6 3 Ben -0.24307179 #> 7 3 Dan -0.38182932#> Eve Cyd Han Amy Gal Ben #> 1.90113420 0.47237293 0.24535391 -0.07655328 -0.10175687 -0.42296697 #> Dan Fin #> -0.53638389 -1.48120003coef(fit2b, ref = "Cyd")#> Eve Cyd Han Amy Gal Ben Dan #> 1.4287613 0.0000000 -0.2270190 -0.5489262 -0.5741298 -0.8953399 -1.0087568 #> Fin #> -1.9535730