Need to help to get value for bigger calculation

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Need to help to get value for bigger calculation

rehena
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Need to help to get value for bigger calculation

Hans W Borchers
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Need help on "BBoptim"

rehena
In reply to this post by rehena


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]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Need help in using "OPTIM / OPTIMIZATION" function

rehena
In reply to this post by rehena
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]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Integration in R

rehena
In reply to this post by rehena
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. 

Regards,
rehena
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Integration in R

Rolf Turner-3
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Integration in R

Ravi Varadhan-2
In reply to this post by rehena
Send us a reproducible R code that shows what you actually tried.

Ravi Varadhan, Ph.D.
Assistant Professor
The Center on Aging and Health
Division of Geriatric Medicine & Gerontology
Johns Hopkins University
[hidden email]<mailto:[hidden email]>
410-502-2619


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Integration in R

William Dunlap
In reply to this post by Rolf Turner-3
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: [hidden email] [mailto:[hidden email]] On Behalf
> Of Rolf Turner
> Sent: Wednesday, November 21, 2012 12:57 PM
> To: Rehena Sultana
> Cc: [hidden email]
> 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
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.