1 / 6

Probability Model Fitting Steps

Probability Model Fitting Steps. For a given data x1, x2, …, xN Plot the histogram with the default bin width >hist(x, probability=T, …, …) Also plot the boxplot Select candidate PDFs based on the histogram and boxplot Fit the PDFs – i.e., compute the parameters of the PDFs

kiral
Download Presentation

Probability Model Fitting Steps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Probability Model Fitting Steps • For a given data x1, x2, …, xN • Plot the histogram with the default bin width • >hist(x, probability=T, …, …) • Also plot the boxplot • Select candidate PDFs based on the histogram and boxplot • Fit the PDFs – i.e., compute the parameters of the PDFs • Evaluate the PDF at the observational points or on a finer grid (for better plotting) • E.g., to fit a Normal PDF to the data • >theta1 = mean(x) • >theta2 = sd(x) • >fitnormpdf = dnorm(sort(x), theta1, theta2) • Similarly fit all the candidate PDFs to the data – using the appropriate commands

  2. Goodness of Fit • The goodness of the fitted probability model can be evaluated in two ways – visual and Quantitative • Visual • Overlay the fitted PDF on the histogram • >lines(sort(x), fitnormpdf, col=“red”) • Quantile plots • Compute the quantiles from the fitted PDFs and • plot them agains the empirical quantiles. • If they fall on a straight line then the model is a good fit. • Empirical quantile P_i = (i- a)/(N + 1 – 2a) • i is the ‘rank’ of the observation x_i and a = 0 • If the observations are sorted then their ranks are simply the • sequential order • >N = length(x) • >empquant = (1:N)/(N+1) • >fitnormquant = qnorm(empquant, theta1, theta2) • >plot(fitnormquant, sort(x), xlab=“Model Quantiles”, ylab= “Empirical Quantiles”)

  3. Goodness of Fit • Quantitative • Perform a Kolmogrov-Smirnov (K-S) test on the empirical CDF and the fitted model CDF • >ksnorm = ks.test(x, “pnorm”, mean=theta1, sd=theta2) • This compares the empirical CDF with the fitted Normal PDF • If ksnorm$p.value is ‘greater than or equal’ to 0.05 it implies that • At 95% confidence level the empirical and the fitted distribution are not different • Use the quantitative and visual metrics to decide on the best model

  4. Boxplot IQR = 33 –26 = 7 °F One step = 1.5*7 = 10.5 °F Lower inner fence = 26 – 10.5 = 15.5 °F Upper inner fence = 33 + 10.5 = 43.5 °F The whiskers are drawn to the most extreme temperatures inside the inner fences, 37 and 17 °F. The whiskers are therefore shortened to extend only to the last observation within one step beyond either end of the box (“adjacent values”). One step = 1.5*IQR

  5. Histogram Histogram of Ithaca temperature, January 1987.

  6. Histogram and Probability Density Function

More Related