Learn R Programming

LogisticDx (version 0.1)

logiSS: Sample size for given coefficient and events per covariate for model

Description

Gives sample size necessary to demonstrate that coefficient in model for given predictor is equal to its given value (rather than equal to zero) for a given level of power and significance. Also number of events (smaller of outcome $y=0$ and outcome $y=1$) per predictor. Uses different methods depending on whether model has one binomial, one continuous or multiple predictors.

Usage

logiSS(x, alpha = 0.05, beta = 0.8, coeff = "x1")

Arguments

x
A logistic regression model of class glm
alpha
significance level $\alpha$ for null-hypothesis significance test
beta
power $\beta$ for null-hypothesis significance test
coeff
Name of predictor (coefficient) in model to be tested

Value

  • A list of:
  • resResult: Sample size required to show coefficient for predictor is as given in the model rather than 0
  • epcEvents per covariate; should be >10 to make meaningful statements about coefficients obtained

Examples

Run this code
set.seed(1)
### one coefficient, which is binomial
f1 <- genLogiDf(b=1, c=0, n=50)$model
logiSS(f1)
###
### one coefficient, which is continuous
f1 <- genLogiDf(f=0, b=0, c=1, n=50)$model
logiSS(f1, coeff="x1")
###
### binomial coefficient
f1 <- genLogiDf(f=0, b=1, c=1, n=50)$model
logiSS(f1, coeff="x1")
###
### continuous coefficient
f1 <- genLogiDf(f=0, b=1, c=1, n=50)$model
logiSS(f1, coeff="x2")

Run the code above in your browser using DataLab