Tags:
create new tag
, view all tags, tagging instructions
Return to Stat Tools Home

Title: Logistic Regression

Evaluate this tool by clicking on the stars:

  • 5 stars = highest rating
  • 1 star = lowest
  • SCORE = average of all votes
Tools Overall Rating
Score: 0, My vote: 0, Total votes: 0
Code Works Well
Score: 0, My vote: 0, Total votes: 0
Good Instructions
Score: 0, My vote: 0, Total votes: 0

Add Comments and then click on "Add comment" button

Please note any errors found in the macros.

 

StatToolsForm edit

Type of Tool SAS Macro
Title Logistc Regression
Programmer/Email PeterBacchetti
Contributing Site UCSF
Description This is a macro for performing logistic regression with a binary outcome, checking model assumptions, and producing output that is arranged in a way suitable for use in publications. Some features that add convenience include automatically creating quartile categories for specified predictors, rescaling numeric predictors to make odds ratios more interpretable, and showing counts for categorical predictors.
Classification Graph Type

References

Datasets

Data

Software Program SAS
Software SAS
Macro Parameters Parameters for Logistic Macro:
DSName = name of SAS data set
Outcome = name of outcome variable. This variable is assumed to be coded 0, 1 and the model predicts the
probability of a 1 outcome.
Predictors = list of predictor variables. This list should include class variables and variables to be 'quartiled.'
Interaction variables may be included in which case the predictor list should be quoted, e.g.
Predictors = %quote(Age Gender Age*Gender). Note: all variables appearing in interaction terms
should also appear as main effects.
Classvar = classification variables with reference level. Use %quote function. For example,
Classvar=%quote(Gender(ref='Male')Race(ref='Asian')) Gender and Race could be numeric variables with
formatted values of Male or Asian or they could be alphanumeric variables with string values of 'Male'
and 'Asian'. Do not include variables for which quartiles are to be generated.
Quartiles = list of numeric variables which should be entered into the model as class variables with four quartile
levels. Variables in this list will not be included in the model as linear predictors.
Quad = Y/N for creating and testing quadratic terms (default = Y)
Out = name of output SAS data set containing logistic estimates, p-values, etc.
Print = Y/N (default = N)
Include = F,P,FP,or N
F = frequencies of outcome variable are displayed for each class variable value, e.g., Sex Female 31/100
P = percentages are displayed with class variable values, e.g., Sex Female 31.0%
FP = frequencies and percentages are displayed with class variable values, e.g., Sex Female 31/100 (31.0%).
N = no frequencies or percentages are displayed with class variable values (default = FP)
Obs = Y/N If Y, then the number of observations in each outcome group and the total are displayed. (default = Y)
LL = Y/N If Y, then -2log(likelihood) is displayed. (default = N)
HL = Y/N If Y, then the Hosmer-Lemeshow p-value is displayed along with the number of groups of estimates
(default = N).
R-Code - Attachment

R-Code

SAS-Code - Attachment UCSF_Logistic Regression-Main Macro
SAS-Code

Stata-Code - Attachment

Stata-Code

Other Code - Attachment

Other Code

Called Data Manipulation

Called Tool/Utility

Called Checking Macro

Called Other

Creation-Date

Revision-Date

Example Code SAS Example Code
Example Output SAS Example Output
SAS Examples Macro to make hyperlinked output
Logistic Regression Example with hyperlinked output
SAS_Example_Code

SAS_Example_Output Output file created by above example
R Examples

R_Example_Code

R_Example_Output

Stats Examples

Special Features Printing
Special Features Attached Ordinary printing macro
Special Features Text Special Features of Logistic macro:
The macro will automatically test a quadratic term for numeric (non-class) predictors with more than two values.
The macro will automatically output odds ratios that have been rescaled until the units > 1/10 of the IQR.
Notes1-Legend Section with calls to needed macros
Notes1

Notes2-Legend Macro call with fully specified parameters
Notes2

Notes3-Legend Section with definitions of global macro parameters
Notes3

Notes4-Legend Section with definitions of local macro variables
Notes4

See Also Research Topic: Logistic Regression

Checklists Logistic Regression Checklists
Stat Tools Disclaimer

Discliamer The views expressed within CTSpedia are those of the author and must not be taken to represent policy or guidance on the behalf of any organization or institution with which the author is affiliated.
Permission Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT OLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Reference Image

Topic revision: r14 - 30 Jun 2012 - 23:43:37 - PeterBacchetti
 

Copyright & by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CTSPedia? Send feedback