Skip to content

Instantly share code, notes, and snippets.

@aegis1980
Last active August 18, 2018 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aegis1980/6a119c8e48ba971e69255d3963fbc135 to your computer and use it in GitHub Desktop.
Save aegis1980/6a119c8e48ba971e69255d3963fbc135 to your computer and use it in GitHub Desktop.
# Fractile estimation from samples – prediction method with t-student distribution, if you dont know parent pop sd
tp <- function(x,n){
result <- qt(x,n-1) * sqrt(1+(1/n))
return(result)
}
# Fractile estimation from samples – prediction method with normal distribution, if you do know parent pop sd
up <- function(x,n){
result <- qnorm(x) * sqrt(1+(1/n))
return(result)
}
# Two functions above use prediciton ethod, think I need to use the 'coverage method' that takes in account confidence.
# Not sure how!
kappa <-function(gamma,x,n,skew){
# some funciton I dont know :(
return (0)
}
# Using prediciton moethods functions, with x=0.05
# This does not give values in AS/NZS table B1
kt <- function(n,x,COV){
k = c(tp(x,n), up(x,n))
result <- 1/(1 + k*COV)
return(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment