EXST 7037 Discriminant analysis Page 1 1 *** CH04S#D# ***; 2 *****************************************************************************; 3 *** The following example uses the gamble data set, which is composed of ***; 4 *** data from two instruments that address pathological gambling: ***; 5 *** The first instrument is a 12-item measure developed by Edward Johnson ***; 6 *** that is based on the ten DSM-IV diagnostic criteria for pathological ***; 7 *** gambling. These items are named dsm1-dsm12. ***; 8 *** The second instrument is a 20-item questionnaire developed and used ***; 9 *** by Gamblers Anonymous (GA) to help prospective members decide ***; 10 *** whether they need help. These items are named ga1-ga20. ***; 11 *****************************************************************************; 12 dm "output;clear;log;clear"; 13 options ps=256 ls=99 nocenter nodate nonumber nolabel; 14 15 ods html style=minimal File='C:\EXST7037\Discrim\Gambling example\ch4_All01.html'; NOTE: Writing HTML Body file: C:\EXST7037\Discrim\Gambling example\ch4_All01.html 16 Title1 "Discriminant Analysis of pathological gambling."; 17 Libname amul "C:\EXST7037\Discrim\Gambling example\"; NOTE: Libref AMUL was successfully assigned as follows: Engine: V9 Physical Name: C:\EXST7037\Discrim\Gambling example 18 19 data gamble; set amul.gamble; 20 label dsm1 = 'Wished stop thkg re gambling' 21 dsm2 = 'Wished stop thkg re get money' 22 dsm3 = 'Felt need to bet more and more' 23 dsm4 = 'Rely on others for funds' 24 dsm5 = 'Gamble to escape' 25 dsm6 = 'Lie about how much I gamble' 26 dsm7 = 'Relaxing difficult if not gambling' 27 dsm8 = 'Win back money next day' 28 dsm9 = 'Felt I should cut back on gambling' 29 dsm10 = 'Illegal acts to pay for gambling' 30 dsm11 = 'Danger of losing relationship' 31 dsm12 = 'Danger of losing job' 32 run; 33 34 *** ch4s1d1.sas ***; 35 Title2 "PROC Candisc - default options"; NOTE: There were 100 observations read from the data set AMUL.GAMBLE. NOTE: The data set WORK.GAMBLE has 100 observations and 33 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 36 proc candisc data = amul.gamblegrp out=candout; 37 class type; 38 var dsm1-dsm12; 39 title3 'Canonical Discriminant Analysis Using DSM IV Items'; 40 run; NOTE: There were 100 observations read from the data set AMUL.GAMBLEGRP. NOTE: The data set WORK.CANDOUT has 100 observations and 46 variables. NOTE: The PROCEDURE CANDISC printed pages 1-5. NOTE: PROCEDURE CANDISC used (Total process time): real time 0.12 seconds cpu time 0.06 seconds 41 42 *symlen=1 sets symbol length to 1 - only the first letter 43 of the Type variable will be used as a symbol on the plot.; 44 %let plotitop = cback = white, cframe = ligr, color = black, 45 colors = black red blue ; 46 47 %plotit (data=candout, plotvars=can2 can1, labelvar=_blank_, 48 symvar=type, typevar=type, symsize = 1, symlen=1); Overridden Parameters: cback=white cframe=ligr color=black colors=black red blueEXST 7037 Discriminant analysis Page 2 Types Legend | Steady Control Binge --------------+------------------------------ Symbol Types | symbol symbol symbol Symbols | Symbol Colors | black red blue Label Colors | black red blue Symbol Sizes | 1 1 1 Label Sizes | 1 1 1 Symbol Fonts | swiss swiss swiss Label Fonts | swiss swiss swiss --------------------------------------------- Iterative Scatter Plot of Labeled Points Macro Iteration Place Line Size Page Size Penalty ------------------------------------------------------- 1 2 65 45 0 The following code will create the (empty) printer plot on which the graphical plot is based: options nonumber ls=65 ps=45; proc plot nolegend formchar='|----|+|---' data=preproc vtoh=2; plot Can2 * Can1 $ _blank_ = _symbol_ / haxis=by 1 vaxis=by 1 box list=1 placement=((h=2 -2 : s=right left) (v=1 -1 * h=0 -1 to -5 by alt)); label Can2 = '#' Can1 = '#'; run; quit; The plot was created with the following goptions: goptions reset=goptions erase hpos=129 vpos=40 hsize=15.00in vsize=9.34in device=WIN; The OUT=anno Annotate data set has 186 observations. The PLOTIT macro used 2.2 seconds to create OUT=anno. 49 title; Discriminant Analysis of pathological gambling. PROC Candisc - default options Canonical Discriminant Analysis Using DSM IV Items The CANDISC Procedure Observations 100 DF Total 99 Variables 12 DF Within Classes 97 Classes 3 DF Between Classes 2 Class Level Information Variable type Name Frequency Weight Proportion Binge Binge 33 33.0000 0.330000 Control Control 48 48.0000 0.480000 Steady Steady 19 19.0000 0.190000 Multivariate Statistics and F Approximations S=2 M=4.5 N=42 Statistic Value F Value Num DF Den DF Pr > F Wilks' Lambda 0.22283947 8.02 24 172 <.0001 Pillai's Trace 1.03412267 7.76 24 174 <.0001 Hotelling-Lawley Trace 2.33440867 8.28 24 144.92 <.0001 Roy's Greatest Root 1.62463115 11.78 12 87 <.0001 NOTE: F Statistic for Roy's Greatest Root is an upper bound. NOTE: F Statistic for Wilks' Lambda is exact. Adjusted Approximate Squared Canonical Canonical Standard Canonical Correlation Correlation Error Correlation 1 0.786762 0.755131 0.038293 0.618994 2 0.644305 0.607476 0.058782 0.415129 Test of H0: The canonical correlations in the
View Full Document