Presentation is loading. Please wait.

Presentation is loading. Please wait.

4-Oct-07GzLM PresentationBIOL 79321 The GzLM and SAS Or why it’s a necessary evil to learn code! Keith Lewis Department of Biology Memorial University,

Similar presentations


Presentation on theme: "4-Oct-07GzLM PresentationBIOL 79321 The GzLM and SAS Or why it’s a necessary evil to learn code! Keith Lewis Department of Biology Memorial University,"— Presentation transcript:

1 4-Oct-07GzLM PresentationBIOL 79321 The GzLM and SAS Or why it’s a necessary evil to learn code! Keith Lewis Department of Biology Memorial University, St. John’s, Canada

2 4-Oct-07GzLM PresentationBIOL 79322 Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)

3 4-Oct-07GzLM PresentationBIOL 79323 Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)

4 4-Oct-07GzLM PresentationBIOL 79324 Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)

5 4-Oct-07GzLM PresentationBIOL 79325 Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)

6 4-Oct-07GzLM PresentationBIOL 79326 Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)

7 4-Oct-07GzLM PresentationBIOL 79327 Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)

8 4-Oct-07GzLM PresentationBIOL 79328 Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)

9 4-Oct-07GzLM PresentationBIOL 79329

10 4-Oct-07GzLM PresentationBIOL 793210

11 4-Oct-07GzLM PresentationBIOL 793211

12 4-Oct-07GzLM PresentationBIOL 793212 SAS Proc’s: the basics Data [dataset]; Infile [filename]; input [variables]; proc [glm (or genmod)]; model [model]; run;

13 4-Oct-07GzLM PresentationBIOL 793213 SAS PROC GLM – Lin. Reg. Data nest97; infile ‘e:\testdata\97exp1.prn’; input lake treat type pred n; proc glm; model pred = lake treat type; run;

14 4-Oct-07GzLM PresentationBIOL 793214 SAS PROC GLM - ANOVA Data nest97; infile ‘e:\testdata\97exp1.prn’; input lake treat type pred n; proc glm; class lake treat type; model pred = lake treat type; run;

15 4-Oct-07GzLM PresentationBIOL 793215 SAS PROC GLM - ANOVA Data nest97; infile ‘e:\testdata\97exp1.prn’; input lake $ treat $ type $ pred n; proc glm; class lake treat type; model pred = lake treat type; run;

16 4-Oct-07GzLM PresentationBIOL 793216 SAS PROC GLM - ANCOVA Data nest97; infile ‘e:\testdata\97exp1.prn’; input lake treat type pred n; proc glm; class treat type; model pred = lake treat type; run;

17 4-Oct-07GzLM PresentationBIOL 793217 SAS PROC GENMOD – Log-Linear Data nest97; infile ‘e:\testdata\97exp1.prn’; input lake treat type pred n; proc genmod; class lake treat type; model pred = lake treat type / dist=poisson link=log type1 type3; run;

18 4-Oct-07GzLM PresentationBIOL 793218 SAS PROC GENMOD – Logistic Regression Data nest97; infile ‘e:\testdata\97exp1.prn’; input lake treat type pred n; proc genmod; class lake treat type; model pred/n = lake treat type / dist=binomial link=logit type1 type3; run;

19 4-Oct-07GzLM PresentationBIOL 793219 A full example data an_01; infile 'C:\Documents and Settings\Micro-Tech Customer\My Documents\MyWork\thesis\ SAS\ch4\An_2000a.csv' firstobs=2 delimiter = ','; input park $ site $ grid $ nest $ dp vt; proc genmod; class park site grid nest; model dp = park|grid|nest / dist=bin link=logit type1 type3; /*make obstats out=keith noprint;*/ title 'Schmidts model, 2000 with contrasts'; lsmeans park grid nest; contrast 'bird v control' nest 1 -1 0; contrast 'contrl v large' nest 0 1 -1; estimate 'contrl v large' nest 0 1 -1; estimate 'bird v control' nest 1 1 0; estimate 'bF v bS' park 1 -1; estimate 'con v food' grid 1 -1; run;

20 4-Oct-07GzLM PresentationBIOL 793220 Deviance and G-tests GzLMs based on Maximum Likelihood Estimates (MLE) D= -2ln [likelihood of (current model) / (saturated model)] G=D(for model w/ variable)-D(model w/o variable) G is analagous to F-tests for GLM

21 4-Oct-07GzLM PresentationBIOL 793221 GENMOD output LR Statistics For Type 1 Analysis Chi- Source Deviance DF Square Pr > ChiSq Intercept 321.4338 park 319.7385 1 1.70 0.1929 grid 314.1447 1 5.59 0.0180 park*grid 313.5346 1 0.61 0.4348 nest 310.1887 2 3.35 0.1877 park*nest 310.1033 2 0.09 0.9582 grid*nest 306.9164 2 3.19 0.2032 park*grid*nest 306.3648 2 0.55 0.7590 321.4338-319.7385 = 1.70, Chisquare = 1.70, df = 1 p = 0.1929

22 4-Oct-07GzLM PresentationBIOL 793222 GENMOD output LR Statistics For Type 3 Analysis Chi- Source DF Square Pr > ChiSq park 1 2.62 0.1052 grid 1 7.45 0.0064 park*grid 1 0.81 0.3672 nest 2 3.45 0.1783 park*nest 2 0.13 0.9391 grid*nest 2 3.37 0.1853 park*grid*nest 2 0.55 0.7590

23 4-Oct-07GzLM PresentationBIOL 793223 Why we use GzLM Same Data, Same Distribution From Sokal and Rohlf 1995, Box 11.2

24 4-Oct-07GzLM PresentationBIOL 793224 Why we use GzLM Same Data, Same Distribution From Sokal and Rohlf 1995, Box 11.2

25 4-Oct-07GzLM PresentationBIOL 793225 Why we use GzLM Same Data, Different Distribution (K.Lewis, M.Sc data)

26 4-Oct-07GzLM PresentationBIOL 793226 Why we use GzLM Same Data, Different Distribution (K.Lewis, M.Sc data) See Lewis 2005, Oikos

27 4-Oct-07GzLM PresentationBIOL 793227 SAS v. R SAS –Powerful –Widely used –Learning curve –Expensive R –Powerful –“limited” use –Learning curve –Free Resources –Peter Earle –The web!!!!

28 4-Oct-07GzLM PresentationBIOL 793228 References Criteria: –Readability –Examples with the software code! A. Agresti. 1996. Introduction to Categorical Data Analysis. Wiley & Sons, New York. Littel et al. 2002. SAS for Linear Models 4 th ed. Cary, NC: SAS Institute Inc.


Download ppt "4-Oct-07GzLM PresentationBIOL 79321 The GzLM and SAS Or why it’s a necessary evil to learn code! Keith Lewis Department of Biology Memorial University,"

Similar presentations


Ads by Google