search for: densfun

Displaying 20 results from an estimated 30 matches for "densfun".

2008 Nov 14
0
Error in optim when i call it from a function
Dear R-users I've got the next problem: I've got this *function*: fitcond=function(x,densfun,pcorte,start,...){ myfn <- function(parm,x,pcorte,...) -sum(log(dens(parm,x,pcorte,...))) Call <- match.call(expand.dots = TRUE) if (missing(start)) start <- NULL dots <- names(list(...)) dots <- dots[!is.element(dots, c("upper", "lower&quot...
2005 Apr 05
1
Fitdistr and likelihood
Hi all, I'm using the function "fitdistr" (library MASS) to fit a distribution to given data. What I have to do further, is getting the log-Likelihood-Value from this estimation. Is there any simple possibility to realize it? Regards, Carsten
2012 Feb 21
3
HELP ERROR Weibull values must be > 0
GUYS, I NEED HELP WITH ERROR: library(MASS) > dados<-read.table("mediaRGinverno.txt",header=FALSE) > vento50<-fitdistr(dados[[1]],densfun="weibull") Erro em fitdistr(dados[[1]], densfun = "weibull") : Weibull values must be > 0 WHY RETURN THIS ERROR? WHAT CAN I DO? BEST REGARDS [[alternative HTML version deleted]]
2013 Jan 22
2
Assistant
Good-day Sir, I am R.Language users but am try to? estimate parameter of beta distribution particular dataset but give this error, which is not clear to me: (Initial value in "vmmin" is not finite) beta.fit <- fitdistr(data,densfun=dbeta,shape1=value , shape2=value) kindly assist. expecting your reply:
2009 Nov 20
2
How to use results of distribution fitting for further processing?
This is probably simple, but I have a hard time finding the solution. Any help greatly appreciated.   I would like to use the results of fitdistr(z,densfun=dweibull,start=list(scale=1,shape=1)) for further processing.  How do I assign the values of scale and shape to b and a without manually entering the numbers?   TIA __________________________________________________________________ Looking for the perfect gift? Give the gift of Flickr!...
2010 Mar 08
1
lapply and list indexing basics (after realizing I wasn't previously subscribed...sorry)
...to use lapply to apply the fitdistr() function to only the 4th column (x$isi) of the dataframes in the list. Is there a way to do this or am I misusing lapply? As a second solution I tried splitting only the numeric data column to yield a list of vectors and then using lapply(myList, fitdistr, densfun='gamma',start=list(scale=1, shape=2)) returns the error: Error in optim(x = c(305, 290, 283, 363, 331, 293, 304, 312, 286, 339, : non-finite finite-difference value [2] In addition: Warning message: In dgamma(x, shape, scale, log) : NaNs produced However, if I use fitdistr(myList[[i...
2013 Apr 16
2
Strange error with log-normal models
...ing the glm command. The summary of my data is: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.0000 0.0000 0.0000 0.8617 0.8332 55.5600 So, no missing values, no negative values. When I try to use the fitdistr command, I get an error that I don't understand: m <- fitdistr(y, densfun="lognormal") Error in fitdistr(y, densfun = "lognormal") : need positive values to fit a log-Normal When I try to build a simple model, I also get an error: l <- glm(y~ x, family=gaussian(link="log")) Error in eval(expr, envir, enclos) : cannot find valid st...
2012 Feb 23
3
why is generating the same graph???
Hi, why my script iss always generating the same graph?when I change the parameters and the name of text file? library(MASS) dados<-read.table("inverno.txt",header=FALSE) vento50<-fitdistr(dados[[1]],densfun="weibull") png(filename="invernoRG.png",width=800,height=600) hist(dados[[1]], seq(0, 18, 0.5), prob=TRUE, xlab="Velocidade (m/s)",ylab="Densidade", main="50 m") curve(dweibull(x, shape=0.614, scale=2.435), 0,18,add=T, col='red') dev.off()...
2010 Jan 12
1
Strange behavior when trying to piggyback off of "fitdistr"
...missing or infinite values") if (missing(distfun) || !(is.function(distfun) || is.character(distfun))) stop("'density' must be supplied as a function or name") n <- length(x) if (is.character(distfun)) { distname <- tolower(distfun) densfun <- switch(distname, exp = dexp, exponential = dexp, gamma = dgamma, `log-normal` = dlnorm, lnorm = dlnorm, lognormal = dlnorm, weibull = dweibull, pareto = dpareto, loglogistic = dllogis, transbeta = dtrbeta, `transformed beta` = dtrbera, burr = dburr, paralog...
2010 Mar 08
1
lapply and list indexing basics
...e to use lapply to apply the fitdistr() function to only the 4th column (x$isi) of the dataframes in the list. Is there a way to do this or am I misusing lapply? As a second solution I tried splitting only the numeric data column to yield a list of vectors and then using lapply(myList, fitdistr, densfun='gamma',start=list(scale=1, shape=2)) returns the error: Error in optim(x = c(305, 290, 283, 363, 331, 293, 304, 312, 286, 339, : non-finite finite-difference value [2] In addition: Warning message: In dgamma(x, shape, scale, log) : NaNs produced However, if I use fitdistr(myList[[i]])...
2005 Sep 06
2
(no subject)
...64114;14334 how am I supposed to know what starting values i have to take? i get different parameterestimates depending on the starting values i choose, this shouldn't be, no? how am i supposed to know, which the "right" estimates should be? > library(MASS) > fitdistr(data2,densfun=dweibull,start=list(scale=2 ,shape=1 )) scale shape 1.378874e+04 8.788857e-01 (3.842224e+03) (1.312395e-01) > fitdistr(data2,densfun=dweibull,start=list(scale=6 ,shape=2 )) scale shape 7.81875000 0.12500000 (4.18668905) (0.01803669) #if i use the lognormald...
2012 Feb 21
5
help error: In dweibull(x, shape, scale, log) : NaNs produzidos
Guys, I'm having an error when I use the command: library(MASS)> dados<-read.table("inverno.txt",header=FALSE)> vento50<-fitdistr(dados[[1]],densfun="weibull")Mensagens de aviso perdidas:1: In dweibull(x, shape, scale, log) : NaNs produzidos2: In dweibull(x, shape, scale, log) : NaNs produzidos3: In dweibull(x, shape, scale, log) : NaNs produzidos4: In dweibull(x, shape, scale, log) : NaNs produzidos5: In dweibull(x, shape, scale, log...
2008 Aug 03
2
Determining model parameters
This may be a begining question. If so, please bear with me. If I have some data that based on the historgram and other plots it "looks" like a beta distribution. Is there a function or functions within R to help me determine the model parameters for such a distirbution? Similarily for other "common" distirbutions, Poisson(lambda), Chi-Square(degrees of freedom, chi-square
2013 Oct 28
0
"Optimization fail" error from fitdistr (Weibull distribution)
...62 36 46 37 42 38 24 39 9 40 13 41 9 42 5 43 2 R codes to calculate shape and scale are described below: Pine.windfrequency.4weeks<-read.table("C:/Users/kmoon/Documents/Pine_frequency_4weeks.csv",header=TRUE,sep=",") fitdistr(Pine.windfrequency.4weeks$Frequency, densfun="weibull") I have got an error message when I was using 'fitdistr' function "Error in fitdistr(Pine.windfrequency.4weeks$Frequency, densfun = "weibull") : optimization failed" Please help me calculating shape and scale of weibull distribution. And pl...
2008 Sep 19
0
Re lative Novice ? "Can I get some explanation of the docs for fitdistr(MASS)?"
In the docs I see: Usage fitdistr(x, densfun, start, ...) Arguments x A numeric vector. densfun Either a character string or a function returning a density evaluated at its first argument. Distributions "beta", "cauchy", "chi-squared", "exponential", "f", "gamma", "geometric...
2002 Aug 06
2
Estimating Weibull parameters
Hi R-Community, I have a vector of Weibull distributed observations and I would like to estimate the parameters "shape" and "scale" of the Weibull distribution. Is there a way to do this in R? Much thanks in advance, Hagen Schm?ller -- ----------------------------------------------------------------------- Dipl.-Ing. Hagen K. Schm?ller Institut f?r Elektrische Anlagen und
2005 Nov 17
1
Problem with fitdistr for gamma in R 2.2.0
....2.0. I have attached the code for data at the end of this mail so you can reproduce the problem. In short, I am able to run fitdistr under 2.1.0 without problems, while I get the following error under 2.2.0 (Version 2.2.0 Patched (2005-11-15 r36348)) > fitdistr(otm, "gamma") Error in densfun(x, parm[1], parm[2], ...) : 'shape' must be strictly positive The results on 2.1.1 (Version 2.1.1 (2005-06-20)) are > fitdistr(otm, "gamma") shape rate 1.030667 0.189177 (0.090537) (0.021166) Platform: Windows XP Thank you in advance for your effo...
2011 May 03
3
fitting distributions using fitdistr (MASS)
...t;) Error in fitdistr(x1, "beta") : 'start' must be a named list Yes, I do understand that sometime for the distribution to converge to the given set of data, it requires initial parameters of the distribution, to start off with. Hence, i tried this >x1fitbeta<-fitdistr(x1,densfun=dbeta, start=list(shape1=2,shape2=3)) Error in optim(x = c(1.89074018737135, 1.52649293971978, 2.19950245230280, : initial value in 'vmmin' is not finite I tried with "f" and "chi-square" what i did with "t". Please find below the output. > x1fitt<...
2009 Oct 06
2
Ajuste de distribuciones
Buenos días para cada una/o. Acabo de suscribirme. Tengo una inquietud que vi tratada por partes (y usando distintos paquetes) en las consultas anteriores. ¿Cuál es la mejor forma de ajustar distribuciones datos a distribuciones de probabilidad teóricas? ¿Cuáles son los paquetes para hacerlo en forma ágil? Gracias por su atención. Saludos. César Escalante C.
2005 Sep 06
2
fitting distributions with R
...d of a result, i get: Error in optim(start, f, method = method, hessian = TRUE, ...) : ?? ?? ?? ?? non-finite finite-difference value [1] In addition: There were 50 or more warnings (use warnings() to see the first 50) #with fitdistr() for the exponentialdistribution library(MASS) fitdistr(data2,densfun=dexp,start=list(rate=0.1),lower=6e-06,method="BFGS") #instead of a result, i get Error in optim(start, mylogfn, x = x, hessian = TRUE, ...) : ?? ?? ?? ?? non-finite finite-difference value [1] In addition: Warning messages: 1: bounds can only be used with method L-BFGS-B in: optim(start...