dm "output;clear;log;clear"; GOPTIONS reset=all goutmode=replace; OPTIONS PAGENO=1; OPTIONS LINESIZE=75 PAGESIZE=66 NODATE; ODS PDF File="C:\teaching\math593\disc_adm.pdf"; ODS Listing Close; GOptions NoPrompt Vsize=6 Hsize=6 Horigin=1.2 Vorigin=2.5 FText=SwissX FTitle=SwissX HText=1 HTitle=1; TITLE 'Discrimination Analysis for Grad Admission DATA'; DATA Admission; INPUT GPA GMAT CODE @@; IF CODE=1 THEN CAT='ADMIT '; ELSE if CODE = 2 THEN CAT='REJECT '; ELSE CAT='Borderline'; CARDS; 2.96 596 1 3.14 473 1 3.22 482 1 3.29 527 1 3.69 505 1 3.46 693 1 3.03 626 1 3.19 663 1 3.63 447 1 3.59 588 1 3.30 563 1 3.40 553 1 3.50 572 1 3.78 591 1 3.44 692 1 3.48 528 1 3.47 552 1 3.35 520 1 3.39 543 1 3.28 523 1 3.21 530 1 3.58 564 1 3.33 565 1 3.40 431 1 3.38 605 1 3.26 664 1 3.60 609 1 3.37 559 1 3.80 521 1 3.76 646 1 3.24 467 1 2.54 446 2 2.43 425 2 2.20 474 2 2.36 531 2 2.57 542 2 2.35 406 2 2.51 412 2 2.51 458 2 2.36 399 2 2.36 482 2 2.66 420 2 2.68 414 2 2.48 533 2 2.46 509 2 2.63 504 2 2.44 336 2 2.13 408 2 2.41 469 2 2.55 538 2 2.31 505 2 2.41 489 2 2.19 411 2 2.35 321 2 2.60 394 2 2.55 528 2 2.72 399 2 2.85 381 2 2.90 384 2 2.86 494 3 2.85 496 3 3.14 419 3 3.28 371 3 2.89 447 3 3.15 313 3 3.50 402 3 2.89 485 3 2.80 444 3 3.13 416 3 3.01 471 3 2.79 490 3 2.89 431 3 2.91 446 3 2.75 546 3 2.73 467 3 3.12 463 3 3.08 440 3 3.03 419 3 3.00 509 3 3.03 438 3 3.05 399 3 2.85 483 3 3.01 453 3 3.03 414 3 3.04 446 3 RUN; PROC DISCRIM DATA=admission pool=no CROSSVALIDATE MAHALANOBIS; CLASS CAT; VAR GPA GMAT; RUN; Proc Means Data=admission NoPrint; Var GPA GMAT; Output Out=adm1 Min=Min1 Min2 Max=Max1 Max2; Run; Data PlotAdm; If _N_=1 Then Set adm1; Inc1=(Max1-Min1)/50; Inc2=(Max2-Min2)/50; Do GPA = (Min1-Inc1) To (Max1+Inc1) By Inc1; Do GMAT = (Min2-Inc2) To (Max2+Inc2) By Inc2; Output; Keep GPA GMAT; End; End; Stop; Run; Proc DISCRIM Data=admission pool=no Testdata=PlotAdm TestOut=PlotP TestOutD=PlotD; Class CAT; Var GPA GMAT; Run; PROC GPLOT DATA=admission; plot GMAT*GPA = CAT/ HAxis=Axis1 VAxis=Axis2; Axis1 Order=(2.0 To 4.0 By 1.0); Axis2 Order=(270 To 720 By 50.0); Symbol1 V=circle H=0.7 I=None C=RED; Symbol2 V=Star H=0.7 I=None C=BLACK; symbol3 V=dot H=0.7 I=None C=BLUE; run; quit; Title2 'Plot of Estimated Densities'; Proc GContour Data=PlotD; Title3 "ADMIT"; plot GMAT*GPA = ADMIT/ HAxis=Axis1 VAxis=Axis2; Axis1 Order=(2.0 To 4.0 By 1.0); Axis2 Order=(270 To 720 By 50.0); Run; quit; Proc GContour Data=PlotD; Title3 "REJECT"; plot GMAT*GPA = REJECT/ HAxis=Axis1 VAxis=Axis2; Axis1 Order=(2.0 To 4.0 By 1.0); Axis2 Order=(270 To 720 By 50.0); Run; quit; Proc GContour Data=PlotD; Title3 "Borderline"; plot GMAT*GPA = BORDERLINE/ HAxis=Axis1 VAxis=Axis2; Axis1 Order=(2.0 To 4.0 By 1.0); Axis2 Order=(270 To 720 By 50.0); Run; quit; Title2 'Plot of Classification Results'; Proc GPlot Data=PlotP; Plot GMAT*GPA=_Into_; Symbol1 V=circle H=0.7 I=None C=RED; Symbol2 V=Star H=0.7 I=None C=BLACK; symbol3 V=dot H=0.7 I=None C=BLUE; Run; quit; ODS Listing; ODS PDF Close;