Goodness of Fit

Total Page:16

File Type:pdf, Size:1020Kb

Goodness of Fit GOODNESS OF FIT INTRODUCTION Goodness of fit tests are used to determine how well the shape of a sample of data obtained from an experiment matches a conjectured or hypothesized distribution shape for the population from which the data was collected. The idea behind a goodness-of-fit test is to see if the sample comes from a population with the claimed distribution. Another way of looking at that is to ask if the frequency distribution fits a specific pattern, or even more to the point, how do the actual observed frequencies in each class interval of a histogram compare to the frequencies that theoretically would be expected to occur if the data exactly followed the hypothesized probability distribution. This is relevant to cost risk analysis because we often want to apply a distribution to an element of cost based on observed sample data. A goodness of fit test is a statistical hypothesis test: Set up the null and alternative hypothesis; determine alpha; calculate a test statistic; look-up a critical value statistic; draw a conclusion. In this course, we will discuss three different methods or tests that are commonly used to perform Goodness-of-Fit analyses: the Chi-Square (χ2) test, the Kolmogorov-Smirnov One Sample Test, and the Anderson-Darling test. The Kolmogorov-Smirnov and Anderson-Darling tests are restricted to continuous distributions while the χ2 test can be applied to both discrete and continuous distributions. GOODNESS OF FIT TESTS CHI SQUARE TEST The Chi-Square test is used to test if a sample of data came from a population with a specific distribution. An attractive feature of the chi-square goodness-of-fit test is that it can be applied to any univariate distribution for which you can calculate the cumulative distribution function. The chi-square goodness-of-fit test is applied to binned data (i.e., data put into classes). This is actually not a restriction, since for non-binned data you can simply calculate a histogram or 1 Dec 2014 frequency table before generating the chi-square test. However, the value of the chi-square test statistic is dependent on how the data is binned. Another characteristic of the chi-square test is that it requires a sufficient sample size in order for the chi-square test statistic to be valid. The chi-square statistic measures how well the expected frequency of the fitted distribution compares with the frequency of a histogram of the observed data. It compares the histogram of the data to the shape of the candidate density (continuous data) or mass (discrete data) function. Definition The chi-square test is defined for the hypothesis: H0: The data follow a specified distribution. H1: The data do not follow the specified distribution. Test Statistic For the chi-square goodness-of-fit computation, the data are divided into k bins and the test k 2 2 statistic is defined as: x ((Oi Ei ) / Ei ) i1 where is the observed frequency for bin i and is the expected frequency for bin i. Computation of the expected frequency (Ei) will be shown by example. For the chi-square approximation to be valid, the expected frequency in each bin should be at least 5. This test is less sensitive when the sample size is small, and if some of the theoretical bin counts are less than five, you may need to combine some bins to ensure that there are at least 5 theoretical observations in each bin. Significance Level Critical Region: The test statistic follows, approximately, a Chi-Square distribution with (k – 1- number of population parameters estimated) degrees of freedom where k is the number of non- empty bins. If specific sample statistics need to be computed in order to develop the binning, then the degrees of freedom are reduced by the number of statistics that were computed. Therefore, the hypothesis that the data are from a population with the specified distribution is rejected if the computed χ is greater than the critical value. Note that the information needed to determine critical values from the χ2 distribution is the level of significance (α) and the Degrees k 2 2 of Freedom (df). If the sum of the squared deviations from x ((Oi Ei ) / Ei ) is small, the i1 observed frequencies are close to the expected frequencies and there would be no reason to reject 2 the claim that it came from that distribution. Only when the sum is large is there a reason to question the distribution. Therefore, the chi-square goodness-of-fit test is always a right tail test. KOLMOGOROV-SMIRNOV TEST The Kolmogorov-Smirnov One Sample Test, also referred to as the KS test, is an alternative to the χ2 test and is called a distribution-free test because it does not require that any assumptions about the underlying distribution of the Test Statistic be made. The KS test compares the cumulative relative frequency distribution derived from sample data with the theoretical cumulative relative frequency distribution that is described by the Null Hypothesis. In essence, the KS test is based on the maximum distance between these two cumulative relative frequency curves. The Tests Statistic, D, is the absolute value of the maximum deviation between the observed cumulative relative frequencies and the expected (theoretical) relative cumulative frequencies. Depending on the probability that such a deviation would occur if the sample data really came from the distribution specified in the Null Hypothesis, the Null Hypothesis should be rejected or not rejected. Note that in the KS test we are talking about relative frequencies, which are percentages rather than actual frequencies. The KS test is restricted to continuous distributions only. Definition The Kolmogorov-Smirnov test is defined as: H0: The data follow a specified distribution H1: The data do not follow the specified distribution Test Statistic: The Kolmogorov-Smirnov test statistic is defined as: D = Maximum|Fo – Fe| where: Fo = observed relative frequency Fe = theoretical relative frequency 3 Significance Level Critical Values: The hypothesis regarding the distributional form is rejected if the test statistic, D, is greater than the critical value obtained from a table. There are several variations of these tables in the literature that use somewhat different scalings for the KS test statistic and critical regions. These alternative formulations should be equivalent, but it is necessary to ensure that the test statistic is calculated in a way that is consistent with how the critical values were tabulated. ANDERSON-DARLING TEST The Anderson-Darling test is used to test if a sample of data came from a population with a specific distribution. It is a modification of the Kolmogorov-Smirnov (KS) test and gives more weight to the tails than does the KS test. The KS test is distribution free in the sense that the critical values do not depend on the specific distribution being tested. The Anderson-Darling test makes use of the specific distribution in calculating critical values. This has the advantage of allowing a more sensitive test and the disadvantage that critical values must be calculated for each distribution. Definition The Anderson-Darling test is defined as: H0: The data follow a specified distribution. H1: The data do not follow the specified distribution Test Statistic: The Anderson-Darling test statistic is defined as: 2 A = (-Sum/n)-n Where Sum is the sum of the (2i-1)*{(ln(Pi)+ln(1-Pn+1-i)} column and n is the sample size. The estimated (computed) Critical Value, designated as A* is computed as follows: A* = A2 (1.0 + 0.75/n + 2.25/n2) This is the value that is compared against the Critical Region value. Significance Level: α Critical Region: The critical values for the Anderson-Darling test are dependent on the specific distribution that is being tested. Tabulated values and formulas have been published (Stephens, 1974, 1976, 1977, 1979) for a few specific distributions (normal, lognormal, exponential, Weibull, logistic, extreme 4 value type 1). The test is a one-sided test and the hypothesis that the distribution is of a specific form is rejected if the test statistic, A, is greater than the critical value. Note that for a given distribution, the Anderson-Darling statistic may be multiplied by a constant (which usually depends on the sample size, n). These constants are given in the various papers by Stephens. In the sample output below, this is the “adjusted Anderson-Darling” statistic. This is what should be compared against the critical values. Also, be aware that different constants (and therefore critical values) have been published. You just need to be aware of what constant was used for a given set of critical values (the needed constant is typically given with the critical values). EXAMPLES CHI-SQUARE TEST EXAMPLE You have been presented with a set of 25 data points that represent the weights in pounds of missile warheads that have been installed on a number of different kinds of aircraft. The government is interested in determining if the distribution of these weights can be considered to be normally distributed with a mean of 100 lbs. and a standard deviation of 5 pounds. Table 1 provides the raw data with the values ranked from low to high. Table 1: Sample Data WEIGHTS (lbs.) 79.5 93.6 98.7 102.6 107.3 85.1 94.8 99.4 103.4 108.2 88.4 95.8 100.0 104.2 108.4 89.8 96.4 100.6 104.2 111.8 93.2 98.7 101.9 105.6 113.9 In order to perform the Chi-Square test, the data must be tabulated into “bins” to form the histogram.
Recommended publications
  • Relationships Among Some Univariate Distributions
    IIE Transactions (2005) 37, 651–656 Copyright C “IIE” ISSN: 0740-817X print / 1545-8830 online DOI: 10.1080/07408170590948512 Relationships among some univariate distributions WHEYMING TINA SONG Department of Industrial Engineering and Engineering Management, National Tsing Hua University, Hsinchu, Taiwan, Republic of China E-mail: [email protected], wheyming [email protected] Received March 2004 and accepted August 2004 The purpose of this paper is to graphically illustrate the parametric relationships between pairs of 35 univariate distribution families. The families are organized into a seven-by-five matrix and the relationships are illustrated by connecting related families with arrows. A simplified matrix, showing only 25 families, is designed for student use. These relationships provide rapid access to information that must otherwise be found from a time-consuming search of a large number of sources. Students, teachers, and practitioners who model random processes will find the relationships in this article useful and insightful. 1. Introduction 2. A seven-by-five matrix An understanding of probability concepts is necessary Figure 1 illustrates 35 univariate distributions in 35 if one is to gain insights into systems that can be rectangle-like entries. The row and column numbers are modeled as random processes. From an applications labeled on the left and top of Fig. 1, respectively. There are point of view, univariate probability distributions pro- 10 discrete distributions, shown in the first two rows, and vide an important foundation in probability theory since 25 continuous distributions. Five commonly used sampling they are the underpinnings of the most-used models in distributions are listed in the third row.
    [Show full text]
  • Goodness of Fit: What Do We Really Want to Know? I
    PHYSTAT2003, SLAC, Stanford, California, September 8-11, 2003 Goodness of Fit: What Do We Really Want to Know? I. Narsky California Institute of Technology, Pasadena, CA 91125, USA Definitions of the goodness-of-fit problem are discussed. A new method for estimation of the goodness of fit using distance to nearest neighbor is described. Performance of several goodness-of-fit methods is studied for time-dependent CP asymmetry measurements of sin(2β). 1. INTRODUCTION of the test is then defined as the probability of ac- cepting the null hypothesis given it is true, and the The goodness-of-fit problem has recently attracted power of the test, 1 − αII , is defined as the probabil- attention from the particle physics community. In ity of rejecting the null hypothesis given the alterna- modern particle experiments, one often performs an tive is true. Above, αI and αII denote Type I and unbinned likelihood fit to data. The experimenter Type II errors, respectively. An ideal hypothesis test then needs to estimate how accurately the fit function is uniformly most powerful (UMP) because it gives approximates the observed distribution. A number of the highest power among all possible tests at the fixed methods have been used to solve this problem in the confidence level. In most realistic problems, it is not past [1], and a number of methods have been recently possible to find a UMP test and one has to consider proposed [2, 3] in the physics literature. various tests with acceptable power functions. For binned data, one typically applies a χ2 statistic There is a long-standing controversy about the con- to estimate the fit quality.
    [Show full text]
  • Linear Regression: Goodness of Fit and Model Selection
    Linear Regression: Goodness of Fit and Model Selection 1 Goodness of Fit I Goodness of fit measures for linear regression are attempts to understand how well a model fits a given set of data. I Models almost never describe the process that generated a dataset exactly I Models approximate reality I However, even models that approximate reality can be used to draw useful inferences or to prediction future observations I ’All Models are wrong, but some are useful’ - George Box 2 Goodness of Fit I We have seen how to check the modelling assumptions of linear regression: I checking the linearity assumption I checking for outliers I checking the normality assumption I checking the distribution of the residuals does not depend on the predictors I These are essential qualitative checks of goodness of fit 3 Sample Size I When making visual checks of data for goodness of fit is important to consider sample size I From a multiple regression model with 2 predictors: I On the left is a histogram of the residuals I On the right is residual vs predictor plot for each of the two predictors 4 Sample Size I The histogram doesn’t look normal but there are only 20 datapoint I We should not expect a better visual fit I Inferences from the linear model should be valid 5 Outliers I Often (particularly when a large dataset is large): I the majority of the residuals will satisfy the model checking assumption I a small number of residuals will violate the normality assumption: they will be very big or very small I Outliers are often generated by a process distinct from those which we are primarily interested in.
    [Show full text]
  • Chapter 2 Simple Linear Regression Analysis the Simple
    Chapter 2 Simple Linear Regression Analysis The simple linear regression model We consider the modelling between the dependent and one independent variable. When there is only one independent variable in the linear regression model, the model is generally termed as a simple linear regression model. When there are more than one independent variables in the model, then the linear model is termed as the multiple linear regression model. The linear model Consider a simple linear regression model yX01 where y is termed as the dependent or study variable and X is termed as the independent or explanatory variable. The terms 0 and 1 are the parameters of the model. The parameter 0 is termed as an intercept term, and the parameter 1 is termed as the slope parameter. These parameters are usually called as regression coefficients. The unobservable error component accounts for the failure of data to lie on the straight line and represents the difference between the true and observed realization of y . There can be several reasons for such difference, e.g., the effect of all deleted variables in the model, variables may be qualitative, inherent randomness in the observations etc. We assume that is observed as independent and identically distributed random variable with mean zero and constant variance 2 . Later, we will additionally assume that is normally distributed. The independent variables are viewed as controlled by the experimenter, so it is considered as non-stochastic whereas y is viewed as a random variable with Ey()01 X and Var() y 2 . Sometimes X can also be a random variable.
    [Show full text]
  • A Study of Some Issues of Goodness-Of-Fit Tests for Logistic Regression Wei Ma
    Florida State University Libraries Electronic Theses, Treatises and Dissertations The Graduate School 2018 A Study of Some Issues of Goodness-of-Fit Tests for Logistic Regression Wei Ma Follow this and additional works at the DigiNole: FSU's Digital Repository. For more information, please contact [email protected] FLORIDA STATE UNIVERSITY COLLEGE OF ARTS AND SCIENCES A STUDY OF SOME ISSUES OF GOODNESS-OF-FIT TESTS FOR LOGISTIC REGRESSION By WEI MA A Dissertation submitted to the Department of Statistics in partial fulfillment of the requirements for the degree of Doctor of Philosophy 2018 Copyright c 2018 Wei Ma. All Rights Reserved. Wei Ma defended this dissertation on July 17, 2018. The members of the supervisory committee were: Dan McGee Professor Co-Directing Dissertation Qing Mai Professor Co-Directing Dissertation Cathy Levenson University Representative Xufeng Niu Committee Member The Graduate School has verified and approved the above-named committee members, and certifies that the dissertation has been approved in accordance with university requirements. ii ACKNOWLEDGMENTS First of all, I would like to express my sincere gratitude to my advisors, Dr. Dan McGee and Dr. Qing Mai, for their encouragement, continuous support of my PhD study, patient guidance. I could not have completed this dissertation without their help and immense knowledge. I have been extremely lucky to have them as my advisors. I would also like to thank the rest of my committee members: Dr. Cathy Levenson and Dr. Xufeng Niu for their support, comments and help for my thesis. I would like to thank all the staffs and graduate students in my department.
    [Show full text]
  • Testing Goodness Of
    Dr. Wolfgang Rolke University of Puerto Rico - Mayaguez CERN Phystat Seminar 1 Problem statement Hypothesis testing Chi-square Methods based on empirical distribution function Other tests Power studies Running several tests Tests for multi-dimensional data 2 ➢ We have a probability model ➢ We have data from an experiment ➢ Does the data agree with the probability model? 3 Good Model? Or maybe needs more? 4 F: cumulative distribution function 퐻0: 퐹 = 퐹0 Usually more useful: 퐻0: 퐹 ∊ ℱ0 ℱ0 a family of distributions, indexed by parameters. 5 Type I error: reject true null hypothesis Type II error: fail to reject false null hypothesis A: HT has to have a true type I error probability no higher than the nominal one (α) B: probability of committing the type II error (β) should be as low as possible (subject to A) Historically A was achieved either by finding an exact test or having a large enough sample. p value = probability to reject true null hypothesis when repeating the experiment and observing value of test statistic or something even less likely. If method works p-value has uniform distribution. 6 Note above: no alternative hypothesis 퐻1 Different problem: 퐻0: 퐹 = 푓푙푎푡 vs 퐻0: 퐹 = 푙푖푛푒푎푟 → model selection Usually better tests: likelihood ratio test, F tests, BIC etc. Easy to confuse: all GOF papers do power studies, those need specific alternative. Our question: is F a good enough model for data? We want to guard against any alternative. 7 Not again … Actually no, GOF equally important to both (everybody has a likelihood) Maybe more so for Bayesians, no non- parametric methods.
    [Show full text]
  • Measures of Fit for Logistic Regression Paul D
    Paper 1485-2014 SAS Global Forum Measures of Fit for Logistic Regression Paul D. Allison, Statistical Horizons LLC and the University of Pennsylvania ABSTRACT One of the most common questions about logistic regression is “How do I know if my model fits the data?” There are many approaches to answering this question, but they generally fall into two categories: measures of predictive power (like R-square) and goodness of fit tests (like the Pearson chi-square). This presentation looks first at R-square measures, arguing that the optional R-squares reported by PROC LOGISTIC might not be optimal. Measures proposed by McFadden and Tjur appear to be more attractive. As for goodness of fit, the popular Hosmer and Lemeshow test is shown to have some serious problems. Several alternatives are considered. INTRODUCTION One of the most frequent questions I get about logistic regression is “How can I tell if my model fits the data?” Often the questioner is expressing a genuine interest in knowing whether a model is a good model or a not-so-good model. But a more common motivation is to convince someone else--a boss, an editor, or a regulator--that the model is OK. There are two very different approaches to answering this question. One is to get a statistic that measures how well you can predict the dependent variable based on the independent variables. I’ll refer to these kinds of statistics as measures of predictive power. Typically, they vary between 0 and 1, with 0 meaning no predictive power whatsoever and 1 meaning perfect predictions.
    [Show full text]
  • Goodness of Fit of a Straight Line to Data
    5. A linear trend. 10.4 The Least Squares Regression Line LEARNING OBJECTIVES 1. To learn how to measure how well a straight line fits a collection of data. 2. To learn how to construct the least squares regression line, the straight line that best fits a collection of data. 3. To learn the meaning of the slope of the least squares regression line. 4. To learn how to use the least squares regression line to estimate the response variable y in terms of the predictor variablex. Goodness of Fit of a Straight Line to Data Once the scatter diagram of the data has been drawn and the model assumptions described in the previous sections at least visually verified (and perhaps the correlation coefficient r computed to quantitatively verify the linear trend), the next step in the analysis is to find the straight line that best fits the data. We will explain how to measure how well a straight line fits a collection of points by examining how well the line y=12x−1 fits the data set Saylor URL: http://www.saylor.org/books Saylor.org 503 To each point in the data set there is associated an “error,” the positive or negative vertical distance from the point to the line: positive if the point is above the line and negative if it is below theline. The error can be computed as the actual y-value of the point minus the y-value yˆ that is “predicted” by inserting the x-value of the data point into the formula for the line: error at data point (x,y)=(true y)−(predicted y)=y−yˆ The computation of the error for each of the five points in the data set is shown in Table 10.1 "The Errors in Fitting Data with a Straight Line".
    [Show full text]
  • Using Minitab to Run a Goodness‐Of‐Fit Test 1. Enter the Values of A
    Using Minitab to run a Goodness‐of‐fit Test 1. Enter the values of a qualitative variable under C1. 2. Click on “Stat”, choose “Tables” and then “Chi‐square Goodness of Fit Test (One Variable)”. 3. Click on the circle next to “Categorical data:” and enter C1 in the box to the right. 4. Under “Tests”, click on the circle next to “Equal proportions”. 5. Click on the “Graphs” button and uncheck the boxes next to both types of bar chart. 6. Click on “OK” in that window and on “OK” in the next window. The test results will appear in the “Sessions” window under the heading “Chi‐square Goodness of Fit Test for Categorical Variable: … ”. The test statistic will appear under “Chi‐Sq”. The P‐value will appear under “P‐value”. Example (Navidi & Monk, Elementary Statistics, 2nd edition, #23 p.566): The significance level is 0.01. Since 1 – 0.01 = 0.99, the confidence is 99%. The null hypothesis is that all months are equally likely. The alternative is the months are not all equally likely. The data is shown in the table below. Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Alarms 32 15 37 38 45 48 46 42 34 36 28 26 Open Minitab and enter the alarms values under C1. A portion of the entered data is shown below. ↓ C1 C2 Alarms 1 32 2 15 3 37 4 38 5 45 6 48 7 46 8 42 9 34 10 36 Now click on “Stat” and then choose “Tables” and “Chi‐Square Goodness‐of‐Fit Test (One Variable) …”.
    [Show full text]
  • Goodness-Of-Fit Tests for Parametric Regression Models
    Goodness-of-Fit Tests for Parametric Regression Models Jianqing Fan and Li-Shan Huang Several new tests are proposed for examining the adequacy of a family of parametric models against large nonparametric alternatives. These tests formally check if the bias vector of residuals from parametric ts is negligible by using the adaptive Neyman test and other methods. The testing procedures formalize the traditional model diagnostic tools based on residual plots. We examine the rates of contiguous alternatives that can be detected consistently by the adaptive Neyman test. Applications of the procedures to the partially linear models are thoroughly discussed. Our simulation studies show that the new testing procedures are indeed powerful and omnibus. The power of the proposed tests is comparable to the F -test statistic even in the situations where the F test is known to be suitable and can be far more powerful than the F -test statistic in other situations. An application to testing linear models versus additive models is also discussed. KEY WORDS: Adaptive Neyman test; Contiguous alternatives; Partial linear model; Power; Wavelet thresholding. 1. INTRODUCTION independent observations from a population, Parametric linear models are frequently used to describe Y m4x5 ˜1 ˜ N 401‘ 251 (1.1) the association between a response variable and its predic- D C tors. The adequacy of such parametric ts often arises. Con- ventional methods rely on residual plots against tted values where x is a p-dimensional vector and m4 5 is a smooth regres- sion surface. Let f 4 1 ˆ5 be a given parametri¢ c family. The or a covariate variable to detect if there are any system- ¢ atic departures from zero in the residuals.
    [Show full text]
  • Field Guide to Continuous Probability Distributions
    Field Guide to Continuous Probability Distributions Gavin E. Crooks v 1.0.0 2019 G. E. Crooks – Field Guide to Probability Distributions v 1.0.0 Copyright © 2010-2019 Gavin E. Crooks ISBN: 978-1-7339381-0-5 http://threeplusone.com/fieldguide Berkeley Institute for Theoretical Sciences (BITS) typeset on 2019-04-10 with XeTeX version 0.99999 fonts: Trump Mediaeval (text), Euler (math) 271828182845904 2 G. E. Crooks – Field Guide to Probability Distributions Preface: The search for GUD A common problem is that of describing the probability distribution of a single, continuous variable. A few distributions, such as the normal and exponential, were discovered in the 1800’s or earlier. But about a century ago the great statistician, Karl Pearson, realized that the known probabil- ity distributions were not sufficient to handle all of the phenomena then under investigation, and set out to create new distributions with useful properties. During the 20th century this process continued with abandon and a vast menagerie of distinct mathematical forms were discovered and invented, investigated, analyzed, rediscovered and renamed, all for the purpose of de- scribing the probability of some interesting variable. There are hundreds of named distributions and synonyms in current usage. The apparent diver- sity is unending and disorienting. Fortunately, the situation is less confused than it might at first appear. Most common, continuous, univariate, unimodal distributions can be orga- nized into a small number of distinct families, which are all special cases of a single Grand Unified Distribution. This compendium details these hun- dred or so simple distributions, their properties and their interrelations.
    [Show full text]
  • Probability Distributions Used in Reliability Engineering
    Probability Distributions Used in Reliability Engineering Probability Distributions Used in Reliability Engineering Andrew N. O’Connor Mohammad Modarres Ali Mosleh Center for Risk and Reliability 0151 Glenn L Martin Hall University of Maryland College Park, Maryland Published by the Center for Risk and Reliability International Standard Book Number (ISBN): 978-0-9966468-1-9 Copyright © 2016 by the Center for Reliability Engineering University of Maryland, College Park, Maryland, USA All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without permission in writing from The Center for Reliability Engineering, Reliability Engineering Program. The Center for Risk and Reliability University of Maryland College Park, Maryland 20742-7531 In memory of Willie Mae Webb This book is dedicated to the memory of Miss Willie Webb who passed away on April 10 2007 while working at the Center for Risk and Reliability at the University of Maryland (UMD). She initiated the concept of this book, as an aid for students conducting studies in Reliability Engineering at the University of Maryland. Upon passing, Willie bequeathed her belongings to fund a scholarship providing financial support to Reliability Engineering students at UMD. Preface Reliability Engineers are required to combine a practical understanding of science and engineering with statistics. The reliability engineer’s understanding of statistics is focused on the practical application of a wide variety of accepted statistical methods. Most reliability texts provide only a basic introduction to probability distributions or only provide a detailed reference to few distributions.
    [Show full text]