/* nag_robust_m_regsn_estim (g02hac) Example Program. * * Copyright 1996 Numerical Algorithms Group. * * Mark 4, 1996. * Mark 8 revised, 2004. * */ #include #include #include #include #include static int set_enum(char regtypec, Nag_RegType *regtype, char psifunc, Nag_PsiFun *psifun, char sigestc, Nag_SigmaEst *sigma_est); #define C(I,J) c[(I)*tdc + J] #define X(I,J) x[(I)*tdx + J] int main(void) { Integer exit_status=0, i, j, m, max_iter, n, print_iter, tdc, tdx; NagError fail; Nag_CovMatrixEst covmat_est; Nag_PsiFun psifun; Nag_RegType regtype; Nag_SigmaEst sigma_est; char covmat_estc, psifunc, regtypec, sigestc; double *c=0, cpsi, cucv, dchi, *hpsi=0, *info=0, *rs=0, sigma, *theta=0; double tol, *wt=0, *x=0, *y=0; INIT_FAIL(fail); Vprintf("nag_robust_m_regsn_estim (g02hac) Example Program Results\n\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf("%ld %ld", &n, &m); if (n>1 && (m>=1 && m<=n)) { if ( !( c = NAG_ALLOC(m*m, double)) || !( theta = NAG_ALLOC(m, double)) || !( x = NAG_ALLOC(n*m, double)) || !( y = NAG_ALLOC(n, double)) || !( rs = NAG_ALLOC(n, double)) || !( wt = NAG_ALLOC(n, double)) || !( info = NAG_ALLOC(4, double)) || !( hpsi = NAG_ALLOC(3, double)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } tdc = m; tdx = m; } else { Vprintf("Invalid n or m.\n"); exit_status = 1; return exit_status; } /* Read in x and y */ for (i=0; i