Re: [R] distribution fitting

From: Adelchi Azzalini <azzalini_at_stat.unipd.it>
Date: Thu 16 Feb 2006 - 19:24:05 EST

On Wed, 15 Feb 2006 14:39:53 -0500, Glazko, Galina wrote:

GG> Dear list,
GG> 
GG>  
GG> 
GG> Does anyone know how to fit the power law distribution?
GG> 
GG> I have the empirical distribution and would like to check whether
GG> it fits
GG> 
GG> the power law (with the power estimated from the data).
GG> 


you can you fitdistr() from MASS, as indicated below

notice that the so-called "exponential power" (Subbotin, 1923) distribution has been used with many different sort of parametrizations; the form used below is proportional to exp(-|x|^p/p).

best regards,
Adelchi Azzalini

--
library(MASS)
dep<- function(x,location,scale,tail) # Exponential power (=Subbotin)
{
  const<- 2*tail^(1/tail-1) *gamma(1/tail)
  z<- (x-location)/scale
  exp(-abs(z)^tail/tail)/(scale*const)
}


x <- rt(100,df=3)
a <- fitdistr(x, dep, start=list(location=0, scale=1, tail=1.5))
print(a$estimate)
print(a$sd)

-- 
Adelchi Azzalini  <azzalini@stat.unipd.it>
Dipart.Scienze Statistiche, UniversitÓ di Padova, Italia
tel. +39 049 8274147,  http://azzalini.stat.unipd.it/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Feb 16 19:30:18 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 14:08:28 EST