STAT:5201 Applied Statistic II

Similar documents
THE UNIVERSITY OF BRITISH COLUMBIA FORESTRY 430 and 533. Time: 50 minutes 40 Marks FRST Marks FRST 533 (extra questions)

STAT 503 Fall Introduction to SAS

EXST3201 Mousefeed01 Page 1

* Sample SAS program * Data set is from Dean and Voss (1999) Design and Analysis of * Experiments. Problem 3, page 129.

SAS data statements and data: /*Factor A: angle Factor B: geometry Factor C: speed*/

T-test og variansanalyse i SAS. T-test og variansanalyse i SAS p.1/18

Centering and Interactions: The Training Data

Laboratory Topics 1 & 2

Repeated Measures Part 4: Blood Flow data

PLS205 Lab 1 January 9, Laboratory Topics 1 & 2

Outline. Topic 16 - Other Remedies. Ridge Regression. Ridge Regression. Ridge Regression. Robust Regression. Regression Trees. Piecewise Linear Model

Cell means coding and effect coding

THIS IS NOT REPRESNTATIVE OF CURRENT CLASS MATERIAL. STOR 455 Midterm 1 September 28, 2010

CSC 328/428 Summer Session I 2002 Data Analysis for the Experimenter FINAL EXAM

Stat 5100 Handout #6 SAS: Linear Regression Remedial Measures

Baruch College STA Senem Acet Coskun

An introduction to SPSS

STAT:5400 Computing in Statistics

CH5: CORR & SIMPLE LINEAR REFRESSION =======================================

Modeling Effects and Additive Two-Factor Models (i.e. without interaction)

Stat 500 lab notes c Philip M. Dixon, Week 10: Autocorrelated errors

Generalized Least Squares (GLS) and Estimated Generalized Least Squares (EGLS)

Factorial ANOVA with SAS

Land Cover Stratified Accuracy Assessment For Digital Elevation Model derived from Airborne LIDAR Dade County, Florida

Getting Correct Results from PROC REG

ST512. Fall Quarter, Exam 1. Directions: Answer questions as directed. Please show work. For true/false questions, circle either true or false.

Introductory Guide to SAS:

Factorial ANOVA. Skipping... Page 1 of 18

Introduction to Statistical Analyses in SAS

Stat 5100 Handout #19 SAS: Influential Observations and Outliers

Regression on the trees data with R

Bivariate (Simple) Regression Analysis

Analysis of variance and regression. November 13, 2007

Analysis of variance and regression. November 13, 2007

STAT 2607 REVIEW PROBLEMS Word problems must be answered in words of the problem.

Introductory SAS example

15 Wyner Statistics Fall 2013

Conditional and Unconditional Regression with No Measurement Error

Simulating Multivariate Normal Data

Module 3: SAS. 3.1 Initial explorative analysis 02429/MIXED LINEAR MODELS PREPARED BY THE STATISTICS GROUPS AT IMM, DTU AND KU-LIFE

Contrasts and Multiple Comparisons

Within-Cases: Multivariate approach part one

Subset Selection in Multiple Regression

Eksamen ERN4110, 6/ VEDLEGG SPSS utskrifter til oppgavene (Av plasshensyn kan utskriftene være noe redigert)

Introduction to SAS Procedures SAS Basics III. Susan J. Slaughter, Avocet Solutions

Normal Plot of the Effects (response is Mean free height, Alpha = 0.05)

STAT 5200 Handout #25. R-Square & Design Matrix in Mixed Models

Applied Regression Modeling: A Business Approach

SAS/STAT 14.2 User s Guide. The SIMNORMAL Procedure

SLStats.notebook. January 12, Statistics:

Introduction to SAS Procedures SAS Basics III. Susan J. Slaughter, Avocet Solutions

1 Downloading files and accessing SAS. 2 Sorting, scatterplots, correlation and regression

range: [1,20] units: 1 unique values: 20 missing.: 0/20 percentiles: 10% 25% 50% 75% 90%

APPENDIX. Appendix 2. HE Staining Examination Result: Distribution of of BALB/c

Chapter 5 INSET Statement. Chapter Table of Contents

Lab Session 1. Introduction to Eviews

5.5 Regression Estimation

050 0 N 03 BECABCDDDBDBCDBDBCDADDBACACBCCBAACEDEDBACBECCDDCEA

1 The SAS System 23:01 Friday, November 9, 2012

Stat 5100 Handout #11.a SAS: Variations on Ordinary Least Squares

Lab #9: ANOVA and TUKEY tests

Regression Analysis and Linear Regression Models

Statistics Lab #7 ANOVA Part 2 & ANCOVA

SAS Programs and Output for Alternative Experimentals Designs. Section 13-8 in Howell (2010)

Frequencies, Unequal Variance Weights, and Sampling Weights: Similarities and Differences in SAS

SAS/STAT 13.1 User s Guide. The SCORE Procedure

A. Incorrect! This would be the negative of the range. B. Correct! The range is the maximum data value minus the minimum data value.

CREATING THE DISTRIBUTION ANALYSIS

Analysis of variance - ANOVA

Week 3/4 [06+ Sept.] Class Activities. File: week sep07.doc Directory: \\Muserver2\USERS\B\\baileraj\Classes\sta402\handouts

The NESTED Procedure (Chapter)

/* Parametric models: AFT modeling */ /* Data described in Chapter 3 of P. Allison, "Survival Analysis Using the SAS System." */

The Kenton Study. (Applied Linear Statistical Models, 5th ed., pp , Kutner et al., 2005) Page 1 of 5

Stat 5303 (Oehlert): Response Surfaces 1

STA 570 Spring Lecture 5 Tuesday, Feb 1

PubHlth 640 Intermediate Biostatistics Unit 2 - Regression and Correlation. Simple Linear Regression Software: Stata v 10.1

Data Management - 50%

Chapter 1. Looking at Data-Distribution

More data analysis examples

Generalized Additive Models

Paper ODS, YES! Odious, NO! An Introduction to the SAS Output Delivery System

Stat 5100 Handout #14.a SAS: Logistic Regression

SAS/STAT 13.1 User s Guide. The NESTED Procedure

EXST SAS Lab Lab #6: More DATA STEP tasks

Cluster Randomization Create Cluster Means Dataset

The SIMNORMAL Procedure (Chapter)

The ANOVA Procedure (Chapter)

Package sure. September 19, 2017

CREATING THE ANALYSIS

SYS 6021 Linear Statistical Models

Chapters 18, 19, 20 Solutions. Page 1 of 14. Demographics from COLLEGE Data Set

LAMPIRAN 1 : DATA HASIL PENELITIAN

Statistical Research Consultants Bangladesh (SRCBD) Testing for Normality using SPSS

Further Maths Notes. Common Mistakes. Read the bold words in the exam! Always check data entry. Write equations in terms of variables

Annexes : Sorties SAS pour l'exercice 3. Code SAS. libname process 'G:\Enseignements\M2ISN-Series temp\sas\';

Reading data in SAS and Descriptive Statistics

CDAA No. 4 - Part Two - Multiple Regression - Initial Data Screening

Multivariate Capability Analysis

Multiple Regression White paper

Instruction on JMP IN of Chapter 19

Transcription:

STAT:5201 Applied Statistic II Two-Factor Experiment (one fixed blocking factor, one fixed factor of interest) Randomized complete block design (RCBD) Primary Factor: Day length (short or long) Blocking Factor: litter (1 to 6) **Considered a fixed effect for now Response: NI enzyme level Six litters of hamsters with 2 hamsters from each litter is available for the experiment. The treatments of short and long are randomly assigned within litter. (We will consider Litter a fixed effect for now). SAS Program Part 1: Input Data and Model Fitting /* This is how SAS recognizes a comment.*/ /* Create the data set using the CARDS statement: */ data hamster; input litter daylength $ enzyme; /* the $ makes daylength a character variable.*/ cards; 1 short 2.1 2 short 1.8 3 short 1.4 4 short 1.2 5 short 1.9 6 short 2.4 1 long 2.6 2 long 2.2 3 long 2.4 4 long 1.7 5 long 2.9 6 long 2.3 ; /* It s always a good idea to print the data to the Output screen */ /* to make sure SAS is reading it appropriately. */ proc print data=hamster; The SAS System Obs litter daylength enzyme 1 1 short 2.1 2 2 short 1.8 3 3 short 1.4 4 4 short 1.2 5 5 short 1.9 6 6 short 2.4 7 1 long 2.6 8 2 long 2.2 9 3 long 2.4 10 4 long 1.7 11 5 long 2.9 12 6 long 2.3 1

/* PROC CONTENTS gives you information on the variables */ proc contents data=hamster; The CONTENTS Procedure Data Set Name WORK.HAMSTER Observations 12 Member Type DATA Variables 3 Engine V9 Indexes 0 Created Tuesday, February 11, Observation Length 24 2014 02:43:17 PM Last Modified Tuesday, February 11, Deleted Observations 0 2014 02:43:17 PM Protection Compressed NO Data Set Type Sorted NO Label Data Representation WINDOWS_32 Encoding wlatin1 Western (Windows) Alphabetic List of Variables and Attributes # Variable Type Len 2 daylength Char 8 3 enzyme Num 8 1 litter Num 8 /* Assign symbols for treatment groups and plot data. */ SYMBOL1 value=plus c=black; SYMBOL2 value=circle c=blue; proc gplot data=hamster; plot enzyme*litter=daylength; 2

/* For now, we will consider litter a fixed block effect.*/ /* Fit the additive model (main effects model only, no interaction). */ proc glm data=hamster; class litter daylength; model enzyme=daylength litter/solution; output out=diagnostics p=predicted r=residual; The SAS System The GLM Procedure Class Level Information Class Levels Values litter 6 1 2 3 4 5 6 daylength 2 long short Number of Observations Read 12 Number of Observations Used 12 The SAS System The GLM Procedure Dependent Variable: enzyme Sum of Source DF Squares Mean Square F Value Pr > F Model 6 2.27500000 0.37916667 4.43 0.0618 Error 5 0.42750000 0.08550000 Corrected Total 11 2.70250000 R-Square Coeff Var Root MSE enzyme Mean 0.841813 14.09175 0.292404 2.075000 Source DF Type I SS Mean Square F Value Pr > F daylength 1 0.90750000 0.90750000 10.61 0.0225 litter 5 1.36750000 0.27350000 3.20 0.1138 Source DF Type III SS Mean Square F Value Pr > F daylength 1 0.90750000 0.90750000 10.61 0.0225 litter 5 1.36750000 0.27350000 3.20 0.1138 3

Standard Parameter Estimate Error t Value Pr > t Intercept 2.075000000 B 0.22332711 9.29 0.0002 daylength long 0.550000000 B 0.16881943 3.26 0.0225 daylength short 0.000000000 B... litter 1 0.000000000 B 0.29240383 0.00 1.0000 litter 2-0.350000000 B 0.29240383-1.20 0.2850 litter 3-0.450000000 B 0.29240383-1.54 0.1844 litter 4-0.900000000 B 0.29240383-3.08 0.0275 litter 5 0.050000000 B 0.29240383 0.17 0.8709 litter 6 0.000000000 B... NOTE: The X X matrix has been found to be singular, and a generalized inverse was used to solve the normal equations. Terms whose estimates are followed by the letter B are not uniquely estimable. /* View the residuals and predicted values on the Output screen. */ proc print data=diagnostics; The SAS System Obs litter daylength enzyme predicted residual 1 1 short 2.1 2.075 0.025 2 2 short 1.8 1.725 0.075 3 3 short 1.4 1.625-0.225 4 4 short 1.2 1.175 0.025 5 5 short 1.9 2.125-0.225 6 6 short 2.4 2.075 0.325 7 1 long 2.6 2.625-0.025 8 2 long 2.2 2.275-0.075 9 3 long 2.4 2.175 0.225 10 4 long 1.7 1.725-0.025 11 5 long 2.9 2.675 0.225 12 6 long 2.3 2.625-0.325 4

SAS Program Part 2: Fitted Model Visualization, Diagnostics /* Plot the fitted additive model using proc gplot. */ SYMBOL1 value=diamond height=3 interpol=join line=1 c=blue; SYMBOL2 value=circle height=2 interpol=join line=2 c=blue; proc gplot data=diagnostics; plot predicted*litter=daylength/vref=2.075; But PROC GLM will automatically give you this plot when you fit the model (without even asking) as long as your HTML output is turned-on. 5

If you switch your listing of class variables, you can get this interaction plot instead... proc glm data=hamster; class daylength litter; model enzyme=daylength litter/solution; output out=diagnostics p=predicted r=residual; /* Check constant variance assumption with primitive resids vs preds plot: */ proc plot data=diagnostics; plot residual*predicted/vref=0; Plot of residual*predicted. Legend: A = 1 obs, B = 2 obs, etc. residual 0.325 + A 0.275 + 0.225 + A A 0.175 + 0.125 + 0.075 + A 0.025 +--------A--------------------------------A-------------------------- -0.025 + A A -0.075 + A -0.125 + -0.175 + -0.225 + A A -0.275 + -0.325 + A ---+--------+--------+--------+--------+--------+--------+--------+-- 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 predicted 6

If you turn-on the HTML output option (which might actually be the default now), you can get nicer plots using the PLOT=DIAGNOSTICS option within PROC GLM. /* Turn-on HTML output prior to fitting the model.*/ proc glm data=hamster plot=diagnostics; class litter daylength; model enzyme=daylength litter/solutions; output out=diagnostics p=predicted r=residual; 7

Another way to get a QQ-plot using PROC CAPABILITY and tests of normality: proc capability data=diagnostics normaltest graphics; var residual; qqplot; The CAPABILITY Procedure Variable: residual Moments N 12 Sum Weights 12 Mean 0 Sum Observations 0 Std Deviation 0.19713862 Variance 0.03886364 Skewness 0 Kurtosis -0.6291303 Uncorrected SS 0.4275 Corrected SS 0.4275 Coeff Variation. Std Error Mean 0.05690902 Basic Statistical Measures Location Variability Mean 0.00000 Std Deviation 0.19714 Median -0.00000 Variance 0.03886 Mode -0.22500 Range 0.65000 Interquartile Range 0.30000 Tests for Normality Test --Statistic--- -----p Value------ Shapiro-Wilk W 0.961137 Pr < W 0.7999 Kolmogorov-Smirnov D 0.123133 Pr > D >0.1500 Cramer-von Mises W-Sq 0.038854 Pr > W-Sq >0.2500 Anderson-Darling A-Sq 0.251256 Pr > A-Sq >0.2500 8