Presentation is loading. Please wait.

Presentation is loading. Please wait.

From t-test to multilevel analyses Del-3

Similar presentations


Presentation on theme: "From t-test to multilevel analyses Del-3"— Presentation transcript:

1 From t-test to multilevel analyses Del-3
Stein Atle Lie, statistician, professor Uni Health, Uni Research

2 Outline Pared t-test (Mean and standard deviation)
Two-group t-test (Mean and standard deviations) Linear regression GLM (general linear models) GLMM (general linear mixed model) PASW (former SPSS), Stata, R, gllamm (Stata)

3 Pared t-test The straightforward way to analyze two repeated measures is a pared t-test. Measure at time1 or location1 (e.g. Data1) is directly compared to measure at time2 or location2 (e.g. Data2) Is the difference between Data1 and Data2 (Diff = Data1-Data2) unlike 0?

4 Pared t-test The pared t-test will only be performed for complete (balanced) data. What happens if we delete two observations from data2? (Only 8 complete pairs remain)

5 Correlation Correlation (Bivariat-correlation)
is only calculated for complete (balanced) data. pairs of data

6 Linear regression Ordinary linear regression
Assumes data is Normal and i.i.d. (identical independent distributed)

7 Linear regression Assumptions - Residualer (ei): yi = a + b·xi + ei
1) e1, e2,…, en are independent normal distributed 2) The expectation of ei is: E(ei) = 0 3) The variance of ei is: var(Yi) = var(ei) = s2

8 Ordinary linear regression
The formula for an ordinary regression can thus be expressed as: yi = b0 + b1·xi + ei ei ~N(0, se2)

9 Random intercept model
Y Regression lines: yij = b0 + b1·xij+vij (x11,y11) b1 (xnp,ynp) b0+uj (xij,yij) su se X

10 Variance component model
For a random variance component model, we can express the regression line(s) - and the variance components as yij = b0 + b1·xij + vij vij = uj + eij eij ~N(0, se2) (individual) uj ~N(0, su2) (group)

11 Random intercept model
Alternatively we may express the formulas, for the simple variance component model, in terms of random intercepts: yij = b0j + b1·xij + eij b0j = b0 + uj eij ~N(0, se2) (individual) uj ~N(0, su2) (group)

12 Intra class correlation (ICC)
The total variance is hence: se2 + su2 = sT2 The proportion of variance attributed to the group (level 2) - which is also the correlation between the observations within the group is: ICC = su2/sT2

13 Software Personal opinion
PASW/SPSS Very easy to do simple models (menu/syntax) Arrange/restructure data Stata Steeper learning curve to start Easy () to extend the simpler models to more sophisticated models glamm R Steep learning curve Nice graphics

14 Cortisol data Cortisol level in saliva measured each morning in 3 days, in two periods* 55 individuals 278 observations (52 missing) * The real data was measured 5 times per day, in 3 days and 3 periods - from the article: Harris A, Marquis P, Eriksen HR, Grant I, Corbett R, Lie SA, Ursin H. Diurnal rhythm in British Antarctic personnel. Rural Remote Health Apr-Jun;10(2):1351.

15 Cortisol data – missing data

16 Cortisol data – long data format

17 Cortisol data Period1 Period2

18 Linear model Stata: . glm kortisol period2 day2 day3, cluster(id)
(. regress kortisol period2 day2 day3, cluster(id)) Generalized linear models No. of obs = Optimization : ML Residual df = (Std. Err. adjusted for 55 clusters in id) | Robust kortisol | Coef. Std. Err z P>|z| [95% Conf. Interval] period2 | day2 | day3 | _cons |

19 Linear mixed model (variance component)
Stata: . gllamm kortisol period2 day2 day3, i(id) number of level 1 units = 278 number of level 2 units = 55 kortisol | Coef. Std. Err z P>|z| [95% Conf. Interval] period2 | day2 | day3 | _cons | Variance at level ( ) Variances and covariances of random effects level 2 (id) var(1): ( ) ICC=0.218

20 Linear mixed model (variance component)
lmer(Kortisol~1+Day2+Day3+Period2 +(1|ID),data=kortisol) Random effects: Groups Name Variance Std.Dev. ID (Intercept) Residual Number of obs: 278, groups: ID, 55 Fixed effects: Estimate Std. Error t value (Intercept) Day Day Period ICC=0.219

21 Cortisol data Period1 Period2

22 Linear mixed model (variance component)
PASW: MIXED Kortisol BY ID WITH Period2 Day2 Day3 /FIXED=Period2 Day2 Day3 | SSTYPE(3) /METHOD=REML /PRINT=SOLUTION /RANDOM=ID | COVTYPE(VC). ICC=0.219

23 Linear mixed model (random intercept model)
lmer(Kortisol~1+Day+Period2 +(1|ID),data=kortisol) Random effects: Groups Name Variance Std.Dev. ID (Intercept) Residual Number of obs: 278, groups: ID, 55 Fixed effects: Estimate Std. Error t value (Intercept) Day Period ICC=0.220

24 Linear mixed model (random intercept model)
Period1 Period2

25 Linear mixed model (random slope model)
lmer(Kortisol~1+Day+Period2 +(Day-1|ID),data=kortisol) Random effects: Groups Name Variance Std.Dev. ID Day e ! Residual e Number of obs: 278, groups: ID, 55 Fixed effects: Estimate Std. Error t value (Intercept) Day Period

26 Linear mixed model (random slope model)
Period1 Period2

27 Linear mixed model (random slope & intercept)
lmer(Kortisol~1+Day+Period2 +(1+Day|ID),data=kortisol) Random effects: Groups Name Variance Std.Dev. Corr ID (Intercept) Day Residual Number of obs: 278, groups: ID, 55 Fixed effects: Estimate Std. Error t value (Intercept) Day Period ICC=0.257

28 Linear mixed model (random slope model)
Period1 Period2

29 Summary The interpretation of parameter estimates of categorical variables (preferably dummy variables) from linear models can be interpreted as mean differences, as from ordinary t-test This is equivalent in models for repeated or clustered observations!


Download ppt "From t-test to multilevel analyses Del-3"

Similar presentations


Ads by Google