require(ggplot2)
## Loading required package: ggplot2
require(plyr)
## Loading required package: plyr
reproftable<-ftable(repro4$Date, repro4$Site, repro4$Pop, repro4$Brooders, exclude=c(NA, NaN,0))
summary(reproftable)
## V1 V2 V3 V4
## Min. :0.0000 Min. :0.0000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :0.0000 Median :0.0000 Median :0.0000 Median :0.0000
## Mean :0.0503 Mean :0.0265 Mean :0.0238 Mean :0.0053
## 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:0.0000
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## V5 V6 V7 V8
## Min. :0.0000 Min. :0.0000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :0.0000 Median :0.0000 Median :0.0000 Median :0.0000
## Mean :0.0079 Mean :0.0079 Mean :0.0053 Mean :0.0053
## 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:0.0000
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## V9 V10 V11
## Min. :0.0000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :0.0000 Median :0.0000 Median :0.0000
## Mean :0.0026 Mean :0.0053 Mean :0.0079
## 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:0.0000
## Max. :1.0000 Max. :1.0000 Max. :1.0000
reproaov<-aov(repro4$Brooders~repro4$Site+repro4$Pop+repro4$Site:repro4$Pop,repro4)
summary(reproaov)
## Df Sum Sq Mean Sq F value Pr(>F)
## repro4$Site 2 138 69.2 12.60 1.1e-05 ***
## repro4$Pop 2 99 49.6 9.03 0.00023 ***
## repro4$Site:repro4$Pop 4 31 7.7 1.41 0.23609
## Residuals 117 642 5.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
SitevPopTukey<-TukeyHSD(reproaov)
print(SitevPopTukey)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = repro4$Brooders ~ repro4$Site + repro4$Pop + repro4$Site:repro4$Pop, data = repro4)
##
## $`repro4$Site`
## diff lwr upr p adj
## Manchester-Fidalgo -0.8571 -2.0710 0.3567 0.2186
## Oyster Bay-Fidalgo 1.6667 0.4529 2.8805 0.0041
## Oyster Bay-Manchester 2.5238 1.3100 3.7376 0.0000
##
## $`repro4$Pop`
## diff lwr upr p adj
## N-H -0.04762 -1.2614 1.166 0.9952
## S-H 1.85714 0.6433 3.071 0.0012
## S-N 1.90476 0.6910 3.119 0.0009
##
## $`repro4$Site:repro4$Pop`
## diff lwr upr p adj
## Manchester:H-Fidalgo:H -7.143e-02 -2.87058 2.7277 1.0000
## Oyster Bay:H-Fidalgo:H 1.286e+00 -1.51344 4.0849 0.8749
## Fidalgo:N-Fidalgo:H -4.330e-15 -2.79915 2.7992 1.0000
## Manchester:N-Fidalgo:H -5.000e-01 -3.29915 2.2992 0.9997
## Oyster Bay:N-Fidalgo:H 1.571e+00 -1.22773 4.3706 0.6987
## Fidalgo:S-Fidalgo:H 2.214e+00 -0.58487 5.0134 0.2427
## Manchester:S-Fidalgo:H 2.143e-01 -2.58487 3.0134 1.0000
## Oyster Bay:S-Fidalgo:H 4.357e+00 1.55799 7.1563 0.0001
## Oyster Bay:H-Manchester:H 1.357e+00 -1.44201 4.1563 0.8379
## Fidalgo:N-Manchester:H 7.143e-02 -2.72773 2.8706 1.0000
## Manchester:N-Manchester:H -4.286e-01 -3.22773 2.3706 0.9999
## Oyster Bay:N-Manchester:H 1.643e+00 -1.15630 4.4420 0.6456
## Fidalgo:S-Manchester:H 2.286e+00 -0.51344 5.0849 0.2061
## Manchester:S-Manchester:H 2.857e-01 -2.51344 3.0849 1.0000
## Oyster Bay:S-Manchester:H 4.429e+00 1.62942 7.2277 0.0001
## Fidalgo:N-Oyster Bay:H -1.286e+00 -4.08487 1.5134 0.8749
## Manchester:N-Oyster Bay:H -1.786e+00 -4.58487 1.0134 0.5353
## Oyster Bay:N-Oyster Bay:H 2.857e-01 -2.51344 3.0849 1.0000
## Fidalgo:S-Oyster Bay:H 9.286e-01 -1.87058 3.7277 0.9801
## Manchester:S-Oyster Bay:H -1.071e+00 -3.87058 1.7277 0.9529
## Oyster Bay:S-Oyster Bay:H 3.071e+00 0.27227 5.8706 0.0203
## Manchester:N-Fidalgo:N -5.000e-01 -3.29915 2.2992 0.9997
## Oyster Bay:N-Fidalgo:N 1.571e+00 -1.22773 4.3706 0.6987
## Fidalgo:S-Fidalgo:N 2.214e+00 -0.58487 5.0134 0.2427
## Manchester:S-Fidalgo:N 2.143e-01 -2.58487 3.0134 1.0000
## Oyster Bay:S-Fidalgo:N 4.357e+00 1.55799 7.1563 0.0001
## Oyster Bay:N-Manchester:N 2.071e+00 -0.72773 4.8706 0.3279
## Fidalgo:S-Manchester:N 2.714e+00 -0.08487 5.5134 0.0649
## Manchester:S-Manchester:N 7.143e-01 -2.08487 3.5134 0.9965
## Oyster Bay:S-Manchester:N 4.857e+00 2.05799 7.6563 0.0000
## Fidalgo:S-Oyster Bay:N 6.429e-01 -2.15630 3.4420 0.9983
## Manchester:S-Oyster Bay:N -1.357e+00 -4.15630 1.4420 0.8379
## Oyster Bay:S-Oyster Bay:N 2.786e+00 -0.01344 5.5849 0.0521
## Manchester:S-Fidalgo:S -2.000e+00 -4.79915 0.7992 0.3760
## Oyster Bay:S-Fidalgo:S 2.143e+00 -0.65630 4.9420 0.2834
## Oyster Bay:S-Manchester:S 4.143e+00 1.34370 6.9420 0.0003
Gapingsum<-ddply(repro4,.(Site,Pop),summarise,sum=sum(Gaping,na.rm=T))
Broodsum<-ddply(repro4,.(Site,Pop),summarise,sum=sum(Brooders,na.rm=T))
BroodGapingSum<-merge(Gapingsum,Broodsum,by=c("Site","Pop"))
BroodGapingSum<-rename(BroodGapingSum, c("Site"="Site","Pop"="Pop","sum.x"="Gaping","sum.y"="Brooder"))
BroodGapingSum$prop<-BroodGapingSum$Brooder/BroodGapingSum$Gaping
print(BroodGapingSum)
## Site Pop Gaping Brooder prop
## 1 Fidalgo H 814 8 0.009828
## 2 Fidalgo N 813 8 0.009840
## 3 Fidalgo S 921 39 0.042345
## 4 Manchester H 658 7 0.010638
## 5 Manchester N 631 1 0.001585
## 6 Manchester S 699 11 0.015737
## 7 Oyster Bay H 931 26 0.027927
## 8 Oyster Bay N 769 30 0.039012
## 9 Oyster Bay S 883 69 0.078143
propaov<-aov(BroodGapingSum$prop~BroodGapingSum$Site+BroodGapingSum$Pop+BroodGapingSum$Site:BroodGapingSum$Pop,BroodGapingSum)
summary(propaov)
## Df Sum Sq Mean Sq
## BroodGapingSum$Site 2 0.002420 0.001210
## BroodGapingSum$Pop 2 0.001675 0.000838
## BroodGapingSum$Site:BroodGapingSum$Pop 4 0.000524 0.000131
PropTukey<-TukeyHSD(propaov)
## Warning: NaNs produced
## Warning: NaNs produced
## Warning: NaNs produced
print(PropTukey)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = BroodGapingSum$prop ~ BroodGapingSum$Site + BroodGapingSum$Pop + BroodGapingSum$Site:BroodGapingSum$Pop, data = BroodGapingSum)
##
## $`BroodGapingSum$Site`
## diff lwr upr p adj
## Manchester-Fidalgo -0.01135 NaN NaN NaN
## Oyster Bay-Fidalgo 0.02769 NaN NaN NaN
## Oyster Bay-Manchester 0.03904 NaN NaN NaN
##
## $`BroodGapingSum$Pop`
## diff lwr upr p adj
## N-H 0.0006811 NaN NaN NaN
## S-H 0.0292772 NaN NaN NaN
## S-N 0.0285961 NaN NaN NaN
##
## $`BroodGapingSum$Site:BroodGapingSum$Pop`
## diff lwr upr p adj
## Manchester:H-Fidalgo:H 8.103e-04 NaN NaN NaN
## Oyster Bay:H-Fidalgo:H 1.810e-02 NaN NaN NaN
## Fidalgo:N-Fidalgo:H 1.209e-05 NaN NaN NaN
## Manchester:N-Fidalgo:H -8.243e-03 NaN NaN NaN
## Oyster Bay:N-Fidalgo:H 2.918e-02 NaN NaN NaN
## Fidalgo:S-Fidalgo:H 3.252e-02 NaN NaN NaN
## Manchester:S-Fidalgo:H 5.909e-03 NaN NaN NaN
## Oyster Bay:S-Fidalgo:H 6.831e-02 NaN NaN NaN
## Oyster Bay:H-Manchester:H 1.729e-02 NaN NaN NaN
## Fidalgo:N-Manchester:H -7.982e-04 NaN NaN NaN
## Manchester:N-Manchester:H -9.054e-03 NaN NaN NaN
## Oyster Bay:N-Manchester:H 2.837e-02 NaN NaN NaN
## Fidalgo:S-Manchester:H 3.171e-02 NaN NaN NaN
## Manchester:S-Manchester:H 5.098e-03 NaN NaN NaN
## Oyster Bay:S-Manchester:H 6.750e-02 NaN NaN NaN
## Fidalgo:N-Oyster Bay:H -1.809e-02 NaN NaN NaN
## Manchester:N-Oyster Bay:H -2.634e-02 NaN NaN NaN
## Oyster Bay:N-Oyster Bay:H 1.108e-02 NaN NaN NaN
## Fidalgo:S-Oyster Bay:H 1.442e-02 NaN NaN NaN
## Manchester:S-Oyster Bay:H -1.219e-02 NaN NaN NaN
## Oyster Bay:S-Oyster Bay:H 5.022e-02 NaN NaN NaN
## Manchester:N-Fidalgo:N -8.255e-03 NaN NaN NaN
## Oyster Bay:N-Fidalgo:N 2.917e-02 NaN NaN NaN
## Fidalgo:S-Fidalgo:N 3.251e-02 NaN NaN NaN
## Manchester:S-Fidalgo:N 5.897e-03 NaN NaN NaN
## Oyster Bay:S-Fidalgo:N 6.830e-02 NaN NaN NaN
## Oyster Bay:N-Manchester:N 3.743e-02 NaN NaN NaN
## Fidalgo:S-Manchester:N 4.076e-02 NaN NaN NaN
## Manchester:S-Manchester:N 1.415e-02 NaN NaN NaN
## Oyster Bay:S-Manchester:N 7.656e-02 NaN NaN NaN
## Fidalgo:S-Oyster Bay:N 3.334e-03 NaN NaN NaN
## Manchester:S-Oyster Bay:N -2.327e-02 NaN NaN NaN
## Oyster Bay:S-Oyster Bay:N 3.913e-02 NaN NaN NaN
## Manchester:S-Fidalgo:S -2.661e-02 NaN NaN NaN
## Oyster Bay:S-Fidalgo:S 3.580e-02 NaN NaN NaN
## Oyster Bay:S-Manchester:S 6.241e-02 NaN NaN NaN
Proptest<-prop.test(BroodGapingSum$Brooder,BroodGapingSum$Gaping, conf.level=0.95)
print(Proptest)
##
## 9-sample test for equality of proportions without continuity
## correction
##
## data: BroodGapingSum$Brooder out of BroodGapingSum$Gaping
## X-squared = 139.2, df = 8, p-value < 2.2e-16
## alternative hypothesis: two.sided
## sample estimates:
## prop 1 prop 2 prop 3 prop 4 prop 5 prop 6 prop 7 prop 8
## 0.009828 0.009840 0.042345 0.010638 0.001585 0.015737 0.027927 0.039012
## prop 9
## 0.078143
No comments:
Post a Comment