This file contains 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
qqfind <- function(x) { | |
# Generates the normal Q-Q plot for the given data | |
# as well as for three samples of the same size | |
# from a normal distribution with matching | |
# mean and variance. | |
# | |
# If it's obvious which one is the real data, | |
# it might not be normally distributed. | |
# | |
# Return value is the index of the plot |
This file contains 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
params.from.quantiles <- function(q, p, family="normal", start=c(0.5, 0.5)) { | |
# Finds parameter values of distributions that closely match | |
# the specified quantiles. | |
# | |
# Args: | |
# q: A vector of quantiles (length 2, strictly increasing) | |
# p: A vector of percentiles (length 2, strictly increasing) | |
# family: One of "normal", "beta", or "gamma" specifying | |
# which family of distributions to use | |
# start: starting values for parameter search |