Displaying 20 results from an estimated 600 matches similar to: "Error when using fitdist function in R"
2012 Feb 15
1
Parameter estimation of gamma distribution
Hi,
I am trying to estiamte parameters for gamma distribution using mle for
below data using fitdist & fitdistr functions which are from "fitdistrplus"
& "MASS"packages . I am getting errors for both functions. Can someone
please let me know how to overcome this issue??
data
y1<-
c(256656, 76376, 6467673, 46446, 3400, 3100, 5760, 4562, 8000, 512, 4545,
4562,
2011 Mar 15
3
fitting a distribution to a ecdf plot
Dear all,
I need to plot an cumulative distribution plot of a variable and then to fit a distribution to that, probably a weibull or lognormal.
I have plotted the ecdf as
> plot(ecdf(x))
but I haven't managed to fit the distribution. I have as well attached the data.
I would appreciate if you could help me on that.
Thank you.
Kind regards
Maria
-------------- next part --------------
2011 Jul 26
2
Beta distribution- help needed
Hi,
Well, i need some help, practical and theoretical. I am wondering why the
fitdistplus (mle function) is returning an error for this code:
[code]
x1 <- c(100,200,140,98,97,56,42,10,2,2,1,4,3,2,12,3,1,1,1,1,0,0);
plotdist(x1);
descdist(x1, boot =1000);
y<- sum(x1);
d= as.vector(length(x1));
for(i in 1:length(x1)){
d[i] = x1[i]/y;
}
fitdist(d, "beta")
[/code]
Error:
2010 Jul 12
2
exercise in frustration: applying a function to subsamples
>From the documentation I have found, it seems that one of the functions from
package plyr, or a combination of functions like split and lapply would
allow me to have a really short R script to analyze all my data (I have
reduced it to a couple hundred thousand records with about half a dozen
records.
I get the same result from ddply and split/lapply:
>
2018 Jan 29
2
Result show the values of fitting gamma parameter
Hi,
Let say I have data by two columns A and B, and I have fit each column using the gamma distribution by 'fitdist' . I just want the result show only the shape and rate only.
Eg:
library(fitdistrplus)
A <-c(1,2,3,4,5)
B<-c(6,7,8,9,10)
C <-cbind(A,B)
apply(C, 2, fitdist, "gamma")
Output show like this:
$A
Fitting of the distribution ' gamma ' by maximum
2012 Mar 21
2
Error in fitdist- mle failed to estimate parameters
Hi,
I am trying fit certain data into Beta distribution. I get the error saying
"Error in fitdist(discrete_random_variable_c, "beta", start = NULL, fix.arg
= NULL) : the function mle failed to estimate the parameters, with the
error code 100"
Below is the sorted data that I am trying to fit. Where am I going wrong.
Thanks a lot for any help.
Vinod
2020 Oct 21
1
Fitting Mixed Distributions in the fitdistrplus package
Dear Sirs,
The below listed code fits a gamma and a pareto distribution to a data set
danishuni. However the distributions are not appropriate to fit both tails
of the data set hence a mixed distribution is required which has ben
defined as "mixgampar"
as shown below.
library(fitdistrplus)
x<- danishuni$Loss
fgam<- fitdist(x,"gamma",lower=0)
fpar<-
2018 Jan 29
0
Result show the values of fitting gamma parameter
Capture the results of the apply command into an object and then work with
that. Here is one way to do it:
> res <- apply(C, 2, fitdist, "gamma")
> out <- c( res$A$estimate["shape"], res$B$estimate["shape"],
res$A$estimate["rate"], res$B$estimate["rate"])
> names(out) <- c("A shape","B shape","A
2011 Aug 01
3
Beta fit returns NaNs
Hi,
sorry for repeating the question but this is kind of important to me and i
don't know whom should i ask.
So as noted before when I do a parameter fit to the beta distr i get:
fitdist(vectNorm,"beta");
Fitting of the distribution ' beta ' by maximum likelihood
Parameters:
estimate Std. Error
shape1 2.148779 0.1458042
shape2 810.067515 61.8608126
Warning
2009 Sep 19
1
generic methods - in particular the summary function
Hi all,
I'm currently working on the fitdistrplus package (that basically fit
distributions). There is something I do not understand about the
generic function summary.
In the current version on CRAN, there is no NAMESPACE saying
S3method(summary, fitdist)
.
However if we use summary on an object send by fitdist function it
works fine...
According to R-lang, we have
"
The most
2010 Oct 03
1
Johnson Distribution Fit
Hi,
I am trying to fit a Johnson SB distribution using fitdist function in
fitdistrplus Library. I have defined the Johnson SB distribution from (
http://www.ntrand.com/johnson-sb-distribution/) . But it gives me the
follwing errors. Any help would be appreciated
#xi = xi
#lambda =l
#delta =d
#gamma = g
djohn = function(x,xi,l,d,g)
(d/(l*sqrt(2*pi)*((x-xi)/l)*(1-((x-xi)/l))))*exp[-0.5*(g +
2009 Sep 25
1
Problem with dgamma function.
Hi, All,
I am getting some funny results trying to use R's built in
distribution functions.
In R:
> dgamma(4.775972,1.37697964405418, 0.106516604930466)
[1] 0.05585295
> dgamma(4.775972,1.37697964405418, 0.106516604930466,TRUE) ### THIS IS JUST WRONG!
[1] 0.01710129
> log(dgamma(4.775972,1.37697964405418, 0.106516604930466))
[1] -2.885033
>
In C:
2007 Apr 23
2
Problem with dgamma ?
Hi All,
Here 's what I got using dgamma function :
> nu<-.2
> nu*log(nu)-log(gamma(nu))+(nu-1)*log(1)-nu*(1)
[1] -2.045951
> dgamma(1,nu,nu,1)
[1] 0.0801333
> dgamma(1,nu,nu,0)
[1] NaN
Warning message:
NaNs produced in: dgamma(x, shape, scale, log)
Could anyone tell me what is wrong here ?
I am using R-2.4.1 on windows XP.
Thanks a lot.
2011 Sep 10
1
dgamma in jags within r
I define priors in jags within r using a gamma distribution. I would
like to control the shape but I have problems. Any help will be usefull.
From help of dgamma
___________________
The Gamma distribution with parameters shape = a and scale = s has density
f(x)= 1/(s^a Gamma(a)) x^(a-1) e^-(x/s)
and rate=1/scale
From jags user manual
____________________
dgamma(r, mu) has a density of
2010 Jul 15
1
How do I combine lists of data.frames into a single data frame?
The data.frame is constructed by one of the following functions:
funweek <- function(df)
if (length(df$elapsed_time) > 5) {
rv = fitdist(df$elapsed_time,"exp")
rv$year = df$sale_year[1]
rv$sample = df$sale_week[1]
rv$granularity = "week"
rv
}
funmonth <- function(df)
if (length(df$elapsed_time) > 5) {
rv =
2000 Feb 10
3
creating a grid of function values
I want to create a grid of function values for use in `contour' or
`persp'. The function is the log-likelihood for the gamma. The
sample is stored as vector of length 20 called `Survival'.
A single evaluation of the log-likelihood at, say, scale = 9 and shape
= 10 would be obtained by
sum(dgamma(Survival, scale = 9, shape = 10, log = TRUE))
(This may work only 0.99.0, I'm not
2013 Jul 12
2
How to determine the pdf of a gamma distribution using the estimated parameters?
Hello everyone,
With th bar histogram (number of occurrences) hist<-c(24,7,4,1,2,1,1) of seven equally spaces classes ]1-4], ]5-8], ]9-12], ]13-16], ]17-20], ]21-24], ]25-28], I obtained shape=0.8276 and rate=0.1448.
I would like to know how to build the continuous pdf of a this gamma distribution knowing these two estimated parameters such that I will be able to predict the pdf of any
2008 May 21
2
Converting Data Types
Hi,
How can I convert the matrices to list.
For example I have this snippet:
samples<-mymatrix[1,]
print(samples)
which prints:
V1 V2 V3 V4 V5 V6
1 103.9 88.5 242.9 206.6 175.7 164.4
How can I convert the object "samples" such that it prints:
[1] 103.9 88.5 242.9 206.6 175.7 164.4
The reason I ask this because I can't use the former
"samples"
2016 Nov 13
1
dgamma density values in extreme point
Dear R-Devel group,
My name is Alexey, a data scientist from Moscow, currently working for
Align Technology Inc.
We have recently had a discussion of the results that the dgamma
function (stats) returns for an extreme point (x == 0).
<dgamma(0,1,1,log = FALSE)
[1] 1
and
<dgamma(0,0.5,1,log = FALSE)
[1] Inf
Density appears to be defined in point zero for the distribution with
the
2011 Oct 06
1
apply and functions with many arguments
Dear all,
I would like to use the following function
fitdist(data, distr, method=c("mle", "mme", "qme", "mge"),
start=NULL, fix.arg=NULL, ...)
for many different distr values like distr=c("norm","lnorm","pois") (just a small example)
and take back into a list the parameter name which is what is inside distr plus what the