This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Fitting distributions with R 1 FITTING DISTRIBUTIONS WITH R Release 0.421 February 2005 Vito Ricci vito_ricci@yahoo.com Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation: http://www.fsf.org/licenses/licenses.html#FDL Copyright 2005 Vito Ricci Fitting distributions with R 2 TABLE OF CONTENTS 1.0 Introduction 2.0 Graphics 3.0 Model choice 4.0 Parameters estimate 5.0 Measures of goodness of fit 6.0 Goodness of fit tests 6.1 Normality tests Appendix: List of R statements useful for distributions fitting References Fitting distributions with R 3 1.0 Introduction Fitting distributions consists in finding a mathematical function which represents in a good way a statistical variable. A statistician often is facing with this problem: he has some observations of a quantitative character x 1 , x 2 , x n and he wishes to test if those observations, being a sample of an unknown population, belong from a population with a pdf (probability density function) f(x, ), where is a vector of parameters to estimate with available data. We can identify 4 steps in fitting distributions: 1) Model/function choice: hypothesize families of distributions; 2) Estimate parameters; 3) Evaluate quality of fit; 4) Goodness of fit statistical tests. This paper aims to face fitting distributions dealing shortly with theoretical issues and practical ones using the statistical environment and language R 1 . R is a language and an environment for statistical computing and graphics flexible and powerful. We are going to use some R statements concerning graphical techniques ( 2.0), model/function choice ( 3.0), parameters estimate ( 4.0), measures of goodness of fit ( 5.0) and most common goodness of fit tests ( 6.0). To understand this work a basic knowledge of R is needed. We suggest a reading of An introduction to R 2 . R statements, if not specified, are included in stats package. 2.0 Graphics Exploratory data analysis can be the first step, getting descriptive statistics (mean, standard deviation, skewness, kurtosis, etc.) and using graphical techniques (histograms, density estimate, ECDF) which can suggest the kind of pdf to use to fit the model. We can obtain samples from some pdf (such as gaussian, Poisson, Weibull, gamma, etc.) using R statements and after we draw a histogram of these data. Suppose we have a sample of size n=100 belonging from a normal population N(10,2) with mean=10 and standard deviation=2: x.norm<rnorm(n=200,m=10,sd=2) We can get a histogram using hist() statement (Fig. 1): hist(x.norm,main="Histogram of observed data") 1 R Development Core Team (2004). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3900051070, URL: http://www.rproject.org ....
View
Full
Document
This note was uploaded on 03/10/2011 for the course STAT 134 taught by Professor Er during the Spring '11 term at DeAnza College.
 Spring '11
 er

Click to edit the document details