• atVLinEqn
  • atVLinFitBces
  • atLinearFits

       Routines that perform a linear fit and solve linear equantions.
    
    
    
    

    atVLinEqn

    DESCRIPTION:
    
    Solve a set of linear equations: A X = B, where A is a matrix of independent coefficients, X is a vector of unknown, and B is a vector of dependent variables. The independent vectors A are passed as a list of vectors.

    Note, unlike the old CERLIB-based version, this version of atVLinFit does not deal with errors in the dependent variable.

    RETURN VALUES:
    
    Returns the parameters of the linear fit in a FUNC struct of type "unknown". Unlike other FUNCs, this returns 0 for all values and so is not useful for FUNC based plotting, etc.). Return the FUNC as NULL if there was trouble.
    SIGNATURE:
      
      FUNC *atVLinEqn( VECTOR *depValue,  /* dependent variable */
                       VECTOR **value,    /* VECTORs of points to be fit */
                       int nVar           /* number of VECTORs to fit */
        )
    

    atVLinFitBces

    DESCRIPTION:
    
    BCES (Bivariate Correlated Errors and intrinsic Scatter) is a linear regression algorithm that allows for: The routine performs four fits: y regressed on x, x regressed on y, the bisector, and orthogonal errors. Which answer is the "right" one depends on the situation. (A simplified guide would be: if you wish to predict a y given an x, use y regressed on x. If you wish to learn about the relationship of two quantities, use the bisector. See Feigelson and Babu, ApJ 397, 55 1992 for details.)

    The algorithm and the base fortran code are from Akritas and Bershady, ApJ 470, ? 1996.

    Also returned are the results of a bootstrap ananlysis.

    The "slopeErr" and "slopeErrBoot" lists have two extra elements on them. These are variences for the bisector and orthogonal slopes calculated using a technique of wider applicability than the usual one which assumes that the residuals in Y about a line are independant of the value of X; see Isobe, Feigelson, Akritas, and Babu, ApJ 364, 104 1990)

    The covarience vector may be all zeros.

    James Annis, June 14, 1996

    SIGNATURE:
      
      /* This routine is meant as a c-clone of the routine
      	bces_regress.f from Akritas, Bird, and Bershady.
      	Only that routine, basically a driver, has been replaced.
      	All the subroutines, which do the actual work, are
      	retained. The variable names are retained as well,
      	including the scintillating "a" and "b".
      						JTA June 1996
      */
      int atBcesFit (
      	double *X,		/* a DERVISH vector of x values */
      	double *Y,		/* a DERVISH vector of y values */
      	double *XErr,		/* a DERVISH vector of x error values */
      	double *YErr,		/* a DERVISH vector of y error values */
      	double *CErr,		/* a DERVISH vector of xy covariance errors */
      	int nPt,		/* number of data points */
      	int nsim,		/* number of simulations */
      	int seed,		/* seed for random number generator */
      	double *b,		/* bces fit */
      	double *bvar,		/* bces fit sigma */
      	double *a,		/* bces fit */
      	double *avar,		/* bces fit sigma */
      	double *bavg,		/* bootstrap fit */
      	double *sdb,		/* bootstrap fit sigma */
      	double *aavg,		/* bootstrap fit */
      	double *sda,		/* bootstrap fit sigma */
      	double *bvar_ifab,	/* isobe et al. alt. slope variance method */
      	double *bvar_ifabsim	/* bootstrap of that */
      				/* only calculated for bisector and orthog */
        )