Last active
January 25, 2022 16:02
-
-
Save erikseulean/639fd875c14582066b11b152d829f31b to your computer and use it in GitHub Desktop.
interval
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npost = nrow(filter(df, Impact==1)) | |
| mm = mean(filter(df, Impact==1)$AbundanceRate) | |
| ll = mm - qnorm(1 - alpha/2) * sd(filter(df, Impact==1)$AbundanceRate)/sqrt(npost) | |
| uu = mm + qnorm(1 - alpha/2) * sd(filter(df, Impact==1)$AbundanceRate)/sqrt(npost) | |
| print(paste("lower", round(ll, 2))) | |
| print(paste("upper", round(uu, 2))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(fields) | |
| par(mrow=c(2,2)) | |
| quilt.plot(df$XPos[df$Impact==0], df$YPos[df$Impact==0], df$Nhat[df$Impact==0]/df$Area[df$Impact==0], pch=20, | |
| main="Impact = 0", xlab="X co-ordinate", ylab="Y co-ordinate", | |
| nrow=20, ncol=20, asp=1) | |
| quilt.plot(df$XPos[df$Impact==1], df$YPos[df$Impact==1], df$Nhat[df$Impact==1]/df$Area[df$Impact==1], pch=20, | |
| main="Impact = 1", xlab="X co-ordinate", ylab="Y co-ordinate", | |
| nrow=20, ncol=20, asp=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alpha = 0.02 | |
| quant = qt(p=alpha/2, df=n-1, lower.tail=F) | |
| n = nrow(filter(df, Impact==0)) | |
| m = mean(filter(df, Impact==0)$AbundanceRate) | |
| s = sd(filter(df, Impact==0)$AbundanceRate) | |
| lower = m - quant * s/sqrt(n) | |
| upper = m + quant * s/sqrt(n) | |
| print(paste("lower", round(lower, 2))) | |
| print(paste("upper", round(upper, 2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment