search for: betafn

Displaying 1 result from an estimated 1 matches for "betafn".

Did you mean: betaf
2008 Oct 31
0
R help for invoking nmmin()
...e <cmath> using namespace std; #define MATHLIB_STANDALONE 1 extern "C" { #include "R_ext/Applic.h" } typedef struct TT{ double ** tempX; double * tempY; int tempN; } TT, *MM; double fn(int N, double * beta, void * ex){ double total = 0; int i = 0,j = 0; double * betaFn = new double[N]; MM tmp = (MM)ex; for(i = 0; i < N; i++) { betaFn[i] = exp(beta[i]); } for(j = 0; j < tmp->tempN; j++) { double temp = 0; for(i = 0; i < N; i ++) { temp += tmp->tempX[j][i] * betaFn[i]; } total += pow(tmp->tempY[j] - temp,2); } return total; } v...