*** POLYTOMOUS REGRESSION * Read in the data from {BMIData.xls} ; PROC IMPORT DATAFILE = 'C:\Documents and Settings\richc\My Documents\CPH931F09\BMIData.xls' OUT = BMIExample DBMS = EXCEL REPLACE; SHEET = Sheet1; GETNAMES = YES; RUN; * Rescale ENERGY so that one unit = 100 calories ; DATA BMIExample; SET BMIExample; ENERGYHU = ENERGY/100; RUN; * Initiate a ``transcript'' in the Word file {BMIresults.rtf}. ; ODS RTF FILE = 'C:\Documents and Settings\richc\My Documents\CPH931F09\BMIresults.rtf'; * Run polytomous regression with ENERGYHU and TOTFAT as * predictors of WEIGHT1, which equals 0 for people with * BMI < 25 (healthy weight), 1 for people with BMI between * 25 and 30 (overweight), and 2 for people with BMI > 30 * (obese). In the output, labels of "1" in the Function * Number column imply that the parameter estimates relate * to the ratio of probabilities of being obese versus of * healthy weight; labels of "2" imply that the parameter * estimates relate to the ratio of probabilities of being * overweight versus of healthy weight. ; PROC SORT DATA=BMIExample OUT=BMISorted; BY DESCENDING WEIGHT1; RUN; PROC CATMOD ORDER=DATA DATA=BMISorted; DIRECT ENERGYHU TOTFAT; MODEL WEIGHT1 = ENERGYHU TOTFAT ; RUN; QUIT; * Run polytomous regression using only ENERGYHU. We do * not need to invoke PROC SORT a second time. ; PROC CATMOD ORDER=DATA DATA=BMISorted; DIRECT ENERGYHU ; MODEL WEIGHT1 = ENERGYHU ; RUN; QUIT; * End Word transcript. ; ODS RTF CLOSE; RUN; *** ORDINAL LOGISTIC REGRESSION * Read in the data from {BMIData.xls} ; PROC IMPORT DATAFILE = 'C:\Documents and Settings\richc\My Documents\CPH931F09\BMIData.xls' OUT = BMIExample DBMS = EXCEL REPLACE; SHEET = Sheet1; GETNAMES = YES; RUN; * Rescale ENERGY so that one unit = 100 calories ; DATA BMIExample; SET BMIExample; ENERGYHU = ENERGY/100; RUN; * Initiate a ``transcript'' in the Word file {BMIresults2.rtf}. ; ODS RTF FILE = 'C:\Documents and Settings\richc\My Documents\CPH931F09\BMIresults2.rtf'; * Run ordinal logistic regression with ENERGYHU and TOTFAT * as predictors of WEIGHT1, which equals 0 for people with * BMI < 25 (healthy weight), 1 for people with BMI between * 25 and 30 (overweight), and 2 for people with BMI > 30 * (obese). In the output, "Intercept2" relates to the * odds of being obese; "Intercept1" relates to the odds of * being obese or overweight. ; PROC LOGISTIC DATA=BMIExample DESCENDING; MODEL WEIGHT1 = ENERGYHU TOTFAT; RUN; * Run ordinal logistic regression using only ENERGYHU. ; PROC LOGISTIC DATA=BMIExample DESCENDING; MODEL WEIGHT1 = ENERGYHU; RUN; * End Word transcript. ; ODS RTF CLOSE; RUN;