Skip to content

Instantly share code, notes, and snippets.

Patrick Schnell schnellp

View GitHub Profile
@schnellp
schnellp / qqfind.R
Created Apr 28, 2015
Which normal Q-Q plot is of the real data?
View qqfind.R
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
@schnellp
schnellp / params-from-quantiles.R
Created Apr 28, 2015
An R function for finding parameters of normal, beta, and gamma distributions that match a given pair of quantiles
View params-from-quantiles.R
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
You can’t perform that action at this time.