/* -------------------------------------------------------------------------- */ /* Lab 7: Multivariat Analysis of Variance (MANOVA) */ /* -------------------------------------------------------------------------- */ /* Importing the data into the temporary work folder */ proc import file='E:\Teaching\Mulivariate S09\Lab 7\pottery.xls' out = datain dbms = EXCEL2000; getnames=yes; data pottery; set datain; label Site="Location of find" Al="Aluminum" Fe="Iron" Mg="Magnesium" Ca="Calcium" Na="Sodium"; proc format; value $Site L="Llanedyrn" C="Caldicot" I="Isle Thornes" A="Ashley Rails"; proc datasets; delete datain; run; quit; /* To learn more about the data you are working with; provides metadata */ proc contents data = pottery; run; /* Investigating univariate statistics */ proc sort data=pottery; by Site; proc means data=pottery mean std stderr; by Site; run; proc capability data=pottery noprint; histogram / normal nmidpoints=10; run; proc corr data=pottery; run; /* ------------------------------- */ /* !!! RUN THE MULTNORM2 MACRO !!! */ /* ------------------------------- */ /* Let's assess multivariate normality */ %multnormplt (data=pottery, var= Al Fe Mg Ca Na, title=Pottery data); quit; /* Let us look at some of our data */ proc g3d data = pottery; scatter Al*Fe=Mg / shape='balloon' rotate=70 to 430 by 1; run; quit; /* ------------------------------------ */ /* !!! RUN THE GRAPHICS IML ROUTINE !!! */ /* ------------------------------------ */ /* Bartlett's Test */ proc discrim data=pottery pool=test; class Site; var Al Fe Mg Ca Na; run; /* Running the MANOVA and saving out residuals */ proc glm data=pottery; class Site; model Al Fe Mg Ca Na = Site; lsmeans Site / stderr cl pdiff; manova h=Site / printe printh; output out=resids r=ral rfe rmg rca rna; run; quit; /* Investigating residuals */ proc univariate data = resids plot ; var ral rfe rmg rca rna ; run; quit;