search for: dexp

Displaying 20 results from an estimated 61 matches for "dexp".

Did you mean: devp
2004 May 13
5
code for functions in base package
Is there any way that I can see the step by step code for functions in the base package? For instance the dexp function. I am a student working on writing my own function for something that is similar to this dexp function and I would like to see the step by step code. Brittany Laine GTA WVU Statistics Department 331 Hodges
2006 Jun 02
2
Problem with mle
...one is following the second call of mle: summary(fit.NE) gives me the summary of the fit, but profile(fit.NE) gives me the following error message: Error in onestep(step) : profiling has found a better solution, so original fit had not converged In addition: Warning messages: 1: NaNs produced in: dexp(x, 1/rate, log) 2: NaNs produced in: dexp(x, 1/rate, log) 3: NaNs produced in: dexp(x, 1/rate, log) 4: NaNs produced in: dexp(x, 1/rate, log) 5: NaNs produced in: dexp(x, 1/rate, log) 6: NaNs produced in: dexp(x, 1/rate, log) What can I do in this case - which parameters do I have to change that i...
2002 May 03
6
problems with rexp ?
Does anyone know if R have any problems with the exponential random number generation (function rexp)? I comment it because I executed data<-sort(rexp(100)) plot(data,dexp(data)/(1-pexp(data)),type="l") and the graphic isn't constant. (Note: exponential distribution have a constant hazard failure rate). Thank you, Juan -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac...
2011 Sep 06
2
Generalizing call to function
...73787740945863, 0.0148414691931943, 0.383193602946711, 0.0260964690514175, 0.236612585866545, 0.0422631787036055, 0.152456705113438, 0.0655923922306948) Thanks in advance. func1 <- function(y, a, rate) { f1 <- function(n, y, a, rate) { lambda <- a * n dexp(n, rate) * dpois(y, lambda) } integrate(f1, 0, Inf, y, a, rate) } func1(1, 0.1, 0.1) func2 <- function(y, a, rate, samp) { f1 <- function(n, y, a, rate, samp) { SampDist <- function(y, a, n, samp) { lambda <- a * n...
2004 Oct 27
1
Warning messages in function fitdistr (library:MASS)
...s (2:4)? > x <- rexp(1000,0.2) > fitdistr(x,"exponential",list(rate=1)) rate 0.219824219 (0.006951308) Warning messages: 1: one-diml optimization by Nelder-Mead is unreliable: use optimize in: optim(start, mylogfn, x = x, hessian = TRUE, ...) 2: NaNs produced in: dexp(x, 1/rate, log) 3: NaNs produced in: dexp(x, 1/rate, log) 4: NaNs produced in: dexp(x, 1/rate, log) and with respect to this function, it is curious that only for the normal family the mle is obtained in closed form. Why not in other cases like the exponential? Using R 1.9.1 or 2.0.0 under Win...
2008 Mar 21
1
(no subject)
Hi, I am fairly new to R, and am stuck. I want to write an R function with argument n that returns a vector of length n with n simulated observations from the double exponential distribution with density: ??g(y) = 1/2e^-y ? For the double exponential, I want to generate y~Exp(1) and then take ?y with probability 0.5 ? Does anyone know how I can do this in R? Thanks! Fran [[alternative
2008 Oct 16
1
Suppressing error messages in a for loop
Hi, Is there any way that I can supress error messages so that they don't stop for loops running? I'm using the gstat package and have created a variogram model for the double exponential model: "dexp <- vgm( .5, "Exp", 10,.1, add.to = vgm(.5, "Exp", 100))" and fitted it using "dexp.fit <- fit.variogram(temp2, dexp, fit.method=6, debug.level=0)" Occasionally I get the following error message and the model doesn't fit "Error in if (d...
2003 Oct 04
3
a bug of function plot (PR#4405)
Full_Name: Ximing Zhao Version: R 1.7.1 OS: MacOs X Submission from: (NULL) (64.136.27.51) When I used function plot in R 1.7.1, I found two bugs. My whole function is this: ***************** drawexp<-function(X,x,c,b){ exp<-function28(X,x,c,b) if(max(exp)>=max(dexp(x,rate=1))){ plot(x,exp, type="l",main= paste("Exponential ,n=",length(X)," c=",round(c,2),"b=",b),sub="X=exp(rate=1)") lines(x,dexp(x,rate=1),col="red",type="l") lines(density(X,width="SJ-dpi",n=1000,from=0.1,to=4),lt...
2010 Sep 29
1
sample exponential r.v. by MCMC
Dear R users, I am leaning MCMC sampling, and have a problem while trying to sample exponential r.v.'s via the following code: samp <- MCMCmetrop1R(dexp, theta.init=1, rate=2, mcmc=5000, burnin=500, thin=10, verbose=500, logfun=FALSE) I tried other distribtions such as Normal, Gamma with shape>1, it works perfectly fine. Can someon tell me why? Thank you for your help. Best, Zhongyi [[alter...
2011 Aug 29
1
maximum number of subdivisions reached
Why I am getting Error in integrate(f, x1, x1 + dx) : maximum number of subdivisions reached and can I avoid this? func <- function(y, a, rate, sad){ f3 <- function(z){ f1 <- function(y,a,n){ dpois(y,a*n) } f2 <- function(n,rate){ dexp(n,rate) } f <- function(n){ f1(y,a,n)*f2(n,rate) } r <- 0 r1 <- 1 x1 <- 0 dx <- 20 while(r1 > 10e-500){ r1 <- integrate(f,x1,x1+dx)$value r <- r + r1 x1 <- x1 + dx } r + integrate(f,x1,Inf)$valu } sapply(y,f3) } func(200,0.1,0.1,sad=Exp...
2005 Sep 06
2
fitting distributions with R
...esult, 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, myl...
2008 Aug 21
1
pnmath compilation failure; dylib issue?
....sdk -mmacosx- version-min=10.4 -std=gnu99 -dynamiclib -Wl,- headerpad_max_install_names -mmacosx-version-min=10.4 -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/ lib -o pnmath.so bd0.o beta.o chebyshev.o choose.o d1mach.o dbeta.o dbinom.o dcauchy.o dchisq.o dexp.o df.o dgamma.o dgeom.o dhyper.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 p...
2007 Mar 11
1
fitting a mixed exponential distribution
Hi all, I am attempting to fit, and test the goodness of fit of, a mixed exponential distribution to my dataset which consists of 15minute rainfall intensity data. FYI, the dataset spanning approx.2 years and 7 rainfall stations consists of some three hundred thousand 15min data records, of which some 30 thousand are non-zero rainfall amounts. Could anyone please tell me how i could do
2008 Dec 11
1
Complex integration in R
Dear R-user I need a function to approximate a complex integration. My function is: aprox2=function(s,x,rate){ dexp(x,rate)*exp(-s*x) } where argument s is a complex number. I can't use the integrate function because it's only used with "numeric" arguments Does anyone know some function to approximate complex integrals? Thanks Borja [[alternative HTML version deleted]]
2011 Mar 21
2
Exponential distribution
Dear R-users, I have to plot a exponential distribution like the plot in the pdf attached. I've write this code but I don't know how to draw the two lines.. Can anyone help me please? Thank you very much Pippo http://r.789695.n4.nabble.com/file/n3394476/exponential_smoothing.pdf exponential_smoothing.pdf -- View this message in context:
2011 Aug 22
1
d, p, q, r - What are the math relations with each other of this functions?
Hi all, Using the exponential distribution to exemplify: The dexp function is the PDF (1) and pexp is the CDF (2), that is obtained integrating the PDF. How can I get the qexp and the rexp? Considering that I have the PDF, how this two are mathematically related to the PDF? (1) ke^{-kx} (2) 1-e^{kx} Thanks in advance.
2011 Oct 12
1
CVbinary - Help
...t to obtain a cross validation for a regression model (binary response) but I got an error with CVbinary. Well I did this: fit <- lm(resp ~ PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 + PC8 + PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC18+PC19+PC20+PC21+PC22+PC23+PC24+PC25+PC26+PC27+PC28, data = dexp.cp, family=binomial()) CVbinary(fit) Error in sample(nfolds, m, replace = TRUE) : invalid 'size' argument I cannot understand this error, I was googling it, but i didn't find nothing really helpfull. Can someone help with is?...It's really important. Thank you for your time, Ana...
2013 May 03
0
Empirica Copula
...bivariate data and simulation. As explained in package documentation we can use our own data distribution to feed on copula as long as we have d, p and q (pdf, cdf and quantile) functions are available. Hence my code for those are: # Make the functions for data distribution dSAR<-function(SAR){dexp(SAR, rate=0.5)} pSAR<-function(SAR){pexp(SAR, rate=0.5)} qSAR<-function(SAR){qexp(c(seq(0,1, .01)),SAR, rate=0.5)} dper<-function(per) {dexp(per,rate=0.5)} pper<-function(per){pexp(per,rate=0.5)} qper<-function(per){qexp(c(seq(0,1,.01)),per, rate=0.5)} gmb<-gumbelCopula(3,dim=2...
2005 Aug 27
2
Defining an ex-gaussian PDF
How does one define PDFs as yet undefined in R, such as the ex- gaussian, the sum of two RVs, one exponential, one Gaussian? The PDF would then be the convolution of an exponential PDF, dexp(), and a normal, dnorm(). Kindly cc me in your reply to r-help. Thanks, _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels: Room 102 Gilmer Hall McCormick...
2009 Mar 04
1
how to estimate distribution?
Dear R-Experts, I have an empirical dataset with 150 subjects for 24 observations. In each observation, each subject can have a score in the range 0:3. I made then a simple index making the sum of the values in each row, so each subject have a score between 0 and 72. I was thinking about what kind of theoretical distribution such an index should have, so I try to make things random like: