Hello R-Experts, I want to calculate values like 15^200 or 17^300 in R. In normal case it can calculate the small values of b (a^b). I have fixed width = 10000 and digits = 22 but still answers are Inf. How to deal the cases like these? Thanks in advance. Regards, rehena [[alternative HTML version deleted]]
Hans W Borchers
2012-May-22 10:50 UTC
[R] Need to help to get value for bigger calculation
Rehena Sultana <hena_4567 <at> yahoo.com> writes:> I want to calculate values like 15^200 or 17^300 in R. In normal case it can > calculate the small values of b (a^b). > I have fixed width = 10000 and digits = 22 but still answers are Inf. > > How to deal the cases like these? Thanks in advance.library(Rmpfr) m15 <- mpfr(15, precBits= 1024) m15^200 165291991078820803015600259355571011187461128806050897708002963982861165 279305672605355515846488679511983197774726563035424119280679882914553697 406070345089013507994161512883544043567583004683422057135011584705353016 03376865386962890625
Hello R-Experts, I want to use "BBoptim" function to get mle. Is this possible? Practically I want to check whether moment estimate of mle is really mle for a given data set. Thanks in advance. Regards, rehena [[alternative HTML version deleted]]
Rehena Sultana
2012-Jun-18 01:32 UTC
[R] Need help in using "OPTIM / OPTIMIZATION" function
Hi R-Experts, I want to know "for one parameter case, which function is better or correct, optim or optimization?" I want to optimize the function to get mle using "optimization" function for single parameter case. Is there any other method to check the "optimization" really gives the global mle not the local mle. Looking forward for your reply. Thanks in advance. Regards, hena [[alternative HTML version deleted]]
But if you use a smaller sdlog value then integrate does get it wrong because it does not find the delta-like function hidden somewhere between 0 and infinity. > integrate(function(x){dlnorm(x,meanlog=-0.3,sdlog=0.00041)},0,Inf) 0 with absolute error < 0 > integrate(function(x){dlnorm(x,meanlog=-0.3,sdlog=0.00041)},0,1) 0 with absolute error < 0 Tell it where the bulk of the mass is and it works > integrate(function(x)dlnorm(x,-0.3,0.00041), 0.738, 0.743, subdivisions=10^3) 1 with absolute error < 4.4e-05 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf > Of Rolf Turner > Sent: Wednesday, November 21, 2012 12:57 PM > To: Rehena Sultana > Cc: r-help at r-project.org > Subject: Re: [R] Integration in R > > On 21/11/12 22:26, Rehena Sultana wrote: > > Dear R - Experts, > > > > I am trying to integrate lognormal distribution (mu = -0.3 and sigma2 = 0.00041.. ) > based on the some hypothetical data. But I am getting 0 as the result. I have checked > that my R-code is correct as code is giving me result for some other data. > > > > As I understand, when I am integrating some pdf with in the range of (0, Inf), I should > not get 0. How to handle this kind of problem? > > > > Please help. Looking forward for your reply. > > Reproducible example? > > When I do > > integrate(function(x){dlnorm(x,meanlog=-0.3,sdlog=sqrt(0.00041))},0,Inf) > > I get > > 1 with absolute error < 3.5e-06 > > No problema. > > Why do you want to integrate it anyhow? You know the answer is 1. > > Or if you want the integral from 0 to x for some x < infinity, just use > plnorm(). (???) > > cheers, > > Rolf Turner > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.