logiProb: Logit, odds ratio and probability for coefficients of a...

Description Usage Arguments Value Note Examples

View source: R/logiProb.R

Description

Generate logit, log odds ratio, odds ratio and probability for coefficients in a logistic regression. Can be generalized to all combinations of coefficients.

Values are calculated for a change in the value of the coeffient for the predictor from 0 to 1. (For continuous predictors changes of more than one unit may have more practical significance).

Usage

1
  logiProb(x, usePrim = FALSE, all = FALSE)

Arguments

x

A logistic regression model of class glm

all

If all=FALSE (the default) return values for all coefficients in model, considered together.
If all=TRUE return values for all combinations of coefficients in model.

usePrim

If usePrim=FALSE (the default) use utils::combn to generate combinations.
If usePrim=TRUE use gRbase::combnPrim instead (faster).

Value

If all=TRUE, a data.table giving, for each combination of coefficients:

coef

Combination of coefficients

logit

The logit for a given combination of coefficients

lnOR

Natural log of Odds Ratio

OR

Odds Ratio

p

probability

This is sorted by OR (low to high).

If all=FALSE, a data.frame giving the above values for all predictors.

Note

To use gRbase::combnPrim the following dependencies may be necessary. Install as follows:
source("http://bioconductor.org/biocLite.R")
biocLite("graph")
biocLite("BiocGenerics")
biocLite("RBGL")

Examples

1
2
3
4
5
set.seed(1)
f1 <- genLogiDf(n=50)$model
logiProb(f1)
d1 <- genLogiDt(n=50, model=FALSE)
logiProb(glm(y ~ x1 + x3 -1, data=d1, family=binomial()), all=TRUE)

logisticDx documentation built on May 2, 2019, 6:30 p.m.