dm 'log;clear;output;clear';
ods html style=minimal body='Assignment 11 (Step Rate Example).html';
ods graphics on;
options nodate nocenter pageno=1 ls=111 ps=512;
ODS listing;
************************************************;
*** James P Geaghan ***;
*** EXST 700x Analysis of Variance Examples ***;
*** Assignment 11 ***;
************************************************************;
*** Example is from DASL, The Data and Story Library ***;
*** http://lib.stat.cmu.edu/DASL/DataArchive.html ***;
*************************************************************************;
* An experiment was conducted by students at The Ohio State University, *;
* Fall 1993 to study the relationship between a person's heart rate and *;
* the frequency at which that person stepped up and down on steps of *;
* various heights. The response variable, heart rate, was measured in *;
* beats per minute. There were two different step heights: 5.75 inches *;
* (coded as 0), and 11.5 inches (coded as 1) amd three rates of *;
* YIELD: 14 steps/min. (coded as 0), 21 steps/min. (coded as 1), *;
* and 28 steps/min. (coded as 2). Each subject performed the activity *;
* for three minutes, kept on pace by the beat of an electric metronome. *;
* The subject's pulse was taken for 20 seconds before and after each *;
* trial and the subject rested between trials until the heart rate *;
* returned to the beginning rate. Another experimenter kept track of *;
* the time, Each subject was always measured and timed by the same *;
* pair of experimenters to reduce variability in the experiment. *;
* Each pair of experimenters was treated as a block. *;
*************************************************************************;
title1 "Assignment 11 - Stepping - Heart Rate example";
data SteppingData;
INFILE 'SteppingData.csv' dlm=',' dsd missover firstobs=2;
input Order Block Height Frequency RestHR HR;
HRIncrease = HR - RestHR;
if height eq 0 then Ht = 5.75;
if height eq 1 then Ht = 11.5;
if frequency = 0 then freq = 14;
if frequency = 1 then freq = 21;
if frequency = 2 then freq = 28;
datalines; run;
;
run;
*proc print data=SteppingData; run;
proc freq data=SteppingData;
table Ht*Freq / norow nocol nopercent;
run;
PROC MIXED data=SteppingData cl covtest;
TITLE2 'Analysis of Variance using PROC MIXED';
class HT FREQ BLOCK;
model HRIncrease = HT | FREQ / outp=outputstuff;
random block;
contrast 'linear' FREQ -1 0 1;
contrast 'curve ' FREQ -1 2 -1;
lsmeans HT | FREQ / adjust=tukey cl;
ods output diffs=ppp lsmeans=mmm;
*ods exclude diffs lsmeans;
run;
%include 'C:\pdmix800.sas';
%pdmix800(ppp,mmm,alpha=0.05,sort=yes);
RUN;
PROC UNIVARIATE data=outputstuff normal plots;
TITLE3 'Test of residuals from ANOVA';
VAR resid;
ods exclude BasicMeasures ExtremeObs ExtremeValues Modes
MissingValues Quantiles TestsForLocation;
RUN;
ods html close;