{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Stat3022 hw3

# Stat3022 hw3 - Stat3022 Hw3 Yutong Gao 2.23 > dat <...

This preview shows pages 1–4. Sign up to view the full content.

Stat3022 Yutong Gao Hw3 2.23 > dat <- read.csv("http://www.stat.umn.edu/~graalum/data/ch2/ex0223.csv",header=T) > attach(dat) Looking at the R output given below, we can confirm that there is strong evidence that the percentage change was greater in states that increased their speed limits since the mean of change in fatalities in the states increased speed limites (x=13.753125) is much greater than the mean of the change in fatalities in the states that retained(y=-8.563158). And the p-value indicated that there is a significant difference in means that is not equal to 0. (two-sided p-value = 0.009747 from a two-sample t-test). > names(dat) [1] "STATE" "INCREASe" "FATALITIESCHANGE" > increase<-FATALITIESCHANGE[INCREASe=="Yes"] > remain<-FATALITIESCHANGE[INCREASe=="No"] > t.test(increase,remain,alternative="two.sided",varequal=F) Welch Two Sample t-test data: increase and remain t = 2.7722, df = 28.248, p-value = 0.009747 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 5.833028 38.799538 sample estimates: mean of x mean of y 13.753125 -8.563158 > mean(increase)-mean(remain) [1] 22.31628 We also confirm that the estimated difference between these two group is 13.753125+8.563158= 22.31628. A 95% condence interval is between (5.833028, 38.799538 ). 3.28(a) > dat <- read.csv("http://www.stat.umn.edu/~graalum/data/ch3/ex0328.csv",header=T) > attach(dat) > names(dat) [1] "REMOVED" "DURATION" "BEE" > boxplot(REMOVED~BEE,ylab="proportion of pollen removed",xlab="BEE")

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
> dat\$logP<- with(dat,log(REMOVED/(1-REMOVED))) > attach(dat) The following object(s) are masked from 'dat (position 3)': BEE, DURATION, REMOVED > boxplot(logP~BEE,ylab="proportion of pollen removed(log scale)") QUEEN WORKER 0.2 0.4 0.6 0.8 BEE proportion of pollen removed
> t.test(logP~BEE,varequal=T)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 9

Stat3022 hw3 - Stat3022 Hw3 Yutong Gao 2.23 > dat <...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online