[R] Running Fortran code from R

2011-04-26 Thread A.Noufaily
Dear R users,

I have a Fortran code that I would like to compile and call from R later.
I have never worked with Fortran before. Does anyone know the steps to create 
Fortran DLLs for R on a Windows PC.
Is anyone aware of a manual (or does anyone know how to) that explains:

-  What tools and software I need to download for that
-  How to set the paths in my PC
-  What Fortran Version is the best to have in this case
-  How to produce DLLs
-  How to load the code in R

I would really appreciate it if someone can help me.

Kind Regards,
Amy

-- 
The Open University is incorporated by Royal Charter (RC 000391), an exempt 
charity in England  Wales and a charity registered in Scotland (SC 038302).

[[alternative HTML version deleted]]

__
R-help@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.


[R] Regularized gamma function/ incomplete gamma function

2009-12-11 Thread A.Noufaily


Dear all,

I would be very grateful if you could help me with:

Given the regularized gamma function Reg=int_0^r (x^(k-1)e^(-x))dx/int_0^Inf 
(x^(k-1)e^(-x))dx ; 0rInf (which is eventually the ratio of the
Incomplete gamma function by the gamma function), does anyone know of a package 
in R that would evaluate the derivative of the inverse of Reg with respect to 
k? I am aware that the function Rgamma.inv of the package Zipfr evaluates 
the inverse
of Reg and I'm wondering wether there is a function that would evaluate the 
derivative of the inverse..

Alternatively, a good numerical integration package/ or simply a function that 
could evaluate the integral int_0^r (log(x) x^(k-1) e^(-x))dx;  0rInf
would be useful. I tried the function int of the package rmutil but I'm not 
sure wether it is accurate especially for small values of k. Does R have a 
powerful numerical integration package that can deal with such functions 
especially when the limit close to zero in + or - Inf?

Many thanks for this opportunity to post our queries,

Amy



  

The Open University is incorporated by Royal Charter (RC 000391), an exempt 
charity in England  Wales and a charity registered in Scotland (SC 038302).

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Computational problems in R

2008-10-27 Thread A.Noufaily
 
Many thanks for your suggestions...

I am still checking which one is the most useful for my simulations.

Concerning using logs, this might be very helpful, but I am not sure if
I can use the following:
A+B = A*(1 + B/A)
= exp(log(A) + log(1 + B/A))
because unfortunately B can be negative.
However, I might still use logs in case (1 + B/A)0.

Regards,
 
Amy

-Original Message-
From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
Sent: Saturday, October 25, 2008 11:36 AM
To: Steven McKinney
Cc: A.Noufaily; r-help@r-project.org
Subject: Re: [R] Computational problems in R

On 24/10/2008 9:50 PM, Steven McKinney wrote:
 I suspect there's a deeper issue here.
 sum(exp(yi)) when large yi occur is
 problematic.  exp(yi) for yi710 is
 just a huge number, and summing additional values only makes the 
 overall sum larger as all components of the summation are positive.
 There's no way around that.

Sure there is, and you quoted it below.  Work on a log scale.  The log
of exp(yi) is yi, and it sounds as though the yi values are manageable.

You might end up knowing that the log of the final answer is 2 and
not be able to evaluate exp(2) in R, but you still know that the
answer is exp(2).

Duncan Murdoch
 
 You could try this with Robin Hankins'
 package brobdingnag which can handle bunches of bizarrely large 
 numbers.
 
 What kind of process are you studying?
 What kind of process generates values
 such as exp(8/0.01) when other values
 are much smaller?  Are these outliers
 in an otherwise well-behaved
 data set?  Perhaps then they need
 to be set aside and investigated
 separately, etc.
 
 
 Steven McKinney
 
 Statistician
 Molecular Oncology and Breast Cancer Program British Columbia Cancer 
 Research Centre
 
 email: smckinney +at+ bccrc +dot+ ca
 
 tel: 604-675-8000 x7561
 
 BCCRC
 Molecular Oncology
 675 West 10th Ave, Floor 4
 Vancouver B.C. 
 V5Z 1L3
 Canada
 
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED] on behalf of Duncan Murdoch
 Sent: Fri 10/24/2008 4:04 PM
 To: A.Noufaily
 Cc: r-help@r-project.org
 Subject: Re: [R] Computational problems in R
  
 On 24/10/2008 12:42 PM, A.Noufaily wrote:
 Dear all,

 I would be grateful if anyone can help me with the following:

 My aim is to compute explicitely the sum S=A+B where 
 A=sum(exp(c_i/d)), i=1,...,n; B, c_i, and d are real numbers with 
 -InfB,c_i+Inf; and d0.
 The problem is that when c_i/d 710 (for some i) R is setting
 exp(c_i/d) to be equal to +Inf and hence the whole summation S.
 So in simple cases where for example c_i=8 (for some i), and d=0.01 
 the whole summation is turning out to be infinite.
 Is there a way to get round that in R?
 Can anyone suggest any computational trick to calculate S when 
 c_i/d710 (for some i)?
 
 Work on a log scale.  Use the identity that
 
 A+B = A*(1 + B/A)
  = exp(log(A) + log(1 + B/A))
 
 (where you chose A to be the biggest term in the sum).
 
 Duncan Murdoch
 
 Any suggestions would be much appreciated.

 Regards,

 Amy





 -
 The Open University is incorporated by Royal Charter (RC 000391), an
exempt charity in England  Wales and a charity registered in Scotland
(SC 038302).

  [[alternative HTML version deleted]]

 __
 R-help@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.
 
 __
 R-help@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.
 
 __
 R-help@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.


-
The Open University is incorporated by Royal Charter (RC 000391), an exempt 
charity in England  Wales and a charity registered in Scotland (SC 038302).

__
R-help@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.


[R] Computational problems in R

2008-10-24 Thread A.Noufaily

Dear all,

I would be grateful if anyone can help me with the following:

My aim is to compute explicitely the sum S=A+B where A=sum(exp(c_i/d)),
i=1,...,n;
B, c_i, and d are real numbers with -InfB,c_i+Inf; and d0.
The problem is that when c_i/d 710 (for some i) R is setting
exp(c_i/d) to be equal to +Inf and hence the whole summation S.
So in simple cases where for example c_i=8 (for some i), and d=0.01 the
whole summation is turning out to be infinite.
Is there a way to get round that in R?
Can anyone suggest any computational trick to calculate S when c_i/d710
(for some i)?

Any suggestions would be much appreciated.

Regards,

Amy





-
The Open University is incorporated by Royal Charter (RC 000391), an exempt 
charity in England  Wales and a charity registered in Scotland (SC 038302).

[[alternative HTML version deleted]]

__
R-help@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.


[R] Error reporting in R

2008-10-20 Thread A.Noufaily

Hello,

I am hoping someone can help me with the following:

I am applying the function mle on a single data set X n times, each
time using a different set of initial values v[i] (i=1,...,n).
The initial values are all finite. Two cases arise:
A- For some sets of initial values mle is giving parameter estimates.
B- For some other initial values, mle is reporting the following error: 

Error in optim(start,f,method=method,hessian=TRUE,...):
Initial value in vmin is not finite

My aim is to tell R to return the estimates whenever case A, and to
return the word Error whenever case B (using an if statement inside
a loop).

How to tell R to return the word Error whenever mle reports the error
given above?
Is there a function similar to is.nan which tests the existence of an
error?

Any assistance would be much appreciated,

Regards,

Amy

-
The Open University is incorporated by Royal Charter (RC 000391), an exempt 
charity in England  Wales and a charity registered in Scotland (SC 038302).

[[alternative HTML version deleted]]

__
R-help@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.