Skip to content

Instantly share code, notes, and snippets.

@krishnanraman
Created September 13, 2019 19:27
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 krishnanraman/4b5ff446da6c55b971613fc43e4ebadc to your computer and use it in GitHub Desktop.
Save krishnanraman/4b5ff446da6c55b971613fc43e4ebadc to your computer and use it in GitHub Desktop.
tsum <- function(n, myn, mydf, myncp) {
mylist <- c()
for (i in 1:n) {
samp <- rt(n=myn, df = mydf, ncp=myncp)
mylist<- c(mylist,sum(samp) - min(samp))
}
return(mylist)
}
x<- tsum(1000, 250, 3, 1)
hist(x)
qqplot(x, qchisq(ppoints(x), df = 3)); abline(0, 1, col = 2, lty = 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment