4-Oct-07GzLM PresentationBIOL 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
4-Oct-07GzLM PresentationBIOL Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)
4-Oct-07GzLM PresentationBIOL Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)
4-Oct-07GzLM PresentationBIOL Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)
4-Oct-07GzLM PresentationBIOL Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)
4-Oct-07GzLM PresentationBIOL Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)
4-Oct-07GzLM PresentationBIOL Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)
4-Oct-07GzLM PresentationBIOL Variables, Links, and Models ( Introduction to Categorical Data Analysis, A. Gresti 1996)
4-Oct-07GzLM PresentationBIOL 79329
4-Oct-07GzLM PresentationBIOL
4-Oct-07GzLM PresentationBIOL
4-Oct-07GzLM PresentationBIOL SAS Proc’s: the basics Data [dataset]; Infile [filename]; input [variables]; proc [glm (or genmod)]; model [model]; run;
4-Oct-07GzLM PresentationBIOL 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;
4-Oct-07GzLM PresentationBIOL 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;
4-Oct-07GzLM PresentationBIOL 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;
4-Oct-07GzLM PresentationBIOL 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;
4-Oct-07GzLM PresentationBIOL 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;
4-Oct-07GzLM PresentationBIOL 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;
4-Oct-07GzLM PresentationBIOL 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 ; contrast 'contrl v large' nest ; estimate 'contrl v large' nest ; estimate 'bird v control' nest 1 1 0; estimate 'bF v bS' park 1 -1; estimate 'con v food' grid 1 -1; run;
4-Oct-07GzLM PresentationBIOL 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
4-Oct-07GzLM PresentationBIOL GENMOD output LR Statistics For Type 1 Analysis Chi- Source Deviance DF Square Pr > ChiSq Intercept park grid park*grid nest park*nest grid*nest park*grid*nest = 1.70, Chisquare = 1.70, df = 1 p =
4-Oct-07GzLM PresentationBIOL GENMOD output LR Statistics For Type 3 Analysis Chi- Source DF Square Pr > ChiSq park grid park*grid nest park*nest grid*nest park*grid*nest
4-Oct-07GzLM PresentationBIOL Why we use GzLM Same Data, Same Distribution From Sokal and Rohlf 1995, Box 11.2
4-Oct-07GzLM PresentationBIOL Why we use GzLM Same Data, Same Distribution From Sokal and Rohlf 1995, Box 11.2
4-Oct-07GzLM PresentationBIOL Why we use GzLM Same Data, Different Distribution (K.Lewis, M.Sc data)
4-Oct-07GzLM PresentationBIOL Why we use GzLM Same Data, Different Distribution (K.Lewis, M.Sc data) See Lewis 2005, Oikos
4-Oct-07GzLM PresentationBIOL SAS v. R SAS –Powerful –Widely used –Learning curve –Expensive R –Powerful –“limited” use –Learning curve –Free Resources –Peter Earle –The web!!!!
4-Oct-07GzLM PresentationBIOL References Criteria: –Readability –Examples with the software code! A. Agresti Introduction to Categorical Data Analysis. Wiley & Sons, New York. Littel et al SAS for Linear Models 4 th ed. Cary, NC: SAS Institute Inc.