Hormone Example: nknw892.sas Y = change in growth rate after treatment Factor A = gender (male, female) Factor B = bone development level (severely depressed,

Slides:



Advertisements
Similar presentations
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Advertisements

Topic 32: Two-Way Mixed Effects Model. Outline Two-way mixed models Three-way mixed models.
1 Chapter 4 Experiments with Blocking Factors The Randomized Complete Block Design Nuisance factor: a design factor that probably has an effect.
Analysis of covariance Experimental design and data analysis for biologists (Quinn & Keough, 2002) Environmental sampling and analysis.
Topic 15: General Linear Tests and Extra Sum of Squares.
CS Example: General Linear Test (cs2.sas)
Partial Regression Plots. Life Insurance Example: (nknw364.sas) Y = the amount of life insurance for the 18 managers (in $1000) X 1 = average annual income.
Matrix A matrix is a rectangular array of elements arranged in rows and columns Dimension of a matrix is r x c  r = c  square matrix  r = 1  (row)
Be humble in our attribute, be loving and varying in our attitude, that is the way to live in heaven.
Multi-Factor Studies Stat 701 Lecture E. Pena.
Mean Comparison With More Than Two Groups
Two-Way ANOVA in SAS Multiple regression with two or
Example: Price Analysis for Diamond Rings in Singapore Variables Response Variable: Price in Singapore dollars (Y) Explanatory Variable: Weight of diamond.
Incomplete Block Designs
Distribution of X: (nknw096) data toluca; infile 'H:\CH01TA01.DAT'; input lotsize workhrs; seq=_n_; proc print data=toluca; run; Obslotsizeworkhrsseq
Two-Way Balanced Independent Samples ANOVA Computations Contrasts Confidence Intervals.
SAS Lecture 5 – Some regression procedures Aidan McDermott, April 25, 2005.
Topic 16: Multicollinearity and Polynomial Regression.
Topic 28: Unequal Replication in Two-Way ANOVA. Outline Two-way ANOVA with unequal numbers of observations in the cells –Data and model –Regression approach.
1 Experimental Statistics - week 6 Chapter 15: Randomized Complete Block Design (15.3) Factorial Models (15.5)
Multiple Comparisons.
Topic 2: An Example. Leaning Tower of Pisa Construction began in 1173 and by 1178 (2 nd floor), it began to sink Construction resumed in To compensate.
More complicated ANOVA models: two-way and repeated measures Chapter 12 Zar Chapter 11 Sokal & Rohlf First, remember your ANOVA basics……….
Topic 14: Inference in Multiple Regression. Outline Review multiple linear regression Inference of regression coefficients –Application to book example.
1 Experimental Statistics - week 10 Chapter 11: Linear Regression and Correlation Note: Homework Due Thursday.
7-1 The Strategy of Experimentation Every experiment involves a sequence of activities: 1.Conjecture – the original hypothesis that motivates the.
GENERAL LINEAR MODELS Oneway ANOVA, GLM Univariate (n-way ANOVA, ANCOVA)
Randomized Block Design (Kirk, chapter 7) BUSI 6480 Lecture 6.
5-5 Inference on the Ratio of Variances of Two Normal Populations The F Distribution We wish to test the hypotheses: The development of a test procedure.
Lab 5 instruction.  a collection of statistical methods to compare several groups according to their means on a quantitative response variable  Two-Way.
Nonlinear Models. Learning Example: knnl533.sas Y = relative efficiency of production of a new product (1/expected cost) X 1 : Location A : X 1 = 1, B:
Topic 17: Interaction Models. Interaction Models With several explanatory variables, we need to consider the possibility that the effect of one variable.
1 Fourier Series (Spectral) Analysis. 2 Fourier Series Analysis Suitable for modelling seasonality and/or cyclicalness Identifying peaks and troughs.
The Completely Randomized Design (§8.3)
Topic 6: Estimation and Prediction of Y h. Outline Estimation and inference of E(Y h ) Prediction of a new observation Construction of a confidence band.
Topic 13: Multiple Linear Regression Example. Outline Description of example Descriptive summaries Investigation of various models Conclusions.
Topic 23: Diagnostics and Remedies. Outline Diagnostics –residual checks ANOVA remedial measures.
Problem 3.26, when assumptions are violated 1. Estimates of terms: We can estimate the mean response for Failure Time for problem 3.26 from the data by.
1 Experimental Statistics - week 14 Multiple Regression – miscellaneous topics.
Topic 30: Random Effects. Outline One-way random effects model –Data –Model –Inference.
Topic 25: Inference for Two-Way ANOVA. Outline Two-way ANOVA –Data, models, parameter estimates ANOVA table, EMS Analytical strategies Regression approach.
Bread Example: nknw817.sas Y = number of cases of bread sold (sales) Factor A = height of shelf display (bottom, middle, top) Factor B = width of shelf.
Topic 26: Analysis of Covariance. Outline One-way analysis of covariance –Data –Model –Inference –Diagnostics and rememdies Multifactor analysis of covariance.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
PSYC 3030 Review Session April 19, Housekeeping Exam: –April 26, 2004 (Monday) –RN 203 –Use pencil, bring calculator & eraser –Make use of your.
By: Corey T. Williams 03 May Situation Objective.
ANOVA: Graphical. Cereal Example: nknw677.sas Y = number of cases of cereal sold (CASES) X = design of the cereal package (PKGDES) r = 4 (there were 4.
1 STA 517 – Chp4 Introduction to Generalized Linear Models 4.3 GENERALIZED LINEAR MODELS FOR COUNTS  count data - assume a Poisson distribution  counts.
1 Experimental Statistics - week 9 Chapter 17: Models with Random Effects Chapter 18: Repeated Measures.
Topic 24: Two-Way ANOVA. Outline Two-way ANOVA –Data –Cell means model –Parameter estimates –Factor effects model.
1 Experimental Statistics Spring week 6 Chapter 15: Factorial Models (15.5)
Sigmoidal Response (knnl558.sas). Programming Example: knnl565.sas Y = completion of a programming task (1 = yes, 0 = no) X 2 = amount of programming.
Topic 20: Single Factor Analysis of Variance. Outline Analysis of Variance –One set of treatments (i.e., single factor) Cell means model Factor effects.
7-2 Factorial Experiments A significant interaction mask the significance of main effects. Consequently, when interaction is present, the main effects.
Example 1 (knnl917.sas) Y = months survival Treatment (3 levels)
1 Experimental Statistics - week 13 Multiple Regression Miscellaneous Topics.
Experimental Statistics - week 9
Topic 29: Three-Way ANOVA. Outline Three-way ANOVA –Data –Model –Inference.
Interview Example: nknw964.sas Y = rating of a job applicant Factor A represents 5 different personnel officers (interviewers) n = 4.
Topic 27: Strategies of Analysis. Outline Strategy for analysis of two-way studies –Interaction is not significant –Interaction is significant What if.
Topic 22: Inference. Outline Review One-way ANOVA Inference for means Differences in cell means Contrasts.
1 Experimental Statistics - week 8 Chapter 17: Mixed Models Chapter 18: Repeated Measures.
Lesson 10 - Topics SAS Procedures for Standard Statistical Tests and Analyses Programs 19 and 20 LSB 8:16-17.
1 Experimental Statistics - week 5 Chapter 9: Multiple Comparisons Chapter 15: Randomized Complete Block Design (15.3)
Chapter 5 Introduction to Factorial Designs
Topic 31: Two-way Random Effects Models
After ANOVA If your F < F critical: Null not rejected, stop right now!! If your F > F critical: Null rejected, now figure out which of the multiple means.
Experimental Statistics - Week 4 (Lab)
7-2 Factorial Experiments
Exercise 1 Use Transform  Compute variable to calculate weight lost by each person Calculate the overall mean weight lost Calculate the means and standard.
Presentation transcript:

Hormone Example: nknw892.sas Y = change in growth rate after treatment Factor A = gender (male, female) Factor B = bone development level (severely depressed, moderately depressed, mildly depressed) n ij j 1:severely2:moderately3:mildly i 1: male322 2: female133

Hormone Example: Input data hormone; infile ‘H:\My Documents\Stat 512\CH23TA01.DAT'; input growth gender bone; proc print data=hormone; run; Obsgrowthgenderbone

Hormone Example: Scatterplot data hormone; set hormone; if (gender eq 1)*(bone eq 1) then gb='1_Msev '; if (gender eq 1)*(bone eq 2) then gb='2_Mmod '; if (gender eq 1)*(bone eq 3) then gb='3_Mmild'; if (gender eq 2)*(bone eq 1) then gb='4_Fsev '; if (gender eq 2)*(bone eq 2) then gb='5_Fmod '; if (gender eq 2)*(bone eq 3) then gb='6_Fmild'; run; title1 h=3 'Scatterplot Hormone Example'; axis1 label=(h=2); axis2 label=(h=2 angle=90); symbol1 v=circle i=none c=blue; proc gplot data=hormone; plot growth*gb/haxis=axis1 vaxis=axis2; run;

Hormone Example: Scatterplot (cont)

Hormone Example: Means/Interaction proc means data=hormone; output out=means mean=avgrowth; by gender bone; title1 h=3 'Plot of the means'; symbol1 v='M' i=join c=black h=1.5; symbol2 v='F' i=join c=purple h=1.5; proc gplot data=means; plot avgrowth*bone=gender/haxis=axis1 vaxis=axis2; run; symbol1 v='S' i=join c=black h=1.5; symbol2 v='M' i=join c=red h=1.5; symbol3 v='L' i=join c=blue h=1.5; proc gplot data=means; plot avgrowth*gender=bone/haxis=axis1 vaxis=axis2; run;

Hormone Example: Means (cont) gender=1 bone=2 gender=1 bone=3 gender=2 bone=1 gender=2 bone=2 gender=2 bone=3 Analysis Variable : growth NMeanStd DevMinimumMaximum gender=1 bone=

Hormone Example: Interaction (cont)

Hormone Example: Residual Plots

Hormone Example: Normality plots

Hormone Example: ANOVA proc glm data=hormone; class gender bone; model growth=gender|bone/solution; means gender*bone; SourceDFSum of SquaresMean SquareF ValuePr > F Model Error Corrected Total R-SquareCoeff VarRoot MSEgrowth Mean

Hormone Example: cell means Level of gender Level of bone N growth MeanStd Dev

Hormone Example: Factor Effects ParameterEstimateStandard Errort ValuePr > |t| Intercept B gender B gender B... bone B bone B bone B... gender*bone B gender*bone B gender*bone B... gender*bone B... gender*bone B... gender*bone B...

Hormone Example: SS SourceDFType I SSMean SquareF ValuePr > F gender bone gender*bone SourceDFType III SSMean SquareF ValuePr > F gender bone gender*bone

Hormone Example: Contrast gender*bone contrast 'gender*bone Type I and III' gender*bone , gender*bone ; SourceDFType I SSMean SquareF ValuePr > F gender*bone SourceDFType III SSMean SquareF ValuePr > F gender*bone ContrastDFContrast SSMean SquareF ValuePr > F gender*bone Type I and III

Hormone Example: Contrast gender Type III contrast 'gender Type III' gender 3 -3 gender*bone ; estimate 'gender Type III' gender 3 -3 gender*bone ; SourceDFType III SSMean SquareF ValuePr > F gender ContrastDFContrast SSMean SquareF ValuePr > F gender Type III ParameterEstimateStandard Errort ValuePr > |t| gender Type III

Hormone Example: Contrast gender Type I contrast 'gender Type I' gender 7 -7 bone gender*bone ; estimate 'gender Type I' gender 7 -7 bone gender*bone ; ContrastDFContrast SSMean SquareF ValuePr > F gender Type I ParameterEstimateStandard Errort ValuePr > |t| gender Type I SourceDFType I SSMean SquareF ValuePr > F gender

Hormone Example: Contrast Bone III contrast 'bone Type III' bone gender*bone , bone gender*bone ; ContrastDFContrast SSMean SquareF ValuePr > F bone Type III SourceDFType III SSMean SquareF ValuePr > F bone

Hormone Example: Contrast Bone I contrast 'bone Type I' gender 7 -7 bone gender*bone , bone gender*bone ; ContrastDFContrast SSMean SquareF ValuePr > F bone Type I SourceDFType I SSMean SquareF ValuePr > F bone bone first

Hormone Example: SS SourceDFType I SSMean SquareF ValuePr > F gender bone gender*bone SourceDFType III SSMean SquareF ValuePr > F gender bone gender*bone

Hormone Example: Interaction (cont)

Hormone Example: with pooling proc glm data=hormone; class gender bone; model growth=gender bone/solution; means gender bone/ tukey lines; run;

Hormone Example: with pooling (cont) SourceDFSum of SquaresMean SquareF ValuePr > F Model Error Corrected Total R-SquareCoeff VarRoot MSEgrowth Mean SourceDFType I SSMean SquareF ValuePr > F gender bone SourceDFType III SSMean SquareF ValuePr > F gender bone

Hormone Example: with pooling (cont) ParameterEstimateStandard Errort ValuePr > |t| Intercept B gender B gender B... bone B bone B bone B...

Hormone Example: multiple comparisons Note:Cell sizes are not equal. Means with the same letter are not significantly different. Tukey Grouping MeanNbone A A A B

Interaction plot

3-way ANOVA Table

Test Statistics for 3-way ANOVA

Exercise Example: nknw943.sas Y = exercise tolerance Factor A = gender (male, female) Factor B = percent body fat (low, high) Factor C = smoking history (light, heavy) n = 3

Exercise Example: input goptions htext=2; data exercise; infile H:\My Documents\Stat 512\CH24TA04.DAT'; input extol gender fat smoke; data exercise; set exercise; gfs = 100*gender + 10*fat + smoke; proc print data=exercise; run;

Exercise Example: input (cont) Obsextolgenderfatsmokegfs

Exercise Example: Scatterplot proc sort data=exercise; by gfs; run; title1 h=3 'Scatterplot'; axis2 label=(h=2 angle=90); symbol1 v=circle i=none c=blue; proc gplot data=exercise; plot extol*gfs/ haxis = vaxis=axis2; run;

Exercise Example: Scatterplot (cont)

Exercise Example: Interaction Plot proc sort data=exercise; by gender fat smoke; proc means data=exercise; output out=exer2 mean=avextol; by gender fat smoke; data exer2; set exer2; fs = fat*10 + smoke; proc print data=exer2; run; Obsgenderfatsmoke_TYPE__FREQ_avextolfs

Exercise Example: Interaction Plot (cont) title1 h=3 'Interaction Plot'; proc sort data=exer2; by fs; symbol1 v='M' i=join c=blue height=1.5; symbol2 v='F' i=join c=purple height=1.5; proc gplot data=exer2; plot avextol*fs=gender / haxis = vaxis=axis2; run;

Exercise Example: Interaction Plot (cont)

Exercise Example: ANOVA – full model proc glm data=exercise; class gender fat smoke; model extol=gender|fat|smoke / solution; means gender*fat*smoke; output out=diag r = resid p = pred; run;

Exercise Example: Residual Plots

Exercise Example: Normality Plots

Exercise Example: ANOVA table SourceDFSum of SquaresMean SquareF ValuePr > F Model Error Corrected Total R-SquareCoeff VarRoot MSEextol Mean SourceDFType III SSMean SquareF ValuePr > F gender fat gender*fat smoke gender*smoke fat*smoke gender*fat*smoke

Exercise Example: Cell Means Level of gender Level of fat Level of smoke N extol MeanStd Dev

Exercise Example: Factor Effects Model ParameterEstimateStandard Errort ValuePr > |t| Intercept B <.0001 gender B gender B... fat B fat B... gender*fat B gender*fat B... gender*fat B... gender*fat B... smoke B smoke B... gender*smoke B gender*smoke B... gender*smoke B... gender*smoke B... fat*smoke B fat*smoke B... fat*smoke B... fat*smoke B... gender*fat*smoke B gender*fat*smoke B... gender*fat*smoke B... gender*fat*smoke B... gender*fat*smoke B... gender*fat*smoke B... gender*fat*smoke B... gender*fat*smoke B...

Exercise Example: Factor Effects Model – conceptual constraints Obsgenderfatsmoke  Obsgenderfatsmoke 

Exercise Example: interaction plot of smoke vs. body fat title1 h=3 'Mean of smoke/fat vs. smoke'; symbol1 v=L i=join c=red; symbol2 v=H i=join c=black; proc gplot data=BCdat; plot muBC*smoke=fat /vaxis=axis2; run;

Exercise Example: Interaction Plot (cont)

Exercise Example: Reduced model data exercise; set exercise; fs = 10*fat + smoke; run; proc glm data=exercise; class gender fs; model extol=gender fs; means gender fs/tukey; run;

Exercise Example: Reduced model (cont) SourceDFSum of SquaresMean SquareF ValuePr > F Model <.0001 Error Corrected Total R-SquareCoeff VarRoot MSEextol Mean SourceDFType III SSMean SquareF ValuePr > F gender fs <.0001

Exercise Example: Reduced model (cont) Means with the same letter are not significantly different. Tukey GroupingMeanNgender A B Means with the same letter are not significantly different. Tukey GroupingMeanNfs A B B B B B