Statistical Programming - Lecture Handout | STA 402, Study notes of Statistics

Material Type: Notes; Professor: Bailer; Class: Statistical Programming; Subject: Statistics; University: Miami University-Oxford; Term: Fall (First Sem) 2003;

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-fjv
koofers-user-fjv 🇺🇸

10 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Day 4 [03 Sept. 03] Class Activities
C:\Documents and Settings\John Bailer\My Documents\baileraj\
Classes\Fall 2003\handouts\day4-03sep03.doc
title (revisited) + jittering
* you can have more than one title in a program
proc format;
value totfmt 0='none'
1-HIGH='some'
;
data d1;
title ‘Reproductive Toxicity Study of Nitrofen in C. dubia’;
footnote ‘Data previously analyzed by Bailer and Oris (1993)‘;
infile 'M:\public.www\classes\sta402\SAS-programs\ch2-dat.txt' firstobs=16
expandtabs missover pad ;
input @9 animal 2.
@17 conc 3.
@25 brood1 2.
@33 brood2 2.
@41 brood3 2.
@49 total 2.;
cbrood3 = brood3;
format cbrood3 totfmt.;
label animal = animal ID number;
label conc = Nitrofen concentration;
label brood1 = number of young in first brood;
label brood2 = number of young in 2nd brood;
label brood3 = number of young in 3rd brood;
label total = total young produced in three broods;
options pageno=1 nodate;
Data d3; set d1;
jconc = conc + 20*ranuni(0)- 10;
jbrood1 = brood1 + 2*ranuni(0) -1;
jbrood2 = brood2 + 2*ranuni(0) -1;
jbrood3 = brood3 + 2*ranuni(0) -1;
* add jitter to the concentration for plotting;
* add jitter to the counts as well;
proc plot;
title2 ‘Plot of Brood counts vs. Nitrofen concentration’;
title3 ‘[points jittered in both x and y directions]’;
plot jbrood1*jconc="1" jbrood2*jconc="2" jbrood3*jconc="3" /
overlay vaxis=0 to 20 by 2;
pf3
pf4
pf5

Partial preview of the text

Download Statistical Programming - Lecture Handout | STA 402 and more Study notes Statistics in PDF only on Docsity!

Day 4 [03 Sept. 03] Class Activities

C:\Documents and Settings\John Bailer\My Documents\baileraj\

Classes\Fall 2003\handouts\day4-03sep03.doc

title (revisited) + jittering

* you can have more than one title in a program

proc format ;

value totfmt 0 ='none'

1 -HIGH='some'

data d1;

title ‘Reproductive Toxicity Study of Nitrofen in C. dubia’;

footnote ‘Data previously analyzed by Bailer and Oris (1993)‘;

infile 'M:\public.www\classes\sta402\SAS-programs\ch2-dat.txt' firstobs= 16

expandtabs missover pad ;

input @ 9 animal 2.

@ 17 conc 3.

@ 25 brood1 2.

@ 33 brood2 2.

@ 41 brood3 2.

@ 49 total 2. ;

cbrood3 = brood3;

format cbrood3 totfmt.;

label animal = animal ID number;

label conc = Nitrofen concentration;

label brood1 = number of young in first brood;

label brood2 = number of young in 2 nd brood;

label brood3 = number of young in 3 rd brood;

label total = total young produced in three broods;

options pageno=1 nodate;

Data d3; set d1;

jconc = conc + 20 *ranuni( 0 )- 10 ;

jbrood1 = brood1 + 2*ranuni(0) -1;

jbrood2 = brood2 + 2*ranuni(0) -1;

jbrood3 = brood3 + 2*ranuni(0) -1;

* add jitter to the concentration for plotting;

* add jitter to the counts as well;

proc plot ;

title2 ‘Plot of Brood counts vs. Nitrofen concentration’;

title3 ‘[points jittered in both x and y directions]’;

plot jbrood1jconc="1" jbrood2jconc="2" jbrood3*jconc="3" /

overlay vaxis= 0 to 20 by 2 ;

run ;

proc plot ;

title2 ‘Plot of Brood 1 young produced vs. concentration’;

plot jbrood1*jconc="1" / vaxis= 0 to 20 by 2 ;

run ;

proc plot ;

title2 ‘Plot of Brood 2 young produced vs. concentration’;

plot jbrood2*jconc="2" / vaxis= 0 to 20 by 2 ;

run ;

proc plot ;

title2 ‘Plot of Brood 3 young produced vs. concentration’;

plot jbrood3*jconc="3" / vaxis= 0 to 20 by 2 ;

run ;

/* output follows */

Reproductive Toxicity Study of Nitrofen in C. dubia 2 Plot of Brood 1 young produced vs. concentration Plot of jbrood1*jconc. Symbol used is '1'. 20 ˆ ‚ ‚ ‚ 18 ˆ ‚ ‚ ‚ 16 ˆ ‚ ‚ ‚ 14 ˆ ‚ jbrood1 ‚ ‚ 12 ˆ ‚ ‚ ‚ 10 ˆ ‚ ‚ ‚ 8 ˆ 1 1 ‚ 1 ‚ 1 1 ‚ 1 1 1 1 6 ˆ 1 1 1 1 11 1 ‚ 1 11 11 11 1 ‚ 11 1 11 1 11 ‚ 1 4 ˆ 1 1 11 ‚ 11 1 ‚ ‚ 1 1 2 ˆ 1 1 ‚ ‚ 1 ‚ 0 ˆ Šƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒ -50 0 50 100 150 200 250 300 350 jconc NOTE: 5 obs hidden.

Reproductive Toxicity Study of Nitrofen in C. dubia 3 Plot of Brood 2 young produced vs. concentration Plot of jbrood2*jconc. Symbol used is '2'. 20 ˆ ‚ ‚ ‚ 18 ˆ ‚ ‚ ‚ 16 ˆ ‚ ‚ ‚ 2 14 ˆ 2 2 ‚ 2 2 jbrood2 ‚ 2 ‚ 2 2 2 22 2 2 2 12 ˆ 2 2 22 ‚ 22 2 ‚ 2 ‚ 2 10 ˆ 2 ‚ 2 2 2 2 ‚ 2 2 ‚ 8 ˆ 2 ‚ 2 ‚ ‚ 6 ˆ ‚ ‚ ‚ 4 ˆ 2 ‚ ‚ ‚ 2 ˆ 2 ‚ ‚ 2 ‚ 2 22 2 0 ˆ 2 Šƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒˆƒƒ -50 0 50 100 150 200 250 300 350 jconc NOTE: 4 obs hidden. 6 obs out of range.

How about multiple plots per page?

proc plot hpercent= 50 vpercent= 50 ;

plot jbrood1jconc="1" jbrood2jconc="2" jbrood3jconc="3" totaljconc /

haxis = 0 to 400 by 100 ;

run ;

Reproductive Toxicity Study of Nitrofen in C. dubia 9 Plot of Brood 3 young produced vs. concentration (notice that TITLE and TITLE2 carried over from previous declaration) Plot of jbrood1jconc. Symbol used is '1'. Plot of jbrood2jconc. Symbol used is '2'. 10 ˆ jbrood2 ‚ ‚ 20 ˆ ‚ ‚ jbrood1 ‚ 1 1 ‚22 2 ‚ 1 1 1 ‚22 22 2 2 ‚11 1 1 1 1 1 10 ˆ2 22 2 2 2 ‚1 11 1 1 11 ‚ 2 2 5 ˆ11 1 1 11 ‚ 2 ‚ 1 1 1 ‚ 2 ‚1 1 1 0 ˆ 22 222 ‚ 1 ‚ ‚ 1 1 1 ‚ ‚ ‚ ‚ 1 -10 ˆ 0 ˆ ‚ Šˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ Šˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ 0 100 200 300 400 0 100 200 300 400 jconc jconc NOTE: 11 obs hidden. 3 obs out of range. NOTE: 23 obs hidden. 3 obs out of range. (notice that the jittering produced points ‘out of range’ with haxis starting at zero) Plot of jbrood3jconc. Symbol used is '3'. Plot of totaljconc. A=1, B=2, etc. jbrood3 ‚ 40 ˆ 20 ˆ ‚ A A ‚3 3 ‚ CA CA ‚33 333 total ‚BA B C ‚ 33 33 ‚ A D 10 ˆ3 3 3 33 ‚ A AA B A ‚ 3 ‚A A A ‚ 33 20 ˆ AA ‚ ‚ B 0 ˆ 3 333 ‚ B A ‚ ‚ A ‚ ‚ ‚ ‚ A CBB -10 ˆ ‚ A ‚ 0 ˆ A Šˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ Šƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒ 0 100 200 300 400 0 100 200 300 400 jconc jconc NOTE: 24 obs hidden. 3 obs out of range.