[R] truncpareto() - doesn't like my data and odd error message

peter dalgaard pdalgd at gmail.com
Wed Mar 9 20:58:30 CET 2016


> On 09 Mar 2016, at 18:52 , John Hillier <J.Hillier at lboro.ac.uk> wrote:
> 
> Dear All,
> 
> 
> I am attempting to describe a distribution of height data.  It appears roughly linear on a log-log plot, so Pareto seems sensible.  However, the data are only reliable in a limited range (e.g. 2000 to 4800 m). So, I would like to fit a Pareto distribution to the reliable (i.e. truncated) section of the data.
> 
> 
> I found truncpareto(), and implemented one of its example uses successfully.  Specifically, the third one at http://www.inside-r.org/packages/cran/vgam/docs/paretoff (also see p.s.).
> 
> 
> When I try to run my data, I get the output below. Inputs shown with chevrons.
> 
> 
>> pdataH <- data.frame(H_to_fit$Height)
>> summary(pdataH)
>   H_to_fit.Height
>   Min.   :2000
>   1st Qu.:2281
> 
>   Median :2666
>   Mean   :2825
>   3rd Qu.:3212
>   Max.   :4794
>> fit3 <- vglm(y ~ 1, truncpareto(2000, 4794), data = pdataH, trace = TRUE)
> Error in eval(expr, envir, enclos) :
>  the value of argument 'lower' is too high (requires '0 < lower < min(y)')
> 
> 
> This is odd as the usage format is - truncpareto(lower, upper), and varying 2000 to 1900 and 2100 makes no difference. Neither do smaller or larger variations. From the summary I think that my lowest input is 2000, which I am taking as min(y). I have also played with the upper limit.  pdataH has 2117 observations in it.
> 
> 
> Is this a data format thing? i.e. of pdataH (a tried a few things, but to no avail)
> 

Umm, it doesn't seem to have a column called "y"?

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list