Resources

Phase II Analysis with MVPDIAGNOSE

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: MVPDIEX1                                            */
/*   TITLE: Phase II Analysis with MVPDIAGNOSE                  */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Score Plot, Contribution Plot                       */
/*   PROCS: MVPDIAGNOSE                                         */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT: saswgr                                              */
/*     REF: PROC MVPDIAGNOSE, Example 1                         */
/*                                                              */
/****************************************************************/

data MWflightDelays;
   format flightDate MMDDYY8.;
   label flightDate='Date';
   input flightDate :MMDDYY8. AA CO DL F9 FL NW UA US WN;
   datalines;
02/01/07 14.9  7.1  7.9  8.5 14.8  4.5  5.1 13.4  5.1
02/02/07 14.3  9.6 14.1  6.2 12.8  6.0  3.9 15.3 11.4
02/03/07 23.0  6.1  1.7  0.9 11.9 15.2  9.5 18.4  7.6
02/04/07  6.5  6.3  3.9 -0.2  8.4 18.8  6.2  8.8  8.0
02/05/07 12.0 14.1  3.3 -1.3 10.0 13.1 22.8 16.5 11.5
02/06/07 31.9  8.6  4.9  2.0 11.9 21.9 29.0 15.5 15.2
02/07/07 14.2  3.0  2.1 -0.9 -0.6  7.8 19.9  8.6  6.4
02/08/07  6.5  6.8  1.8  7.7  1.3  6.9  6.1  9.2  5.4
02/09/07 12.8  9.4  5.5  9.3 -0.2  4.6  7.6  7.8  7.5
02/10/07  9.4  3.5  1.5 -0.2  2.2  9.9  3.1 12.5  3.0
02/11/07 12.9  5.4  0.9  6.8  2.1  7.9  3.7 10.7  5.6
02/12/07 34.6 15.9  1.8  1.0  4.5 10.2 14.0 19.1  4.9
02/13/07 34.0 16.0  4.4  6.1 18.3  9.1 30.2 46.3 50.6
02/14/07 21.2 45.9 16.6 12.5 35.1 23.8 40.4 43.6 35.2
02/15/07 46.6 36.3 23.9 20.8 30.4 24.3 30.3 59.9 25.6
02/16/07 31.2 20.8 15.2 20.1  9.1 12.9 22.9 36.4 16.4
;

proc mvpmodel data=MWflightDelays ncomp=3 noprint outloadings=mvpairloadings;
   var AA CO DL F9 FL NW UA US WN;
run;

data MWflightDelays2;
   label flightDate='Date';
   format flightDate MMDDYY8.;
   input flightDate :MMDDYY8. AA CO DL F9 FL NW UA US WN;
   dayofweek = put(flightDate,downame.);
   datalines;
02/17/07 25.6  7.8 15.5 13.4 16.1 16.2 23.0 24.2  8.2
02/18/07  5.4 16.0  9.9  1.1 11.5 17.0 15.6 15.5  5.1
02/19/07 13.2 16.3 10.0 10.6  5.4 10.3  9.5 16.8  9.3
02/20/07  4.2  6.9  1.4  0.1  7.2  6.6  7.4 10.4  2.9
02/21/07  5.4 -0.1  7.4  8.7 16.3 24.3  9.4  6.0 10.2
02/22/07 19.6 30.2  6.8  2.7  8.9 16.4 14.3 12.6  8.2
02/23/07 14.9 18.9  9.9  9.1 12.0 16.5 17.4 12.8  6.0
02/24/07 21.4  5.5 11.1 46.1 10.6 55.3 22.9  8.8  3.4
02/25/07 42.6  7.7 14.6 14.4 32.0 50.7 46.1 49.4 39.1
02/26/07 43.2 25.1 18.1 18.2 28.8 31.1 38.6 29.6 18.6
02/27/07 11.3 17.1  5.3  4.1  4.8 13.9  9.8  9.7  7.1
02/28/07  8.1  3.7  2.7 17.1 -0.8  5.5 11.0 14.3  3.1
;

proc mvpdiagnose data=MWflightDelays2 loadings=mvpairloadings;
   id flightDate;
   scoreplot / labels=on group=dayofweek;
   label dayofweek='';
run;

data MWflightDelays2;
   set MWflightDelays2;
   weekday = put(flightDate,weekday.);
   if not ( weekday in (1 7) ) then dayofweek='weekday';
run;

proc mvpdiagnose data=MWflightDelays2 loadings=mvpairloadings;
   id flightDate;
   scoreplot / labels=on group=dayofweek;
   label dayofweek='';
run;

proc mvpdiagnose data=MWflightDelays2 loadings=mvpairloadings;
   where dayofweek ne 'weekday';
   time flightDate;
   contributionpanel;
   format flightDate weekdate.;
run;

proc mvpdiagnose data=MWflightDelays2 loadings=mvpairloadings;
   where dayofweek ne 'weekday';
   time flightDate;
   contributionpanel / type=spe;
   format flightDate weekdate.;
run;