logitTool: Logistic Regression Tool (logitTool) In adz-lm/logitTool: Logistic Regression Tool

Description

Performs logistic regression and a small set of relevant statistics/plotting. Indicator parameterization of factors is performed automatically. Reference groups should be set for all binary/factor columns before executing.

Usage

 `1` ```logitTool(formula, data) ```

Arguments

 `formula` The model's formula. (e.g. Y ~ X1 + X2 + X3) `data` The data.frame (or tibble) referenced by the formula.

Value

 `obsCount` The model's observation count. `paramCount` The model's parameter count. `AIC` The model's AIC. `AICc` The model's AICc. `parameters` A data.frame (tibble) of the model's estimated parameter coefficients. `ORs` A data.frame (tibble) of model parameters' odds ratios and confidence intervals calculated using Likelihood Ratio Tests. `LRTs` A data.frame (tibble) of Likelihood Ratio Test results for each model parameter. `hsmLmshw` A data.frame (tibble) with the calculated Hosmer-Lemeshow 10-decile test statistic and p-value for the model. `cutOffs` A data.frame (tibble) with all potential probability cut-off points including their sensitivities, specificities, positive predictive values, and negative predictive values. `plotLowess` An executable function that plots a jittered lowess curve for the model. Accepts jitter height (type = double) as an argument. Default value = 0.05. `plotROC` An executable function that draws the ROC curve and calculates the AUC for the model. Currently does not accept any arguments. `predictIndiv` An executable function that calculates the odds/probability for an individual observation. Accepts a list as an argument. (e.g. list(Tx = 'INF-Gamma', Age = 2, Pattern = 'X-Linked'))

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79``` ```# Note: Data is correct type and reference groups have already been set. workingData <- tibble::tibble(...) # A tibble: 128 x 13 # Tx Pattern Age Ht Wt Cort Abx Sex Infection Hospital # # 1 Place<80> X-Linked 1 79.0 10.5 No Yes Male Yes US-Other # 2 Place<80> X-Linked 1 79.0 11.5 No Yes Male Yes US-Other # 3 INF-G<80> X-Linked 1 76.3 11.3 No Yes Male Yes US-Other # 4 Place<80> X-Linked 1 79.0 12.2 No Yes Male Yes US-Other # ... with 124 more rows, and 1 more variable: HospitalRev workingRegression <- logitTool(Infection ~ Tx + Age + Pattern, data = workingData) workingRegression\$obsCount # [1] 128 workingRegression\$paramCount # [1] 4 workingRegression\$AIC # [1] 157.9931 workingRegression\$AICc # [1] 158.3183 workingRegression\$parameters # A tibble: 4 x 2 # Coefficients Estimate # # 1 (Intercept) 0.357 # 2 TxINF-Gamma -0.865 # 3 Age -0.0639 # 4 PatternAutosomal Recessive 0.789 workingRegression\$ORs # A tibble: 4 x 4 # Coefficient oddsRatio `2.5 %` `97.5 %` # # 1 (Intercept) 1.43 0.635 3.32 # 2 TxINF-Gamma 0.421 0.188 0.916 # 3 Age 0.938 0.894 0.980 # 4 PatternAutosomal Recessive 2.20 0.954 5.18 workingRegression\$LRTs # A tibble: 3 x 3 # Coefficient LRT `Pr(>Chi)` # # 1 Tx 4.76 0.0291 # 2 Age 8.73 0.00313 # 3 Pattern 3.42 0.0645 workingRegression\$hsmLmshw # A tibble: 1 x 2 # statistic p.value # # 1 9.24 0.322 workingRegression\$cutOffs # A tibble: 53 x 5 # probability sensitivity specificity positivePredictiveValue negativePredictiveValue # # 1 Inf 0 1.00 NaN 0.656 # 2 0.720 0.0230 0.988 0.500 0.659 # 3 0.710 0.0450 0.988 0.667 0.664 # 4 0.680 0.0680 0.988 0.750 0.669 # ... with 49 more rows workingRegression\$plotLowess(jitter = 0.05) workingRegression\$plotROC() workingRegression\$predictIndiv(list(Tx = 'INF-Gamma', Age = 2, Pattern = 'X-Linked')) # \$odds # 1 # 0.5295198 # # \$probability # 1 # 0.3462 ```

adz-lm/logitTool documentation built on Feb. 4, 2018, 12:01 a.m.