SPSS - ANOVA
Dr. Miquel A. BelmonteHospital General de Castellón
Castellón, EspañaInicialmente en el sitio: www.pitt.edu/~super1/
www.reeme.arizona.edu
www.reeme.arizona.edu
Elección de tests estadísticos
CATEG CUANT CATEG CUANT
CATEG X2 Oneway Manova
CUANT Student T Correlac
CATEG Loglinear ANOVA Manova
CUANT Reg. Logist Reg.Mult
1
1
> 1
> 1
Varbl. dependientes
Varbl.Indep.
www.reeme.arizona.edu
ANOVA - conceptos básicosInfluencia de una o varias variables categóricas (factores) sobre una variable dependiente cuantitativaValora efectos principales de factores e interacciones de éstos entre síAdmite una o más covariables de control, de tipo cuantitativoEstudia reducción de variabilidad (suma de cuadrados)
Test paramétrico: Compara las medias de los subgrupos formados para cada factor
www.reeme.arizona.edu
Condiciones
• Igualdad de varianzas• Distribución paramétrica
Levene's Test of Equality of Error Variancesa
Dependent Variable: Current salary
10,374 19 454 ,000F df1 df2 Sig.
Tests the null hypothesis that the error variance of thedependent variable is equal across groups.
Design: Intercept+AGE+SEXRACE+JOBCAT+SEXRACE* JOBCAT
a.
www.reeme.arizona.edu
ANOVA - estadísticos
SS total = Σ SS efectos principales +SS interacciones orden 2 y sucesivas +SS residuos
SS (factor o interacción) MS =
DF (grados de libertad)
MS (factor o interacción)F =
MS de los residuos
www.reeme.arizona.edu
ANOVA - Output SPSSSum of Mean Sig
Source of Variation Squares DF Square F of F
Covariates 601239435 1 601239435,132 54,882 ,000AGE 601239435 1 601239435,132 54,882 ,000
Main Effects 11677985838 7 1668283691,12 152,284 ,000JOBCAT 7428829687 4 1857207421,83 169,529 ,000SEXRACE 709773003 3 236591000,879 21,596 ,000
2-Way Interactions 318155497 8 39769437,169 3,630 ,000JOBCAT SEXRACE 318155497 8 39769437,169 3,630 ,000
Explained 12597380770 16 787336298,143 71,869 ,000
Residual 4885977728 446 10955107,014
Total 17483358499 462 37842767,313
Mean Square = _______________Sum of Squares
DF
F = _____________________MS Factor explained
MS Residual
www.reeme.arizona.edu
Modelos de ANOVA
ANOVA factorial general
ANOVA multivariado: MANOVA
ANOVA de medidas repetidas
www.reeme.arizona.edu
ANOVAModelo Lineal General Factorial
www.reeme.arizona.edu
Definición del modelo
www.reeme.arizona.edu
Opciones
www.reeme.arizona.edu
Contrastes
Permiten comparar niveles o categorías entre sí, dentro de cada factor considerado.
Test Results
Dependent Variable: Current salary
1,09E+09 6 1,82E+08 15,050 ,000 ,1665,47E+09 453 12068299
SourceContrastError
Sum ofSquares df
MeanSquare F Sig.
EtaSquared
www.reeme.arizona.edu
Profile Plots
Employment category
TechnicalMBA trainee
Exempt employeeCollege trainee
Security officerOffice trainee
Clerical
Mea
n of
Cur
rent
sal
ary
40000
30000
20000
10000
0
Estimated Marginal Means of Current salary
Sex & race classification
Minority femalesWhite femalesMinority malesWhite males
Est
imat
ed M
argi
nal M
eans
24000
22000
20000
18000
16000
14000
12000
10000
8000
Muestran estimaciones de Media Marginalpara cada subgrupo formado.
www.reeme.arizona.edu
Spread vs. Level Plot of Current salary
Groups: Sex & race classification * Employment category
Level (Mean)
400003000020000100000
Spr
ead
(Sta
ndar
d D
evia
tion)
12000
10000
8000
6000
4000
2000
0
Gráfico de distribución
www.reeme.arizona.edu
ANOVAModelo Lineal General Factorial
SYNTAX
UNIANOVAUNIANOVAsalnow BY sexrace jobcat WITH age/METHOD = SSTYPE(3)/INTERCEPT = INCLUDE/PRINT = DESCRIPTIVE ETASQ HOMOGENEITY/CRITERIA = ALPHA(.05)/DESIGN = age sexrace jobcat sexrace*jobcat .
www.reeme.arizona.edu
Estadísticas Descriptivas
Descriptive Statistics
Dependent Variable: Current salary
13057,65 3251,46 7513092,23 3839,48 3512471,43 663,50 1424916,97 5321,94 3325570,71 7152,95 2826916,67 3003,47 336691,67 10543,45 617790,16 8132,26 19411752,57 2561,80 3511080,00 1086,75 1212272,31 1025,17 1331400,00 , 131880,00 11483,41 226500,00 , 112898,44 5223,95 64
9890,12 2839,32 8510501,78 1894,68 8118040,57 3171,27 719660,00 4299,21 223250,00 , 110682,72 3204,76 176
9258,75 1719,52 329090,00 972,77 89225,00 1588,95 40
11134,82 3196,57 22711136,41 2732,60 13612375,56 845,85 2723901,07 5695,15 4125595,62 7364,40 3226100,00 2661,06 536691,67 10543,45 613767,83 6830,26 474
Employment categoryClericalOffice traineeSecurity officerCollege traineeExempt employeeMBA traineeTechnicalTotalClericalOffice traineeSecurity officerCollege traineeExempt employeeMBA traineeTotalClericalOffice traineeCollege traineeExempt employeeMBA traineeTotalClericalOffice traineeTotalClericalOffice traineeSecurity officerCollege traineeExempt employeeMBA traineeTechnicalTotal
Sex & race classificationWhite males
Minority males
White females
Minority females
Total
MeanStd.
Deviation N
www.reeme.arizona.edu
ANOVA Output
Tests of Between-Subjects Effects
Dependent Variable: Current salary
1,66E+10a 20 8,30E+08 68,774 ,000 ,7529,28E+09 1 9,28E+09 768,594 ,000 ,6292,06E+08 1 2,06E+08 17,075 ,000 ,0364,06E+08 3 1,35E+08 11,205 ,000 ,0695,50E+09 6 9,17E+08 75,953 ,000 ,5013,20E+08 10 31952108 2,648 ,004 ,0555,47E+09 453 120682991,12E+11 4742,21E+10 473
SourceCorrected ModelInterceptAGESEXRACEJOBCATSEXRACE * JOBCATErrorTotalCorrected Total
Type IIISum of
Squares dfMean
Square F Sig.Eta
Squared
R Squared = ,752 (Adjusted R Squared = ,741)a.
www.reeme.arizona.edu
ANOVA factorialSimple
– Diseños factoriales de modelos saturados– Métodos:
» Único: todos los elementos concurrentemente» Jerárquico: covariables - factores- interacción» Experimental: factores- interacción
General– Diseños factoriales de modelos no saturados– Permite especificar con más flexibilidad el modelo a utilizar y variedad de estadísticos
www.reeme.arizona.edu
ONEWAY
Caso particular de ANOVA de un factorUna sola variable dependiente cuantitativaUn factor con varias categoríasONEWAY, pero no ANOVA, produce:
– Contrastes– Comparaciones múltiples– Pruebas de tendencia– Test homogeneidad de varianza
www.reeme.arizona.edu
ONEWAY
www.reeme.arizona.edu
Resultados OnewayListado descriptivo
Descriptives
Current salary
227 11134,82 3196,57 212,16 10716,75 11552,89 6300 26750136 11136,41 2732,60 234,32 10673,00 11599,82 7260 32000
27 12375,56 845,85 162,78 12040,95 12710,16 9720 1410041 23901,07 5695,15 889,43 22103,46 25698,68 13764 3650032 25595,63 7364,40 1301,86 22940,47 28250,78 15480 41500
5 26100,00 2661,06 1190,06 22795,86 29404,14 23250 300006 36691,67 10543,45 4304,35 25626,99 47756,34 26700 54000
474 13767,83 6830,26 313,72 13151,36 14384,29 6300 54000
ClericalOffice traineeSecurity officerCollege traineeExempt employeeMBA traineeTechnicalTotal
N MeanStd.
Deviation Std. ErrorLowerBound
UpperBound
95% Confidence Intervalfor Mean
Minimum Maximum
www.reeme.arizona.edu
ONEWAY - Output SPSSAnalysis of Variance
Sum of Mean F FSource D.F. Squares Squares Ratio Prob.
Between Groups 4 11168758807 2792189702 202,5184 ,0000
Unweighted Linear Term 1 9966174401 9966174401 722,8499 ,0000Weighted Linear Term 1 8987023511 8987023511 651,8318 ,0000
Deviation from Linear 3 2181735296 727245098,6 52,7473 ,0000Within Groups 458 6314599691 13787335,57
Total 462 17483358499
ANOVA
Current salary
1,52E+10 6 2,53E+09 171,128 ,0006,90E+09 467 147724772,21E+10 473
Between GroupsWithin GroupsTotal
Sum ofSquares df
MeanSquare F Sig.
www.reeme.arizona.edu
ONEWAY - Comparaciones MúltiplesMultiple Range Tests: Scheffe test with significance level ,05
The difference between two means is significant ifMEAN(J)-MEAN(I) >= 2625,5795 * RANGE * SQRT(1/N(I) + 1/N(J))
with the following value(s) for RANGE: 4,37
(*) Indicates significant differences which are shown in the lower triangle
C O S El f e C xe f c o er i u l m
Mean JOBCAT11134,8194 Clerical11136,4118 Office t12375,5556 Security
23901,0732 College * * *25595,6250 Exempt e * * *
www.reeme.arizona.edu
Oneway - ContrastesCurrent salary
227 11134,82136 11136,41
27 12375,5641 23901,0732 25595,63
5 26100,006 36691,67
,976 ,708 1,000227 11134,82136 11136,41
27 12375,5641 23901,0732 25595,63
5 26100,006 36691,67
,993 ,876 1,000
Employment categoryClericalOffice traineeSecurity officerCollege traineeExempt employeeMBA traineeTechnicalSig.ClericalOffice traineeSecurity officerCollege traineeExempt employeeMBA traineeTechnicalSig.
Tukey HSDa,b
Scheffea,b
N 1 2 3Subset for alpha = .05
Means for groups in homogeneous subsets are displayed.Uses Harmonic Mean Sample Size = 14,859.a.
The group sizes are unequal. The harmonic mean of the group sizes is used.Type I error levels are not guaranteed.
b.
www.reeme.arizona.edu
Oneway - Means Plot
Employment category
TechnicalMBA trainee
Exempt employeeCollege trainee
Security officerOffice trainee
Clerical
Mea
n of
Cur
rent
sal
ary
40000
30000
20000
10000
0
www.reeme.arizona.edu
Tipos de Análisis de Varianza
1 >1independ
>1relacionada
Paramétrico Oneway ANOVA
NoParamétrico
Kruskal-Wallis
Friedman
Número de Varbl. independientes
Condicionesprevias
www.reeme.arizona.edu
Kruskal-Wallis Oneway no paramétrico
Tests no paramétricos - K muestras independientes
www.reeme.arizona.edu
Kruskal-Wallis Estadísticos descriptivos
Ranks
227 187,70136 194,8227 278,9841 422,1532 427,335 438,306 460,83
474
Employment categoryClericalOffice traineeSecurity officerCollege traineeExempt employeeMBA traineeTechnicalTotal
Current salaryN Mean Rank
www.reeme.arizona.edu
Kruskal-WallisPrueba de la Mediana
Frequencies
80 48 25 41 32 5 6147 88 2 0 0 0 0
> Median<= Media
Current salaClerical
Officetrainee
Securityofficer
Collegetrainee
Exemptemployee
MBAtrainee Technical
Employment category
Test Statisticsb
47411550,00
135,133a
6,000
NMedianChi-SquaredfAsymp. Sig.
Currentsalary
4 cells (,0%) have expecThe minimum expected c
a.
Grouping Variable: Emplb.
www.reeme.arizona.edu
Kruskal-WallisContrastes
Estadísticos de contrasteb,c
208,3576
,000,000a
,000,000
Chi-cuadradoglSig. asintót.
Sig.Límite inferiorLímite superior
Intervalo deconfianza al99%
Sig. MonteCarlo
Currentsalary
Basado en 10000 tablas muestrales con semilla de inicio2000000.
a.
Prueba de Kruskal-Wallisb.
Variable de agrupación: Employment categoryc.
www.reeme.arizona.edu
FriedmanAnova de dos vías para muestras apareadas
Kendall W es un test de concordancia donde cada variable es un sujeto de estudio y cada caso es un juez.
Cochran Q se usa cuando todas las variables independientes son dicotómicas
Friedman es el test básico, que compara los rangos entre K variables relacionadas entre sí. Se basa en X2
www.reeme.arizona.edu
FriedmanResultados
Test Statistics
30,229
20,5733
,000
NKendall's W a
Chi-SquaredfAsymp. Sig.
Kendall's Coefficient of Conca.
Ranks
2,803,152,281,77
HBA1_BASALHBA1_SIST1HBA1_SIST2HBA1_SIST3
Mean Rank
Descriptive Statistics
30 7,657 1,748 4,8 11,830 7,660 1,123 6,2 10,330 7,250 1,279 5,8 11,630 7,117 1,372 5,2 10,5
HBA1_BASALHBA1_SIST1HBA1_SIST2HBA1_SIST3
N MeanStd.
Deviation Minimum Maximum
www.reeme.arizona.edu
ANOVA - otros modelos
ANOVA multivariado: MANOVA– Más de una variable dependiente– Gran complejidad de modelos
ANOVA medidas repetidas– La variable dependiente se mide en más de una ocasión para cada sujeto– Multivariante complejo
www.reeme.arizona.edu
MANOVA
www.reeme.arizona.edu
Manova -Resultados
Multivariate Testsc
,758 15,691a 2,000 10,000 ,001 ,758,242 15,691a 2,000 10,000 ,001 ,758
3,138 15,691a 2,000 10,000 ,001 ,7583,138 15,691a 2,000 10,000 ,001 ,758,370 2,932a 2,000 10,000 ,100 ,370,630 2,932a 2,000 10,000 ,100 ,370,586 2,932a 2,000 10,000 ,100 ,370,586 2,932a 2,000 10,000 ,100 ,370,118 ,669a 2,000 10,000 ,534 ,118,882 ,669a 2,000 10,000 ,534 ,118,134 ,669a 2,000 10,000 ,534 ,118,134 ,669a 2,000 10,000 ,534 ,118,240 1,578a 2,000 10,000 ,254 ,240,760 1,578a 2,000 10,000 ,254 ,240,316 1,578a 2,000 10,000 ,254 ,240,316 1,578a 2,000 10,000 ,254 ,240,127 ,728a 2,000 10,000 ,507 ,127,873 ,728a 2,000 10,000 ,507 ,127,146 ,728a 2,000 10,000 ,507 ,127,146 ,728a 2,000 10,000 ,507 ,127,212 1,341a 2,000 10,000 ,305 ,212,788 1,341a 2,000 10,000 ,305 ,212,268 1,341a 2,000 10,000 ,305 ,212,268 1,341a 2,000 10,000 ,305 ,212,703 1,192 10,000 22,000 ,348 ,351,404 1,147a 10,000 20,000 ,379 ,364
1,211 1,090 10,000 18,000 ,419 ,377,924 2,033b 5,000 11,000 ,152 ,480,210 1,332a 2,000 10,000 ,307 ,210,790 1,332a 2,000 10,000 ,307 ,210,266 1,332a 2,000 10,000 ,307 ,210,266 1,332a 2,000 10,000 ,307 ,210,313 2,279a 2,000 10,000 ,153 ,313,687 2,279a 2,000 10,000 ,153 ,313,456 2,279a 2,000 10,000 ,153 ,313,456 2,279a 2,000 10,000 ,153 ,313,155 ,918a 2,000 10,000 ,430 ,155,845 ,918a 2,000 10,000 ,430 ,155,184 ,918a 2,000 10,000 ,430 ,155,184 ,918a 2,000 10,000 ,430 ,155,367 ,825 6,000 22,000 ,563 ,184,654 ,787a 6,000 20,000 ,590 ,191,495 ,743 6,000 18,000 ,622 ,198,416 1,525b 3,000 11,000 ,263 ,294,000 ,a ,000 ,000 , ,
1,000 ,a ,000 10,500 , ,,000 ,a ,000 2,000 , ,,000 ,000a 2,000 9,000 1,000 ,000
Pillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest Root
EffectIntercept
EDAD
T_EVOLUC
DIETA_KC
DOSIS_T1
INYECC_D
CALIF_ED
SEXO
INYECC_D * CALIF_ED
INYECC_D * SEXO
CALIF_ED * SEXO
INYECC_D * CALIF_ED *SEXO
Value FHypothesis
df Error df Sig.Eta
Squared
Exact statistica.
The statistic is an upper bound on F that yields a lower bound on the significance level.b.
Design: Intercept+EDAD+T_EVOLUC+DIETA_KC+DOSIS_T1+INYECC_D+CALIF_ED+SEXO+INYECC_D *CALIF_ED+INYECC_D * SEXO+CALIF_ED * SEXO+INYECC_D * CALIF_ED * SEXO
c.
Between-Subjects Factors
921
235578
Hombre 12Mujer 18
34
Num.inyeccdiarias
356789
Niveleducaciondiabetologica
12
Sexo
ValueLabel N
www.reeme.arizona.edu
ANOVA medidas repetidas
Se define un factor intra-sujetos conel número de categorías o niveles adecuadoal número de mediciones realizadas Se especifican las variables de las mediciones
realizadas como grupos del factor intra-sujetos creado.Pueden definirse también covariables de corrección y factores de agrupamiento entre-sujetos.
www.reeme.arizona.edu
Resultados - Efectosintrasujetos
Tests of Within-Subjects Effects
Measure: MEASURE_1
3,343 3 1,114 2,631 ,0563,343 1,851 1,807 2,631 ,0863,343 2,216 1,509 2,631 ,0753,343 1,000 3,343 2,631 ,1171,962 3 ,654 1,544 ,2101,962 1,851 1,060 1,544 ,2251,962 2,216 ,885 1,544 ,2211,962 1,000 1,962 1,544 ,2251,594 3 ,531 1,255 ,2961,594 1,851 ,862 1,255 ,2921,594 2,216 ,719 1,255 ,2951,594 1,000 1,594 1,255 ,2732,583 3 ,861 2,033 ,1162,583 1,851 1,396 2,033 ,1452,583 2,216 1,165 2,033 ,1362,583 1,000 2,583 2,033 ,166
33,039 78 ,42433,039 48,115 ,68733,039 57,618 ,57333,039 26,000 1,271
Sphericity AssumedGreenhouse-GeisserHuynh-FeldtLower-boundSphericity AssumedGreenhouse-GeisserHuynh-FeldtLower-boundSphericity AssumedGreenhouse-GeisserHuynh-FeldtLower-boundSphericity AssumedGreenhouse-GeisserHuynh-FeldtLower-boundSphericity AssumedGreenhouse-GeisserHuynh-FeldtLower-bound
SourceFACTOR1
FACTOR1 * EDAD
FACTOR1 * T_EVOLUC
FACTOR1 * SEXO
Error(FACTOR1)
Type IIISum of
Squares dfMean
Square F Sig.
Within-Subjects Factors
Measure: MEASURE_1
HBA1_BASHBA1_S1HBA1_S2HBA1_S3
FACTOR11234
DependentVariable
Las pruebas de efectos entre sujetos icnluyendiversos tests. Se determinan también estadísticos para las interacciones con el factor estudiado.
www.reeme.arizona.edu
ANOVA medidas repetidasPruebas multivariadas
Multivariate Testsb
,234 2,446a 3,000 24,000 ,088,766 2,446a 3,000 24,000 ,088,306 2,446a 3,000 24,000 ,088,306 2,446a 3,000 24,000 ,088,119 1,086a 3,000 24,000 ,374,881 1,086a 3,000 24,000 ,374,136 1,086a 3,000 24,000 ,374,136 1,086a 3,000 24,000 ,374,240 2,526a 3,000 24,000 ,081,760 2,526a 3,000 24,000 ,081,316 2,526a 3,000 24,000 ,081,316 2,526a 3,000 24,000 ,081,107 ,960a 3,000 24,000 ,428,893 ,960a 3,000 24,000 ,428,120 ,960a 3,000 24,000 ,428,120 ,960a 3,000 24,000 ,428
Pillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest RootPillai's TraceWilks' LambdaHotelling's TraceRoy's Largest Root
EffectFACTOR1
FACTOR1 * EDAD
FACTOR1 * T_EVOLUC
FACTOR1 * SEXO
Value FHypothesis
df Error df Sig.
Exact statistica.
Design: Intercept+EDAD+T_EVOLUC+SEXO Within Subjects Design: FACTOR1
b.
www.reeme.arizona.edu
ANOVA medidas repetidas
Contrastes intra-sujetosTests of Within-Subjects Contrasts
Measure: MEASURE_1
2,609 1 2,609 5,764 ,024,532 1 ,532 ,931 ,343,202 1 ,202 ,820 ,373,504 1 ,504 1,114 ,301
1,437 1 1,437 2,513 ,1252,133E-02 1 2,133E-02 ,087 ,7711,680E-02 1 1,680E-02 ,037 ,849
1,232 1 1,232 2,155 ,154,346 1 ,346 1,403 ,247,683 1 ,683 1,508 ,230
1,782 1 1,782 3,118 ,089,118 1 ,118 ,478 ,496
11,769 26 ,45314,863 26 ,5726,407 26 ,246
FACTOR1LinearQuadraticCubicLinearQuadraticCubicLinearQuadraticCubicLinearQuadraticCubicLinearQuadraticCubic
SourceFACTOR1
FACTOR1 * EDAD
FACTOR1 * T_EVOLUC
FACTOR1 * SEXO
Error(FACTOR1)
Type IIISum ofSquares df
MeanSquare F Sig.
www.reeme.arizona.edu
ANOVA medidas repetidasBetween-Subjects Factors
Hombre 12Mujer 18
12
Sexo
ValueLabel N
Tests of Between-Subjects Effects
Measure: MEASURE_1Transformed Variable: Average
1139,147 1 1139,147 224,589 ,00055,247 1 55,247 10,892 ,00311,519 1 11,519 2,271 ,144
,346 1 ,346 ,068 ,796131,876 26 5,072
SourceInterceptEDADT_EVOLUCSEXOError
Type IIISum of
Squares dfMean
Square F Sig.
Top Related