# Calculates the probability of winning — win_prob • stRoke
Calculates the probability of winning (winP). In the referenced article Zou et al (2022) proposes a method for calculating probability of winning with a confidence interval an p-value testing.

Skip to contents

# Calculates the probability of winning

Source: `R/win_prob.R`
`win_prob.Rd`

Calculates the probability of winning (winP). In the referenced article Zou et al (2022) proposes a method for calculating probability of winning with a confidence interval an p-value testing.

## Usage

    win_prob(
      data,
      response = NULL,
      group = NULL,
      alpha = 0.05,
      beta = 0.2,
      group.ratio = 1,
      sample.size = FALSE,
      print.tables = FALSE,
      dec = 3
    )

## Source

doi:10.1161/STROKEAHA.121.037744

## Arguments

data

  A data frame containing the response and group variable.

response

  The name of the response variable. Takes first column if empty.

group

  The name of the group variable. Takes second column if empty.

alpha

  The alpha level for the hypothesis test. Default is 0.05.

beta

  The beta level for the sample size calculation. Default is 0.2.

group.ratio

  The ratio of group sizes. Default is 1.

sample.size

  Flag to include sample size calculation. Default is FALSE.

print.tables

  Flag to print cumulative tables. Default is FALSE.

dec

  Numeric for decimals to print. Default is 3.

## Value

A list containing the win_prob statistics.

## Examples

    win_prob(data=stRoke::talos,response="mrs_6",group="rtreat")
    #> 	 Zou et al's winP (doi: 10.1161/STROKEAHA.121.037744)
    #>
    #> Probability of a random observation in Placebo group
    #>       will have a higher response score than a random
    #>       observation in Active group:
    #>
    #>   	   winP: 0.400 (0.612, 0.372)      p=0.0125
    #> --------------------------------------------
    #>
    #> The numbers needed to treat (NNT) are: -9
    #>
    #>
    #>