Hi,
 
 Thanks, everyone for all the help! So, here is my calling function in C
 (called
 test.c):
 
 
 
 #include<stdio.h>
 #include<stdlib.h>
 #include<Rmath.h>
 
 
 int main(void) {
   printf("%f \n",pchisq(2.,7., 1, 0));
   printf("%f \n",pnchisq(2.,7.,0., 1, 0));
   return EXIT_SUCCESS;
 }
 
 
 I compile using:
 
  gcc test.c -I/usr/lib/R/include -L/usr/lib/R/lib -lm -lR 
 
 However, running
 ./a.out
 
 gives me:
 
 1.000000 
 0.040160 
 
 The first is wrong, but the second non-central is correct, and matches the
 answer from R.
 
 Incidentally, pgamma (which is what pchisq calls, as per the C program inside
 R) is also wrong and not surprisingly, gives the same answer as above.
 
 Any suggestions?
 
 Many thanks!
        
 
 
 __________________________________________________

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to