Skip to contents

Given an output from projoint_data, this function uses the extrapolation method to produce an estimate of intra-coder reliability (IRR).

Usage

predict_tau(.data, .title = NULL)

# S3 method for projoint_tau
print(x, ...)

# S3 method for projoint_tau
summary(object, ...)

Arguments

.data

A projoint_data object, outputted from reshape_projoint

.title

The title of a figure

x

An object of class projoint_tau derived from predict_tau

...

Optional arguments; currently none accepted

object

An object of class projoint_tau derived from predict_tau

Value

A projoint_tau object containing the estimate of tau and a figure visualizing the extrapolation method.

A tibble showing IRR as profile similarity changes. The value of predicted when x=0 is the estimated IRR.

Examples

library(projoint)
library(stringr)

## Example 1: repeated, flipped task
data("exampleData1")
head(exampleData1)
#> # A tibble: 6 × 185
#>   ResponseId      choice1_repeated_fli…¹ choice1 choice2 choice3 choice4 choice5
#>   <chr>           <chr>                  <chr>   <chr>   <chr>   <chr>   <chr>  
#> 1 R_1M3TDihZzq9z… Community B            Commun… Commun… Commun… Commun… Commun…
#> 2 R_3HtXzkcSSlfi… Community B            Commun… Commun… Commun… Commun… Commun…
#> 3 R_yjYj0jtOY98X… Community B            Commun… Commun… Commun… Commun… Commun…
#> 4 R_1dKd05O6FTOV… Community B            Commun… Commun… Commun… Commun… Commun…
#> 5 R_1otDp642wWYl… Community A            Commun… Commun… Commun… Commun… Commun…
#> 6 R_2BnD3fuJMRKZ… Community A            Commun… Commun… Commun… Commun… Commun…
#> # ℹ abbreviated name: ¹​choice1_repeated_flipped
#> # ℹ 178 more variables: choice6 <chr>, choice7 <chr>, choice8 <chr>,
#> #   race <chr>, party_1 <chr>, party_2 <chr>, party_3 <chr>, party_4 <chr>,
#> #   ideology <chr>, honesty <chr>, `K-1-1` <chr>, `K-1-1-1` <chr>,
#> #   `K-1-2` <chr>, `K-1-1-2` <chr>, `K-1-3` <chr>, `K-1-1-3` <chr>,
#> #   `K-1-4` <chr>, `K-1-1-4` <chr>, `K-1-5` <chr>, `K-1-1-5` <chr>,
#> #   `K-1-6` <chr>, `K-1-1-6` <chr>, `K-1-7` <chr>, `K-1-1-7` <chr>, …

outcomes <- paste0("choice", seq(from = 1, to = 8, by = 1))

outcomes1 <- c(outcomes, "choice1_repeated_flipped")
reshaped_data <- reshape_projoint(
  .dataframe = exampleData1, 
  .outcomes = outcomes1)
  
tau1 <- predict_tau(reshaped_data)
tau1
#> [1] "Tau estimated using the extrapolation method: 0.743"

## Example 2: repeated, unflipped task
data("exampleData2")
head(exampleData2)
#> # A tibble: 6 × 185
#>   ResponseId      choice1_repeated_not…¹ choice1 choice2 choice3 choice4 choice5
#>   <chr>           <chr>                  <chr>   <chr>   <chr>   <chr>   <chr>  
#> 1 R_1M3TDihZzq9z… Community A            Commun… Commun… Commun… Commun… Commun…
#> 2 R_3HtXzkcSSlfi… Community A            Commun… Commun… Commun… Commun… Commun…
#> 3 R_yjYj0jtOY98X… Community A            Commun… Commun… Commun… Commun… Commun…
#> 4 R_1dKd05O6FTOV… Community A            Commun… Commun… Commun… Commun… Commun…
#> 5 R_1otDp642wWYl… Community B            Commun… Commun… Commun… Commun… Commun…
#> 6 R_2BnD3fuJMRKZ… Community B            Commun… Commun… Commun… Commun… Commun…
#> # ℹ abbreviated name: ¹​choice1_repeated_notflipped
#> # ℹ 178 more variables: choice6 <chr>, choice7 <chr>, choice8 <chr>,
#> #   race <chr>, party_1 <chr>, party_2 <chr>, party_3 <chr>, party_4 <chr>,
#> #   ideology <chr>, honesty <chr>, `K-1-1` <chr>, `K-1-1-1` <chr>,
#> #   `K-1-2` <chr>, `K-1-1-2` <chr>, `K-1-3` <chr>, `K-1-1-3` <chr>,
#> #   `K-1-4` <chr>, `K-1-1-4` <chr>, `K-1-5` <chr>, `K-1-1-5` <chr>,
#> #   `K-1-6` <chr>, `K-1-1-6` <chr>, `K-1-7` <chr>, `K-1-1-7` <chr>, …

outcomes2 <- c(outcomes, "choice1_repeated_notflipped")
reshaped_data <- reshape_projoint(
  .dataframe = exampleData2, 
  .outcomes = outcomes2,
  .flipped = FALSE)
  
tau2 <- predict_tau(reshaped_data)
tau2
#> [1] "Tau estimated using the extrapolation method: 0.743"

## Example 3: no repeated task
data("exampleData3")
head(exampleData3)
#> # A tibble: 6 × 184
#>   ResponseId     choice1 choice2 choice3 choice4 choice5 choice6 choice7 choice8
#>   <chr>          <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <chr>  
#> 1 R_1M3TDihZzq9… Commun… Commun… Commun… Commun… Commun… Commun… Commun… Commun…
#> 2 R_3HtXzkcSSlf… Commun… Commun… Commun… Commun… Commun… Commun… Commun… Commun…
#> 3 R_yjYj0jtOY98… Commun… Commun… Commun… Commun… Commun… Commun… Commun… Commun…
#> 4 R_1dKd05O6FTO… Commun… Commun… Commun… Commun… Commun… Commun… Commun… Commun…
#> 5 R_1otDp642wWY… Commun… Commun… Commun… Commun… Commun… Commun… Commun… Commun…
#> 6 R_2BnD3fuJMRK… Commun… Commun… Commun… Commun… Commun… Commun… Commun… Commun…
#> # ℹ 175 more variables: race <chr>, party_1 <chr>, party_2 <chr>,
#> #   party_3 <chr>, party_4 <chr>, ideology <chr>, honesty <chr>, `K-1-1` <chr>,
#> #   `K-1-1-1` <chr>, `K-1-2` <chr>, `K-1-1-2` <chr>, `K-1-3` <chr>,
#> #   `K-1-1-3` <chr>, `K-1-4` <chr>, `K-1-1-4` <chr>, `K-1-5` <chr>,
#> #   `K-1-1-5` <chr>, `K-1-6` <chr>, `K-1-1-6` <chr>, `K-1-7` <chr>,
#> #   `K-1-1-7` <chr>, `K-1-2-1` <chr>, `K-1-2-2` <chr>, `K-1-2-3` <chr>,
#> #   `K-1-2-4` <chr>, `K-1-2-5` <chr>, `K-1-2-6` <chr>, `K-1-2-7` <chr>, …

reshaped_data <- reshape_projoint(
  .dataframe = exampleData3, 
  .outcomes = outcomes,
  .repeated = FALSE)
  
tau3 <- predict_tau(reshaped_data)
tau3
#> [1] "Tau estimated using the extrapolation method: 0.743"