Skip to content

Instantly share code, notes, and snippets.

@bschneidr
Created February 25, 2021 17:42
Show Gist options
  • Save bschneidr/d8fee804f633eb8211ffabcb35414f30 to your computer and use it in GitHub Desktop.
Save bschneidr/d8fee804f633eb8211ffabcb35414f30 to your computer and use it in GitHub Desktop.
Calculate Confidence Intervals using Franco et al. R Code
# Download Franco et al. supplementary materials if you trust this code to safely download materials ----
trust <- FALSE
if (trust) {
download.file("https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6690503/bin/smy019_supplementary_data.zip",
destfile = "franco-et-al-ci-supp.zip")
}
# Unzip the folder ----
unzip("franco-et-al-ci-supp.zip", exdir = "franco-et-al-ci-supp")
# Load the RData object which contains functions to use ----
load("franco-et-al-ci-supp/RSupp.RData")
# Calculate each type of confidence interval ----
CIarrFcn(
kstar = c(10,15), # Weighted counts
m = c(10,30), # Effective sample size
alpha = 0.05
)
#> , , Wald
#>
#> Lowr Upr Width Flag LoInd
#> 1 1.0000000 1.0000000 0.0000000 0 0
#> 2 0.3210806 0.6789194 0.3578388 0 0
#>
#> , , JeffPr
#>
#> Lowr Upr Width Flag LoInd
#> 1 0.7828037 0.9999521 0.2171484 0 0
#> 2 0.3280214 0.6719786 0.3439573 0 0
#>
#> , , UnifPr
#>
#> Lowr Upr Width Flag LoInd
#> 1 0.7150858 0.997701 0.2826152 0 0
#> 2 0.3306060 0.669394 0.3387881 0 0
#>
#> , , ClPe
#>
#> Lowr Upr Width Flag LoInd
#> 1 0.6915029 1.0000000 0.3084971 1 0
#> 2 0.3129703 0.6870297 0.3740594 0 0
#>
#> , , Wils
#>
#> Lowr Upr Width Flag LoInd
#> 1 0.7224672 1.0000000 0.2775328 0 0
#> 2 0.3315413 0.6684587 0.3369175 0 0
#>
#> , , AgCo
#>
#> Lowr Upr Width Flag LoInd
#> 1 0.6791127 1.0000000 0.3208873 1 0
#> 2 0.3315413 0.6684587 0.3369175 0 0
#>
#> , , Assqr
#>
#> Lowr Upr Width Flag LoInd
#> 1 0.7490046 1.0000000 0.2509954 1 0
#> 2 0.3248746 0.6751254 0.3502508 0 0
#>
#> , , Logit
#>
#> Lowr Upr Width Flag LoInd
#> 1 1.0000000 1.0000000 0.000000 0 0
#> 2 0.3283455 0.6716545 0.343309 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment