Weekend Workshop I
This presentation is the property of its rightful owner.
Sponsored Links
1 / 23

Weekend Workshop I PowerPoint PPT Presentation


  • 93 Views
  • Uploaded on
  • Presentation posted in: General

Weekend Workshop I. PROC MIXED. Random or Fixed ?. Twins: One gets SAS training method 1 , the other gets method 2 Response Y = programming times. PROC MIXED Model. Model ; Random ; Repeated ;.

Download Presentation

Weekend Workshop I

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Weekend workshop i

Weekend Workshop I

PROC MIXED


Weekend workshop i

Random or Fixed ?


Weekend workshop i

Twins: One gets SAS training method 1, the other gets method 2

Response Y = programming times


Weekend workshop i

PROC MIXED Model

Model ; Random ; Repeated ;

Y = X b + Zg + e

Variance of g is G = ,Variance of e is R =


Weekend workshop i

PROCMIXED DATA=TWINS;

CLASS FAMILY METHOD;

MODEL TIME = METHOD; * fixed;

RANDOM FAMILY; *<- family ~ N(0, s2F) ;

Covariance Parameter Estimates

Cov Parm Estimate

family 21.2184

Residual 40.8338

Type 3 Tests of Fixed Effects

Num Den

Effect DF DF F Value Pr > F

method 1 19 9.60 0.0059

Intraclass correlation (related to heritability)

s2F /(s2F + s2)

Estimated as 21.2/62 or about 1/3.

Q: Why not usual (Pearson) correlation?


Weekend workshop i

Demo

Get_Twins.sas

Twins_MIXED.sas


Weekend workshop i

BLUP

Yij = m + Fi + eij

Di = Family mean – m = Fi + ei.

best estimate of Fi = ?

Variance of (Fi – b Di) is (1-b)2s2F + b2s2/2

Use b = s2F /(s2F + s2/2)

Estimate: b = 21.2/(21.2 + 40.8/2) = 0.510

Overall mean + 0.510(Family i mean – Overall mean)

PROCMIXED DATA=TWINS;

CLASS FAMILY METHOD;

MODEL TIME = METHOD;

RANDOM FAMILY;

ESTIMATE "1 " intercept 1 | family 1;

ESTIMATE "2 " intercept 1 | family 01;

PROCGLM DATA=TWINS;

CLASS FAMILY METHOD;

MODEL TIME = FAMILY METHOD;

LSMEANS FAMILY;


Weekend workshop i

MEANS andBLUPs

(GLM)

(MIXED)


Weekend workshop i

Demo

Twins_BLUP.sas

Twins_TEST.sas


Weekend workshop i

ML Estimation

Search over all (fixed and random) parameters

Estimates of variances biased low! 

  • REML Estimation

  • Regress out fixed effects

  • Maximze likelihood of residuals (mean known: 0)

  • Variance estimates less biased (unbiased in some simple cases) 


Weekend workshop i

Unbalanced Data

I vs. III free of subject effects for red data.

Misses info in other data.


Weekend workshop i

procglm; class plug worker;

model loss = worker plug; Random Worker;

Estimate "I vs III - GLM" Plug -101; run;

procmixed; class plug worker;

model Loss=Plug; Random Worker;

Estimate "I vs III - Mixed" Plug -101; run;

Covariance Parameter

Estimates

Cov Parm Estimate

worker 37.578

Residual 6.1674

GLM

Source DF Type III SS F Value Pr > F

worker 6 451.9062500 12.21 0.0074

plug 2 62.6562500 5.08 0.0625

Standard

Parameter Estimate Error t Value Pr > |t|

I vs III - GLM -4.8125 1.9635 -2.45 0.0579

Type 3 Tests of Fixed Effects

Num Den

Effect DF DF F Value Pr > F

plug 2 5 5.79 0.0499

Estimates

Standard

Label Estimate Error DF t Value Pr > |t|

I vs III - Mixed -5.2448 1.9347 5 -2.71 0.0422


Weekend workshop i

Demo

Earplugs.sas


Weekend workshop i

SPLIT PLOT

4 Aquariums,

2 aerated

2 not

six dishes / aquarium

one plant / dish

soil x variety combinations

ANOVA

Source

Air

Error A

V

S

VA

VS

AS

AVS

Error B

Soil Variety

1 1

1 2

2 1

2 2

3 1

3 2


Weekend workshop i

Compare Air to No Air within soil 1

Variance of this contrast is hard to figure out:

(1/3)[MS(A)+2 MS(B)]

Need Satterthwaite df

AUTOMATIC IN MIXED!!!

PROCMIXED;

CLASS VAR AQUARIUM SOIL AIR;

MODEL YIELD = AIR SOIL VAR SOIL*VAR

AIR*SOIL AIR*VAR AIR*SOIL*VAR /

DDFM=SATTERTHWAITE;

RANDOM AQUARIUM(AIR);

ESTIMATE "SOIL 1: AIR EFFECT"

AIR -11 AIR*SOIL -110000;

RUN;


Weekend workshop i

Covariance Parameter Estimates

Cov Parm Estimate

AQUARIUM(AIR) 2.1833

Residual 7.7333

Type 3 Tests of Fixed Effects

Num Den

Effect DF DF F Value Pr > F

AIR 1 2 16.20 0.0565 

SOIL 2 10 7.87 0.0088

VAR 1 10 24.91 0.0005

VAR*SOIL 2 10 0.04 0.9631

SOIL*AIR 2 10 1.08 0.3752

VAR*AIR 1 10 4.22 0.0669

VAR*SOIL*AIR 2 10 0.23 0.7973

Standard 

Label Estimate Error DF t Value Pr > |t|

SOIL 1: AIR EFFECT 5.2500 2.4597 5.47 2.13 0.0812


Weekend workshop i

Demo

Aquarium.sas


Weekend workshop i

Random Coefficient Models

the basic idea

mistakes

Dave

Averageprogrammer

a0 + b0 t

Program writing time

Line for individual j: (a0 + aj) + ( b0 + bj )t


Weekend workshop i

  • Hierarchial Models

  • Same as split plot - almost

  • Whole and split level continuous predictor variables (typically)

  • Aquarium level (level i): pHi

  • Dish level: Soil nitrogen test (Nij)

  • Yij = ai + biNij+eij

  • (3) Idea: ai = a0 + a1pHi + ai*

  • bi = b0 + b1pHi + bi*

Yij = [a0 + a1pHi + b0Nij+ b1pHiNij] + [ai* +bi* Nij+eij]

fixed random

PROC MIXED DATA = UNDERWATER;

MODEL GROWTH = N P N*P;

RANDOM INTERCEPT N / SUBJECT = TANK TYPE=UN;

Yij = ai + biNij+eij

Yij = a0 + a1pHi + ai* + biNij+eij

Yij = a0 + a1pHi + ai* + (b0 + b1pHi + bi* ) Nij+eij


Weekend workshop i

p

aquarium

N pH growth

1 2.21 5.5 27.05

1 1.25 5.5 25.92

1 4.36 5.5 30.09

1 7.14 5.5 33.66

1 8.61 5.5 36.13

1 6.53 5.5 33.00

2 6.58 4.7 35.72

2 3.12 4.7 31.17

2 5.28 4.7 34.35

2 1.09 4.7 28.34

2 4.83 4.7 33.56

2 9.61 4.7 40.25

3 7.99 4.2 47.04

3 7.79 4.2 46.56

3 8.32 4.2 48.27

3 2.53 4.2 34.20

3 6.85 4.2 44.59

3 4.73 4.2 39.29

4 0.95 5.1 24.94

4 2.00 5.1 27.33

4 9.99 5.1 43.84

4 0.23 5.1 23.54

4 0.13 5.1 23.56

4 1.17 5.1 25.68

Num Den

Effect DF DF F Value Pr > F

N 1 2 3.50 0.2018

pH 1 2.05 6.76 0.1186

N*pH 1 2 1.31 0.3702

Num Den

Effect DF DF F Value Pr > F

N 1 3 50.19 0.0058

pH 1 2.03 14.68 0.0603

Cov Parm Estimate

UN(1,1) 1.8976

UN(2,1) -0.5563

UN(2,2) 0.2596

Residual 0.0286

N

pH


Weekend workshop i

Demo

Hierarchial.sas


Weekend workshop i

Next: Repeated Measures

Notes in pdf from NCSU experimental design class

(ST 711)


Weekend workshop i

Demo

SURGERY.sas


  • Login