welcome to nls2C | Site Plan |
Subroutine renls2C |
---|
Description | Syntaxe | Arguments | Constraints | Example |
It is intended to process series of non-linear regressions when one or several of the following input are modified at each loop:
int renls2C(double *ThetaStart, double *BetaStart, double *GamF, double *GamV, double **x, double *y, double *weights, int ip)
/* ------------------------------------------------------ Example "weibull" of call to renls2C: return the successive values of "rss" by removing one observation each time. ----------------------------------------------------------- */ /* +++++++++++++++++++++++++++++++++++++++++++++++++++ includes +++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ #include "nls2C.h" /* ------------------------------------------------------------ Calling program ---------------------------------------------------------------*/ int main(argc, argv) int argc; char *argv[]; { /* -------- Declarations ------------ */ /* Local variables: */ int n1, code=OK, b; long int nobst; double rss, *weights; /* First invokation of nls2C: */ if ( (code =nls2C(argv[1])) != 0) { fprintf(stderr,"Fatal error in nls2C, code %d \n", code); exit(code); } rss = recup0D("rss", 1); printf("Residual sum of squares at the first loop: %g\n", rss); weights= recup1D("weights",1,&n1); nobst= recup0L("n.obst", 1); for (b=1; b <= nobst; b++) { /* The new estimation is realized by call to the function "renls2C": */ /* At each loop, an observation is removed, the preceeding one is taken into account again */ weights[b-1]=1; weights[b]=0; code=renls2C((double *)NULL, (double *)NULL, (double *)NULL, (double *)NULL, (double **)NULL, (double *)NULL, weights, 0); if (code != (int)OK) { fprintf(stderr, "Wrong execution of the loop %d code = %d\n", b, code); exit(code); } rss = recup0D("rss", 1); printf("Residual sum of squares at loop %d: %g\n", (b+1), rss); } delnls2(); return(0); }