SPSS数据统计分析与实践主讲:周涛副教授北京师范大学资源学院2007-10-30教学网站:第八章多因素方差分析本章内容:一、固定因素方差分析二、随机因素的方差分析三、协方差分析常用术语1.因素(Factor)与水平(level)因素也称为因子,就是指可能对因变量有影响的分类变量,而分类变量的不同取值等级(类别)就称为水平2.单元(Cell)也称为水平组合,或者单元格,指各因素各个水平的组合3.元素(Element)指用于测量因变量值的最小单位(如每一位受访者)4.均衡(Balance)如果任一因素各水平在所有单元格中出现的次数相同,且每个单元格内的元素数均相同,则该实验是均衡的,否则被称为不均衡常用术语5.交互效应(Interaction)如果一个因素的效应大小在另一因素不同水平下明显不同,则称为两因素存在交互作用6.固定因素(FixedFactor)与随机因素(RandomFactor)固定因素指在样本中所有可能的水平都出现(换言之,该因素的所有可能水平仅此几种),从样本的分析中可以得知所有水平的状况,无需外推。而随机因素是指所有可能的取值在样本中没有都出现,或者不可能都出现,因此,这就存在外推到所有水平需求。7.协变量(Covariates)指对因变量可能有影响,需要在分析时对其作用加以控制的连续型变量一、固定因素方差分析Two-WayANOVA(两因素方差分析)zExaminestheEffectof:zTwoFactorsontheDependentVariablee.g.,PercentCarbonation(碳酸化作用)andLineSpeed(流程速度)onSoftDrink(不含酒精的饮料)Bottling(灌注)ProcesszInteractionBetweentheDifferentLevelsoftheseTwoFactorse.g.,DoestheeffectofoneparticularpercentageofCarbonationdependonwhichlevelthelinespeedisset?Two-WayANOVAAssumptionszNormalityzPopulationsarenormallydistributedzHomogeneityofVariancezPopulationshaveequalvarianceszIndependenceofErrorszIndependentrandomsamplesaredrawnTwo-WayANOVATotalVariationPartitioningVariationDuetoTreatmentAVariationDuetoRandomSamplingVariationDuetoInteractionSSESSFA+SSAB+SST=VariationDuetoTreatmentBSSFB+TotalVariationTwoWayANOVA:TheFTestStatisticFTestforFactorAEffectMSFAMSEF=FTestforFactorBEffectF=MSFBMSEFTestforInteractionEffectF=MSFABMSEH0:µ1.=µ2.=•••=µr.H1:Notallµi.areequalH0:ΑΒij=0(foralliandj)H1:ΑΒij≠0H0:µ.1=µ.2=•••=µ.cH1:NotallµiareequalRejectifFFURejectifFFURejectifFFUSourceofVariationDegreesofFreedomSumofSquaresMeanSquareFStatistic:A(Row)r-1SSFAMSFAMSFAMSEB(Column)c-1SSFBMSFBMSFBMSEAB(Interaction)(r-1)(c-1)SSABMSABMSABMSEErrorr·c·(n’-1)SSEMSETotalr·c·n’-1SSTTwo-WayANOVASummaryTable===二、SPSS多因素方差分析实例SPSS多因素方差分析实例zAgrocerystorechainsurveyedasetofcustomersconcerningtheirpurchasinghabits.Giventhesurveyresultsandhowmucheachcustomerspentinthepreviousmonth,thestorewantstoseeifthefrequencywithwhichcustomersshopisrelatedtotheamounttheyspendinamonth,controllingforthegenderofthecustomer.操作步骤(1)zAnalyzeÆGeneralLinearModelÆUnivariate...操作步骤(2)-主对话框zSelect“Amountspent”asthedependentvariable.zSelect“Gender”and“Shoppingstyle”asthefixedfactors.操作步骤(3)-Plots对话框zSelectstyleasthehorizontalaxisvariable.zSelectgenderastheseparatelinesvariable.zClickAdd.zClickContinue.操作步骤(4)-PostHoc对话框zSelectstyleasthevariableforwhichposthoctestsshouldbeproduced.zSelectTukeyintheEqualVariancesAssumedgroup.zSelectTamhane'sT2intheEqualVariancesNotAssumedgroup.zClickContinue.操作步骤(5)-Options对话框zSelectgender*styleasthetermforwhichmeansshouldbedisplayed.zSelectDescriptivestatistics,Homogeneitytests,Estimatesofeffectsize,andSpreadvs.levelplotintheDisplaygroup.zClickContinue.zClickOKintheGLMUnivariatedialogbox.结果解释(1)zThistabledisplaysdescriptivestatisticsforeachcombinationoffactorsinthemodel.DescriptiveStatisticsDependentVariable:Amountspent413.065790.8657435343.9763100.4720735378.5210101.2583970440.964798.23860120361.720590.46076102404.5552102.48440222407.774769.3333430405.726980.5705829406.768174.4211459430.304393.47877185365.667192.64058166399.735298.40821351GenderMaleFemaleTotalMaleFemaleTotalMaleFemaleTotalMaleFemaleTotalShoppingstyleBiweekly;inbulkWeekly;similaritemsOften;what'sonsaleTotalMeanStd.DeviationNzThereseemstobeaShoppingstyleeffect;onaverage,biweeklycustomersspend$378.52,whileweeklycustomersspend$404.55,andoftencustomersspend$406.76.结果解释(2)Thistableteststhenullhypothesisthatthevarianceoftheerrortermisconstantacrossthecellsdefinedbythecombinationoffactorlevels.Levene'sTestofEqualityofErrorVariancesaDependentVariable:Amountspent1.1575345.330Fdf1df2Sig.Teststhenullhypothesisthattheerrorvarianceofthedependentvariableisequalacrossgroups.Design:Intercept+style+gender+style*gendera.Sincethesignificancevalueofthetest,0.330,isgreaterthan0.10,thereisnoreasontobelievethattheequalvariancesassumptionisviolated.Thus,thesmalldifferencesingroupstandarddeviationsobservedinthedescriptivestatisticstableareduetorandomvariation.结果解释(3)(1)Thespread-versus-levelplotisascatterplotofthecellmeansandstandarddeviationsfromthedescriptivestatisticstable.(2)Itprovidesavisualtestoftheequalvariancesassumption,withtheaddedbenefitofhelpingyoutoassesswhetherviolationsoftheassumptionareduetoarelationshipbetweenthecellmeansandstandarddeviations.(3)Thereisnoapparentpatterninthisplot,sothereisnoindicationofsucharelationshiphere.结果解释(4)TestsofBetween-SubjectsEffectsDependentVariable:Amountspent469402.996a593880.59911.092.000.13839359636.4139359636.394650.274.000.93133506.210216753.1051.979.140.011158037.4421158037.44218.672.000.05169858.325234929.1634.127.017.0232920058.8243458463.93959475118.43513389461.820350SourceCorrectedModelInterceptstylegenderstyle*genderErrorTotalCorrectedTotalTypeIIISumofSquaresdfMeanSquareFSig.PartialEtaSquaredRSquared=.138(AdjustedRSquared=.126)a.(1)Thetestsofbetween-subjectseffectshelpyoutodeterminethesignificanceofafactor.However,theydonotindicatehowthelevelsofafactordiffer.Theposthoctestswillshowthedifferencesinm