Hi, all. I have written several perl programs for statistical analyses such as logistic regression and Cox regression. When comparing the results of my programs and those of SAS, SPSS and R using the same data in text books to validate my programs, I found the results were just the same in nearly all, but there were subtle differences in a few outputs between them (even when the perl program was translate according to the same algorithm from Fortran or C program). <example> R showed….. ## coefficients: ## [1] g 0.8470 g2 -0.3473 g3 -0.6913 ## standard errors: ## [1] g 0.4027 g2 0.4402 g3 0.4916 ## two-sided p-values: ## [1] g 0.035 g2 0.430 g3 0.160 My perl program showed….. ---------------------------------------------------------------------------- coef stdErr Wald-x2 p-value HR lower95% upper95% ---------------------------------------------------------------------------- g 0.846966 0.40285 4.42017 0.0355 2.333 1.059 5.137 g2 -0.347310 0.43978 0.62369 0.4297 0.707 0.298 1.673 g3 -0.691272 0.49180 1.97572 0.1598 0.501 0.191 1.313 ---------------------------------------------------------------------------- n = 200 %Censored: 34.000 -2logL: 652.385 #iter: 5 ---------------------------------------------------------------------------- The coefficients is the same, but the standard errors is minimally different (0.4027 vs 0.40285, 0.4402 vs 0.43978 …) with resultant difference in p-value. I understand Perl’s precision is 32-bit and the double precision of the real number is also 32-bit in Fortran or C. What does the differences come from? How can I obtain the same results as R(C or Fortran)?
Thanks for your time. Kempei