Hello,
I am trying to call a FORTRAN subroutine from R. The Fortran code is @:
http://lib.stat.cmu.edu/apstat/206
It performs a bivariate isotonic regression on a rectangular grid (m X n) matrix. I used the g77 compiler and successfully created a dll file and it also loads successfully from R. But somehow the programs fails to run properly. (I do get the correct result when I compile the FORTRAN code). Please see below and note that since my input matrix X is monotonically increasing in both directions, input should be equal to output since the weights are set to 1 for all elements. (also verified this in FORTRAN to make sure that the subroutine works). Output[[10]] is supposed to be the monotonically regressed output, but it does not come out correctly. I don't know if its something to do with the way I am feeding the parameters to the DLL. Thanks in advance for any help I can receive. I am not god with FORTRAN - very very infrequent FORTRAN user. I am using R 2.4.0.
Regards
Krishna.
# Here is how the subroutine says to input the parameters;
#SUBROUTINE SMOOTH(NROW, NCOL, NDIM, X, W, A, B, NCYCLE, ICYCLE, G, EPS, IFAULT)
# Definitions of each of these input parameters are below;
#REAL X(NROW,NCOL), W(NROW,NCOL), A(NROW,NCOL,4), B(NDIM,5), G(NROW,NCOL), EPS, ZERO, DELTA, DELC, DELR, ORD, WW, FRACT
DATA ZERO/0.0/, DELTA/0.00001/, FRACT/0.5/
# Here is my R output;