Skip to content

Instantly share code, notes, and snippets.

@huberflores
Created April 5, 2016 14:57
Show Gist options
  • Save huberflores/c5ff756fe1ca97d84523401aabc7f79a to your computer and use it in GitHub Desktop.
Save huberflores/c5ff756fe1ca97d84523401aabc7f79a to your computer and use it in GitHub Desktop.
Fitting data to a particular distribution
suppressMessages(library(fitdistrplus))
suppressMessages(library(logspline))
fileInput <- "/Users/hflores/Desktop/datasets/code-benchmarking/output70-t2large.csv"
codebenchmark = read.csv(fileInput, sep=";")
time <- codebenchmark$response
descdist(time, discrete = FALSE)
#weibull
fit.weibull <- fitdist(time, "weibull")
plot(fit.weibull)
fit.weibull$aic
#norm
fit.norm <- fitdist(time, "norm")
plot(fit.norm)
fit.norm$aic
#log normal
fit.lnorm <- fitdist(time, "lnorm")
plot(fit.lnorm)
fit.lnorm$aic
#exponential
fit.exp <- fitdist(time, "exp")
plot(fit.exp)
fit.exp$aic
#gamma
fit.gamma <- fitdist(time, "gamma")
plot(fit.gamma)
fit.gamma$aic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment