Biostat 201: Winter 11 - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Biostat 201: Winter 11

Description:

Some excel stuff (mainly for your reference) P-value calculator ... data from SAS to Excel. http://www.ats.ucla.edu ... Excel understands data as 'series' ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 25
Provided by: cernercor
Category:
Tags: biostat | excel | winter

less

Transcript and Presenter's Notes

Title: Biostat 201: Winter 11


1
Biostat 201 Winter 11
  • Lab Session 3

2
SAS/STATA code key
  • I will use the following convention in these
    slides
  • statements bold
  • keywords italics
  • options underlined
  • Variables, or something you specify yourself
    courier font

3
Assignment 3
4
What do we need to do?
  • Please refer to the Section XII notes!
  • Wide versus Long Data
  • Import data
  • Descriptive statistics
  • Repeated Measures
  • VIA Factorial ANOVA
  • VIA regression

5
Wide vs long data
Wide
Long
6
How to change data from wide form to long form.
  • SAS (one method)
  • data leadlong (drop time0 time1 time4 time6)
  • set lab.lead
  • leadtime0 time0 output
  • leadtime1 time1 output
  • leadtime4 time4 output
  • leadtime6 time6 output
  • label lead "Blood Lead Level" time "time"
    group "Treatment" run

7
How to change data from wide form to long form.
  • SAS (another method)
  • data leadlong set lab.lead
  • array y4 time0 time1 time4 time6
  • i0
  • do time0, 1, 4, 6
  • i i1
  • leadyi output end
  • label lead "Blood Lead Level" time "time"
    group "Treatment"
  • drop i time0 time1 time4 time6 run

8
How to change data from wide form to long form.
  • STATA
  • reshape long time, i(id) j(t)
  • rename time lead

9
SAS Descriptive StatisticsNote Data is in LONG
FORM
  • proc means datadataset ltoptionsgt class grpvar1
    grpvar2 var var1 var2run
  • proc means datalead_long mean std stderr class
    group time var leadrun

10
SAS
11
STATA Descriptive StatisticsNote Data is in
LONG FORM
  • mean var1 var2, over(grpvar1 grpvar2)
  • mean lead, over(group time)

12
STATA
13
(No Transcript)
14
STATA Repeated Measures via Factorial ANOVA
  • anova yvar grp / subgrp t grpt,repeated(t)
  • anova lead group /idgroup time grouptime,
    repeated(t)
  • models means - version 11 only
  • margins groupt, asbalanced emptycells(reweight)

NOTE Data needs to be in the LONG format.
15
STATA Repeated Measures via Factorial ANOVA
16
STATA Repeated Measures via Factorial ANOVA
17
SAS Repeated Measures
NOTE Data needs to be in the LONG format.
  • proc mixed datadataset class grp t sub model
    yvar grp t grpt / s repeated / subjectsub
    typecs lsmeans grpt /diff run quit
  • proc mixed data leadlong method reml
  • class id group time
  • model lead group time grouptime / s
  • repeated time / typecs subjectid r rcorr
  • lsmeans grouptime /diff
  • run

18
(No Transcript)
19
(No Transcript)
20
STATA Repeated Measures Regression
NOTE Data needs to be in the LONG format.
  • xtreg yvar grp t grpt, i(sub)
  • xtreg lead i.group i.time i.groupi.time, i(id)
  • xtmixed yvar i.grp t i.grpt id,
  • xtmixed lead i.group i.time i.groupi.time id

21
Estimates are different from SAS because the
reference groups are different
22
Estimating the means(results same as SAS)
  • margins i.groupi.t

23
SAS Repeated Measures via factorial ANOVA
Note Data needs to be in the WIDE format.
  • proc glm datadataset class grp model yvar1
    yvar2 .. yvarp grp repeated
    repeated-factor-name of trialsrun quit
  • proc glm data lead_wide
  • class group
  • model time0 time1 time4 time6 group
  • repeated time 4
  • lsmeans group / outmeans run quit

24
SAS Repeated Measures via factorial ANOVA
Write a Comment
User Comments (0)
About PowerShow.com