search for: plnorm

Displaying 20 results from an estimated 54 matches for "plnorm".

Did you mean: rlnorm
2012 Aug 31
3
fitting lognormal censored data
...(dat2$'FALSE')$Ti) # Life times data set for censored # Stat.cen<-c((dat2$'FALSE')$Censored) # censoring Status data set # ##################### Estimation using optim function ################ ml= function(par){mu=par[1] s=par[2] -sum(dlnorm(tun,mu,s,log=TRUE))-sum(1-plnorm(tcen,mu,s))} Max=optim(c(0.5,0.5),ml) param=c(Max$par) ## My Problem is when I try to estimate parameters using newton raphson ### ########### intial values ############## mu=1 s=1 ############# Derivative for mu ########## F1= function(par){ mu=par[1] s=par[2] sum((log(tun)-mu)/s^2)+ sum(((1/s...
2012 Aug 29
2
Estimation parameters of lognormal censored data
Hi, I am trying to get the maximum likelihood estimator for lognormal distribution with censored data;when we have left, interval and right censord. I built my code in R, by writing the deriving of log likelihood function and using newton raphson method but my estimators were too high " overestimation", where the values exceed the 1000 in some runing of my code. is there any one can
2014 Jun 11
0
infelicity in dlnorm, plnorm
In theory, dlnorm(x, ...) == dnorm(log(x), ...)/x, x>0. Unfortunately, when sd=0, dlnorm and plnorm return NaN, while dnorm returns (if(x != mean)0 else Inf) and pnorm returns (if(x<mean)0 else 1). [A numerical optimization, maxLik{maxLik}, reported the NaNs for me.] help('dlnorm') says, "dlnorm is calculated from the definition (in ?Details?). [pqr]lnorm are based on the rel...
2010 Oct 15
2
using optimize with two unknowns, e.g. to parameterize a distribution with given confidence interval
...ers of a log-normal distribution with a 1-alpha CI of (x_lcl, x_ucl): However, I don't know how to optimize for the two unknown parameters. Here is my unsuccessful attempt to find a lognormal distribution with a 90%CI of 1,20: prior <- function(x_lcl, x_ucl, alpha, mean, var) { a <- (plnorm(x_lcl, mean, var) - (alpha/2))^2 b <- (plnorm(x_ucl, mean, var) - (1-alpha/2))^2 return(a+b) } optimize(fn=prior, interval = c(-5, 100), 1, 20) I understand that this problem has a closed form solution, but I would like to make this a general function. Thanks, David -- David LeBauer,...
2014 Oct 15
2
Test K-S con distribuciones LogNormales
...En cuanto al test KS, ten en cuenta que lo que hace es comparar > funciones de distribución empíricas: > # La de los datos originales: > curve(ecdf(sample)(x), type="s") > # Esta se parece mucho a la teórica como sería de esperar con una muestra > tan grande: > # curve(plnorm(x, meanlog = mean, sdlog = sd), lwd=2,add=TRUE) > > # con la de las medias de las submuestras: > curve(ecdf(sample_bucket$mean)(x),type="s",lty = 2, add = TRUE) > > Lo que creo que ocurre es que la segunda muestra es muy pequeña y el > test de KS no tiene evidencias...
2012 Jun 03
0
Bug in truncgof package?
...nk the test and the implementation of the truncgof package are just fine. I've done Carlos' experiment (repeatedly generating samples and testing them with AD) and the test never rejected the null hypothesis. @Carlos: in the first piece of code you are using ad.test (> ad.test(xt, "plnorm", list(meanlog = 2, sdlog = 2), H = 10)), but in the function that you are later defining for iteration purposes, you are use the KS test (> ks.test(xt, "plnorm", list(meanlog = 2, sdlog = 2), H = 10)$p.value)... This may have something to do with the contradictory results t...
2009 May 31
1
Bug in truncgof package?
...t reply, so I am resending my query here. I installed package truncgof and run the example for function ad.test. I got the following output: set.seed(123) treshold <- 10 xc <- rlnorm(100, 2, 2) # complete sample xt <- xc[xc >= treshold] # left truncated sample ad.test(xt, "plnorm", list(meanlog = 2, sdlog = 2), H = 10) Supremum Class Anderson-Darling Test data: xt AD = 3.124, p-value = 0.12 alternative hypothesis: two.sided treshold = 10, simulations: 100 So I cannot reject the hipothesis (at a standard confidence level) that the original sample comes from a...
2017 Nov 07
2
Using MLE on a somewhat unusual likelihood function
...etimes indicates that the list of starting values is too far from optimum but this is unlikely since I picked values close to where the parameters usually end up. I have also tried switching these around a bit. Here is the code: xhat = c(statemw-(1-alpha)*rval) survivalf <- function(x) {(1-plnorm(statemw,mean=mu,sd=logalpha))} wagefn <- function(lam, eta, alpha, xhat, mu, logalpha) { n=nrow(cpsdata2) wagevec = matrix(nrow=n,ncol=1) for (i in 1:n) { if (cpsdata2[i,2] > 0){ wagevec[i,] <- c(eta*lam*survivalf(statemw)*exp(-lam*survivalf(statemw)*cpsdata2[i,2,]))...
2010 Apr 28
0
Truncated Lognormal Distribution
...2,153.05,70.26,530.42,3440.29,97.45,174.51,168.47, 116.63,36.51, 219.77, 231.67,110.62,173.11,202.85,689.27,23.82,234.15,625.89,192.88,29.53,109.99, 80.53, 46.85,82.69,231.53,75.38,217.52,85.29,182.18) ltlnorm <- function(x, meanlog, sdlog, log=FALSE) { dlnorm(x, meanlog, sdlog, log = FALSE) / plnorm(1, meanlog, sdlog, lower.tail = TRUE, log.p = FALSE) } meanlog = mean(log(x)) sdlog = sd(log(x)) ltlnormfit <- fitdistr(x,ltlnorm, start=list(meanlog,sdlog)) I get following error - Error in dlnorm(x, meanlog, sdlog, log = FALSE) : element 3 is empty;    the part of the args list of '....
2013 Jun 28
0
"actuar" package query
I run the following: library(actuar) x <- seq(0, 22, 0.5) fl <- discretize(plnorm(x, 2.1), from = 0, to = 22, step = 0.5, method ="lower") Fs <- aggregateDist("recursive", model.freq = "poisson",model.sev = fl, lambda = 10, x.scale = 0.5) Warning message: In panjer(fx = model.sev, dist = dist, p0 = p0, x.scale = x.scale, : maximum number of re...
2003 Feb 27
2
interval-censored data in survreg()
I am trying to fit a lognormal distribution on interval-censored data. Some of my intervals have a lower bound of zero. Unfortunately, it seems like survreg() cannot deal with lower bounds of zero, despite the fact that plnorm(0)==0 and pnorm(-Inf)==0 are well defined. Below is a short example to reproduce the problem. Does anyone know why survreg() must behave that way? Is there an alternate solution to this problem? Sincerely, Jerome Asselin library(survival) data(ovarian) newovarian <- ovarian newovarian$lower5...
2008 Aug 21
1
pnmath compilation failure; dylib issue?
...yper.o dlnorm.o dlogis.o dnbeta.o dnbinom.o dnchisq.o dnf.o dnorm.o dnt.o dpois.o dt.o dunif.o dweibull.o fmax2.o fmin2.o ftrunc.o gamma.o gamma_cody.o i1mach.o imax2.o imin2.o lbeta.o lgamma.o lgammacor.o mlutils.o pbeta.o pbinom.o pcauchy.o pchisq.o pexp.o pf.o pgamma.o pgeom.o phyper.o plnorm.o plogis.o pnbeta.o pnbinom.o pnchisq.o pnf.o pnmath.o pnorm.o pnt.o polygamma.o ppois.o pt.o ptukey.o punif.o pweibull.o qbeta.o qbinom.o qcauchy.o qchisq.o qexp.o qf.o qgamma.o qgeom.o qhyper.o qlnorm.o qlogis.o qnbeta.o qnbinom.o qnchisq.o qnf.o qnorm.o qnt.o qpois.o qt.o qtukey.o qunif....
2010 Jan 12
1
Strange behavior when trying to piggyback off of "fitdistr"
...he function passed to optim. What is weird is when I leave out the density correction (which is safe 99.9999% of the time as the chances of two identical losses is almost 0 (assuming no clustering/capping) ), I get a very similar result to my distribution-customized function which calls the proper plnorm or pgenpareto directly. When I add in the correction, the value is orders of magnitude higher, which not only affects the fit (slightly) but also affects the goodness of fit statistics. I have no idea why this happens, although in theory, if the function is pulling too many density values, it would...
2006 Feb 08
1
Simple optim - question
Hello, I want to find the parameters mu and sigma that minimize the following function. It's important, that mu and sigma are strictly positive. ----------------- optimiere = function(fmean,smean,d,x,mu,sigma) { merk = c() for (i in 1:length(d)) merk=c(merk,1/(d[i]^2)*(d[i]-1/(fmean*(1-plnorm(x[i],mu,sigma))))^2) return(sum(merk)) } ----------------- To do that I'm using the nlm function, but I only get results for ONE of the two parameters. I cannot cope with optimizing the two parameter problem simultaneously. I've started with: nlm(optimiere,p=5,fmean=10,smean=10000,d=c(40,...
2005 Jan 31
2
ML-Fit for truncated distributions
Hello, maybe that my Question is a "beginner"-Question, but up to now, my research didn't bring any useful result. I'm trying to fit a distribution (e.g. lognormal) to a given set of data (ML-Estimation). I KNOW about my data that there is a truncation for all data below a well known threshold. Is there an R-solution for an ML-estimation for this kind of data-problem? As
2005 Mar 12
1
MLE for two random variables
...reshold u (xu) I have to fit a model on these these two sources, thereby I assume that both are "drawn" from the same distribution (eg lognormal). In a MLE I would sum the densities and maximize. The R-Function could be: function(x,xu,u,mu,sigma) dlnorm(x,mu,sigma)+(dlnorm(xu,mu,sigma)/(plnorm(u,mu,sigma))) So I tried to use the function FITDISTR for the MLE. But unfortunately it only accepts ONE random variable. Then I tried to combine x and xu in a vector, but that doesn't work, too, because the length of x and xu differs. Does anybody has a solution for my problem? Thanks in ad...
2017 Nov 07
0
Using MLE on a somewhat unusual likelihood function
...starting values is too far > from optimum but this is unlikely since I picked values close to where the > parameters usually end up. I have also tried switching these around a bit. > > Here is the code: > > xhat = c(statemw-(1-alpha)*rval) > survivalf <- function(x) {(1-plnorm(statemw,mean=mu,sd=logalpha))} > > wagefn <- function(lam, eta, alpha, xhat, mu, logalpha) { > n=nrow(cpsdata2) > wagevec = matrix(nrow=n,ncol=1) > for (i in 1:n) { > > if (cpsdata2[i,2] > 0){ > wagevec[i,] <- > c(eta*lam*survivalf(statemw)*exp(-la...
2017 Jul 10
4
fit lognorm to cdf data
...ata=data.frame(sito=seq(0,1,.01))), col=2) I tried to fit with SSfpl, which is let say close but probably not enough. I tried to find how to fit lognorm CDF to my data but did not find an easy solution. Before I start to invent wheel I ask for some hints. I thought about using optim together with plnorm or to feed nls with lognorm function but maybe somebody already solved such task. Best regards Petr ________________________________ Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a jsou ur?eny pouze jeho adres?t?m. Jestli?e jste obdr?el(a) tento e-mail omylem, informujte laskav...
2017 Jul 10
0
fit lognorm to cdf data
How about proc <- c(0.9, 0.84, 0.5, 0.16, 0.1) size <- c(0.144, 0.172, 0.272, 0.481, 0.583) plot(size, proc, xlim=c(0,1), ylim=c(0,1)) fit<-nls(proc~plnorm(size, log(xmid), sdlog, lower=FALSE), start=list(xmid=0.2, sdlog=.1)) summary(fit) lines(fitted(fit)~size) -pd > On 10 Jul 2017, at 16:27 , PIKAL Petr <petr.pikal at precheza.cz> wrote: > > Dear all > > I am struggling to fit data which form something like CDF by lognorm. &...
2008 Nov 14
0
Error in optim when i call it from a function
...(densfun) densfun <- switch(distname,exponential = dexp,gamma = dgamma, "log-normal" = dlnorm, lognormal = dlnorm, weibull = dweibull, pareto = dpareto, NULL) distfun <- switch(distname,exponential = pexp,gamma = pgamma, "log-normal" = plnorm, lognormal = plnorm, weibull = pweibull, pareto = ppareto, NULL) if (is.null(densfun)) stop("unsupported distribution") if (distname %in% c("lognormal", "log-normal")) { if (!is.null(start))...