Download - GENERAL LINEAR MODELS
![Page 1: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/1.jpg)
GENERAL LINEAR MODELS
Oneway ANOVA, GLM Univariate (n-way ANOVA,
ANCOVA)
![Page 2: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/2.jpg)
BASICS Dependent variable is continuous Independent variables are nominal,
categorical (factor, CLASS) or continuous (covariate)
Are the group means of the dependent variable different across groups defined by the independents
Main effects, interactions and nested effects
Often used for testing hypotheses with experimental data
![Page 3: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/3.jpg)
BASICSFactor A (industry)Level 1 (manufact)
Factor A (industry)Level 2 (trade)
Factor B (size)Level 1 (small)
Cell
Factor B (size)Level 2 (medium)Factor B (size)Level 3 (large)
3 X 2 full factorial design (full: each cell has observations)
Balanced design: each cell has equal number of observations
![Page 4: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/4.jpg)
ASSUMPTIONS Enough observations in each group? (n
>20) Independence of observations Similarity of variance-covariance matrices
(no problem if largest group variance < 1.5*smallest group variance, 4* if balanced design)
Normality Linearity No outlier-observations
![Page 5: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/5.jpg)
STEPS OF INTERPRETATION Model significance?
F-test and R square Welch, if unequal group variances
(this can be tested using Levene or Brown-Forsythe test)
Significance of effects? (F-test and partial eta squared)
Which group differences are significant? Post hoc or contrast tests
What are the group differences like? Estimated marginal means for groups
![Page 6: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/6.jpg)
Oneway ANOVA A continuous dependent variable (y) and
one categorical independent variable (x), with min. 3 categories, k= number of categories
assumptions: y normally distributed with equal variance in each x category
H0: mean of y is the same in all x categories
Variance of y is divided into two components: within groups (error) and between groups (model, treatment)
Test statistic= between mean square / within mean square follows F-distribution with k-1, n-k degrees of freedom
F-test can be replaced by Welch if variances are unequal
![Page 7: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/7.jpg)
Oneway ANOVA If the F test is significant, you
can use post hoc tests for pairwise comparison of means across the groups
Alternatively (in experiments) you can define contrasts ex ante
Contrast Coefficients
1 0 -1 0,5 ,5 -1 0
Contrast12
vaalea tumma punainen kaljuhiusten väri
![Page 8: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/8.jpg)
SAS: oneway ANOVA
![Page 9: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/9.jpg)
SAS: oneway ANOVA
BF or Levene, H0: group variances are equal
Use this instead of F if variances are not equal
![Page 10: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/10.jpg)
SAS: oneway ANOVAPost hoc -tests
![Page 11: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/11.jpg)
SAS: oneway ANOVA
![Page 12: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/12.jpg)
SAS: oneway ANOVA
![Page 13: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/13.jpg)
MODEL FIT
Source DFSum of
Squares Mean Square F Value Pr > FModel 3 298.3992640 99.4664213 13.41 <.0001Error 68 504.4139305 7.4178519
Corrected Total 71 802.8131944
R-Square Coeff Var Root MSE deathrate Mean0.371692 34.10981 2.723573 7.984722
Class Level Information
Class Levels Valuesclass_popgrowth 4 1 2 3 4
![Page 14: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/14.jpg)
EQUALITY OF VARIANCESLevene's Test for Homogeneity of deathrate VarianceANOVA of Squared Deviations from Group Means
Source DFSum of
SquaresMean
Square F Value Pr > Fclass_popgrowth 3 3004.3 1001.4 4.23 0.0084
Error 68 16110.6 236.9
Welch's ANOVA for deathrate
Source DF F Value Pr > Fclass_popgrowth 3.0000 13.00 <.0001
Error 18.9519
![Page 15: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/15.jpg)
GROUP MEANS
Level ofclass_popgrowth N
deathrate
Mean Std Dev1 27 10.5666667 3.01457996
2 22 6.9272727 1.60064922
3 17 5.9705882 1.87941637
4 6 5.9500000 5.61809576
![Page 16: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/16.jpg)
POST HOC TESTComparisons significant at the 0.05 level are indicated by ***.
class_popgrowthComparison
DifferenceBetween
MeansSimultaneous 95% Confidence Limits
1 - 2 3.6394 1.5135 5.7653 ***1 - 3 4.5961 2.3044 6.8877 ***1 - 4 4.6167 1.2760 7.9573 ***2 - 1 -3.6394 -5.7653 -1.5135 ***2 - 3 0.9567 -1.4335 3.34682 - 4 0.9773 -2.4317 4.38623 - 1 -4.5961 -6.8877 -2.3044 ***3 - 2 -0.9567 -3.3468 1.43353 - 4 0.0206 -3.4942 3.53534 - 1 -4.6167 -7.9573 -1.2760 ***4 - 2 -0.9773 -4.3862 2.43174 - 3 -0.0206 -3.5353 3.4942
![Page 17: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/17.jpg)
BOXPLOTS
![Page 18: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/18.jpg)
Multiway ANOVA, GLM A continuous dependent variable y, two or
more categorical independent variables (factorial design)
ANCOVA, if there are continuous independents (covariates)
main effects and interaction effects can be modeled
fixed factor, if all groups are present and random factor, if only some groups are randomly represented in the data
Eta squared = SSK/SST expresses how many % of the variance in y is explained by x (not in EG! SAS code: model y = x1 x2 / ss3 EFFECTSIZE;)
![Page 19: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/19.jpg)
INTERACTION EFFECT Synergy of two factors, the effect
of one factor is different in the groups of the other factor
Crossing effect = interaction effect Ordinal (lines in means plot have
different slopes, but do not cross) Disordinal (lines cross in the
means plot)
![Page 20: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/20.jpg)
NO INTERACTION
Size and industry both have a significant main effect
No interaction, homogeneity of slopes
mean of profitability
0
10
20
30
40
small medium large
manufact
trade
![Page 21: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/21.jpg)
INTERACTIONSOrdinal interaction (the effect of size is stronger in manufacturing than in trade)
Dis-ordinal interaction (the effect of size has a different sign in manufacturing and trade)
mean of profitability
0
10
20
30
40
50
small medium large
manufact
trade
mean of profitability
0
10
20
30
40
50
small medium large
manufact
trade
![Page 22: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/22.jpg)
NESTED EFFECTS Nested effect B(A) ”B nested within A” size (industry): the effect of size is
estimated separately for each industry group
Difference between nested and interaction effect is that the main effect of B (size) is not included
The slope of B (size) is different in each category of A (industry)
![Page 23: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/23.jpg)
ESTIMATED GROUP MEANS Estimated marginal means or LS
(least squares) means Predicted group means are
calculated using the estimated model coefficients
The effects of other independent variables are controlled for
Is not equal to the group means from the sample
![Page 24: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/24.jpg)
SUM OF SQUARES Type I SS does not control for the
effects of other independent variables which are specified later into the model
Type II SS controls for the effects of all other independents
Types III and IV SS are better in unbalanced designs, IV if there are empty cells
![Page 25: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/25.jpg)
POST HOC TESTS Multiple comparison procedures, mean
separation tests The idea is to avoid the risk of Type I error
which results from doing many pairwise tests, each at 5% risk level
E.g. Bonferroni, Scheffe, Sidak,… Tukey-Kramer is most powerful H0: equal group means -> rejection means
that group means are not equal, but failure to reject does not necessarily mean that they are equal (small sample size -> low power -> failure to reject the null)
![Page 26: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/26.jpg)
ANCOVA The model includes a covariate (= continuous
independent variable, often one whose effect you want to control for)
Regress y on the covariate -> then ANOVA with factors explaining the residual
The relationship between covariate and y must be linear, and the slope is assumed to be the same at all factor levels
The covariate and factor should not be too much related to each other
Do not include too many covariates, max 0.1*n – (k-1)
![Page 27: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/27.jpg)
SAS: analyze – ANOVA – linear models
![Page 28: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/28.jpg)
Effects to be estimated
Interaction here, first select both variables, then click Cross
![Page 29: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/29.jpg)
Sums of squares
![Page 30: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/30.jpg)
Other options, defaults ok
![Page 31: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/31.jpg)
Post hoc-tests
![Page 32: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/32.jpg)
Plots
![Page 33: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/33.jpg)
SAS - codePROC GLM DATA=libname.datafilename
PLOTS(ONLY)=DIAGNOSTICS(UNPACK)PLOTS(ONLY)=RESIDUALSPLOTS(ONLY)=INTPLOT;CLASS Elinkaari Perheyr;MODEL growthorient= ln_hlo Elinkaari Perheyr Elinkaari*Perheyr/SS3SOLUTIONSINGULAR=1E-07EFFECTSIZE;LSMEANS Elinkaari Perheyr Elinkaari*Perheyr / PDIFF ADJUST=BON ;RUN;
QUIT;
![Page 34: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/34.jpg)
Model significance and fitClass Level Information
Class Levels ValuesElinkaari phase 3 2 3 4Perheyr family 2 0 1
Number of Observations Read 181Number of Observations Used 132
Source DFSum of
Squares Mean Square F Value Pr > FModel 6 13.03085542 2.17180924 3.59 0.0026Error 125 75.69810081 0.60558481Corrected Total 131 88.72895623
R-Square Coeff Var Root MSE growthorient Mean0.146861 21.79382 0.778193 3.570707
![Page 35: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/35.jpg)
Significance of predictorsSource DF Type III SS Mean Square F Value Pr > Fln_hlo employees 1 2.88693851 2.88693851 4.77 0.0309Elinkaari phase 2 9.52176337 4.76088169 7.86 0.0006Perheyr family 1 0.28960870 0.28960870 0.48 0.4905Elinkaari*Perheyr
Phase*Family
2 1.99071120 0.99535560 1.64 0.1974
![Page 36: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/36.jpg)
EFFECT SIZE OF PREDICTORS
Source
Total Variation Accounted For Partial Variation Accounted For
Semipartial Eta-Square
Semipartial Omega-Square
Conservative95% Confidence Li
mitsPartial Eta-
Square
Partial Omega-Square
95% Confidence Limits
ln_hlo 0.0325 0.0255 0.0000 0.1112 0.0367 0.0277 0.0000
0.1158
Elinkaari 0.1073 0.0930 0.0219 0.2056 0.1117 0.0942 0.0225
0.2073
Perheyr 0.0033 -0.0035 0.0000 0.0488 0.0038 -0.0040 0.0000
0.0503
Elinkaari*Perheyr
0.0224 0.0087 0.0000 0.0842 0.0256 0.0097 0.0000
0.0887
![Page 37: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/37.jpg)
Parameter estimatesParameter Estimate
Standard Error t Value Pr > |t|
Intercept 3.196306815 B 0.49826714 6.41 <.0001ln_hlo employees 0.161079578 0.07377500 2.18 0.0309Elinkaari 2 growth 0.372704251 B 0.49030119 0.76 0.4486Elinkaari 3 mature -0.041166136 B 0.46224369 -0.09 0.9292Elinkaari 4 decline 0.000000000 B . . .Perheyr 0 non family -0.862973482 B 0.92404272 -0.93 0.3522Perheyr 1 family 0.000000000 B . . .Elinkaari*Perheyr 2 0 1.250588328 B 0.98491805 1.27 0.2065Elinkaari*Perheyr 2 1 0.000000000 B . . .Elinkaari*Perheyr 3 0 0.654885600 B 0.94241380 0.69 0.4884Elinkaari*Perheyr 3 1 0.000000000 B . . .Elinkaari*Perheyr 4 0 0.000000000 B . . .Elinkaari*Perheyr 4 1 0.000000000 B . . .
![Page 38: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/38.jpg)
38
Prediction for 6 cells Elinkaari=2 & perheyr=0 (growth phase, non family)
Growth = 3.20 + 0.16*ln_hlo + 0.37 – 0.86 + 1.25= 3.96 + 0.16*ln_hlo
Elinkaari=3 & perheyr=0 (mature phase, non family)Growth = 3.20 + 0.16*ln_hlo – 0.04 – 0.86 + 0.65
= 2.95 + 0.16*ln_hlo Elinkaari=4 & perheyr=0 (decline phase, non family)
Growth = 3.20 + 0.16*ln_hlo + 0.00 – 0.86 + 0.00= 2.34 + 0.16*ln_hlo
Elinkaari=2 & perheyr=1 (growth phase, family)Growth = 3.20 + 0.16*ln_hlo + 0.37 + 0.00 + 0.00
= 3.57 + 0.16*ln_hlo Elinkaari=3 & perheyr=1 (mature phase, family)
Growth = 3.20 + 0.16*ln_hlo - 0.04 + 0.00 + 0.00= 3.16 + 0.16*ln_hlo
Elinkaari=4 & perheyr=1 (decline phase, family)Growth = 3.20 + 0.16*ln_hlo + 0.00 + 0.00 + 0.00
= 3.20 + 0.16*ln_hlo
![Page 39: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/39.jpg)
39
Parameter estimatesThe X'X matrix has been found to be singular, and a generalized inverse was used to solve the normal equations. Terms whose estimates are followed by the letter 'B' are not uniquely estimable.
This warning always occurs if you have categorical independent variables in the model, SAS can however estimate the coefficients
![Page 40: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/40.jpg)
Homoskedasticity
![Page 41: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/41.jpg)
Outlier diagnostics
![Page 42: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/42.jpg)
Residual distribution
![Page 43: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/43.jpg)
Model fit
![Page 44: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/44.jpg)
Influence diagnostics
![Page 45: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/45.jpg)
Residual vs. covariate
![Page 46: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/46.jpg)
Significance of group differences, main effects
Elinkaari
phasegrowthorient
LSMEANLSMEAN
Number2 growth 4.14643211 13 mature 3.43471035 24 decline 3.14843369 3
Least Squares Means for effect ElinkaariPr > |t| for H0: LSMean(i)=LSMean(j)
Dependent Variable: growthorienti/j 1 2 31 0.0006 0.12252 0.0006 1.00003 0.1225 1.0000
Perheyr
Familygrowthorient
LSMEAN
H0:LSMean1=LSMean2
Pr > |t|0 3.46261763 0.4905
1 3.69043314
![Page 47: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/47.jpg)
Significance of group differences, interaction
Phase Familygrowthorient
LSMEANLSMEAN
Number2 growth 0 4.34023953 12 1 3.95262468 23 mature 0 3.33066641 33 1 3.53875430 44 decline 0 2.71694695 54 1 3.57992043 6
Least Squares Means for effect Elinkaari*PerheyrPr > |t| for H0: LSMean(i)=LSMean(j)
Dependent Variable: growthorienti/j 1 2 3 4 5 61 1.000
00.016
10.105
20.847
41.0000
2 1.0000
0.1040
0.8177
1.0000
1.0000
3 0.0161
0.1040
1.0000
1.0000
1.0000
4 0.1052
0.8177
1.0000
1.0000
1.0000
5 0.8474
1.0000
1.0000
1.0000
1.0000
6 1.0000
1.0000
1.0000
1.0000
1.0000
Non-family firms in growth phase differ from non-family firms in mature phase
![Page 48: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/48.jpg)
REPORTING GLM Model fit: F + df + p and R Square Nature and significance of effects:
parameter estimates B+s.e.+t+p and F+p
estimated group means (means plot)
post hoc test results
![Page 49: GENERAL LINEAR MODELS](https://reader036.vdocuments.us/reader036/viewer/2022081507/568162e0550346895dd364da/html5/thumbnails/49.jpg)
Means plot
kasvuvaihe vakiintunut loppumassa1
1.5
2
2.5
3
3.5
4
4.5
5
perheyrei-perheyr
kasv
uhak
uisu
us
Employees at its mean value (20)