MISR Toolkit  1.5.1
Functions
MtkLinearRegressionCalc.c File Reference
#include "MisrRegression.h"
#include "MisrUtil.h"
#include <stdlib.h>
#include <math.h>

Go to the source code of this file.

Functions

MTKt_status MtkLinearRegressionCalc (int Size, const double *X, const double *Y, const double *Y_Sigma, double *A, double *B, double *Correlation)
 Use linear regression to fit a set of observations (x,y) to the model: y(x) = a + b * x. The values of 'x' are assumed to be known exactly. The values of 'y' may have an associated uncertainty, 'y_sigma'. Measurements with larger uncertainty are given less weight. Uncertainty must be greater than 0. More...
 

Function Documentation

◆ MtkLinearRegressionCalc()

MTKt_status MtkLinearRegressionCalc ( int  Size,
const double *  X,
const double *  Y,
const double *  Y_Sigma,
double *  A,
double *  B,
double *  Correlation 
)

Use linear regression to fit a set of observations (x,y) to the model: y(x) = a + b * x. The values of 'x' are assumed to be known exactly. The values of 'y' may have an associated uncertainty, 'y_sigma'. Measurements with larger uncertainty are given less weight. Uncertainty must be greater than 0.

Returns
MTK_SUCCESS if successful.
Example:
double x[4] = {1,5,7,8};
double y[4] = {12,14,19,21};
double y_sigma[4] = {0.1,0.2,0.2,0.3};
double a, b;
status = MtkLinearRegressionCalc(4, x, y, y_sigma, &a, &b)
Note
Parameters
[in]SizeSize of X and Y arrays
[in]XX array
[in]YY array
[in]Y_SigmaUncertainty in Y
[out]AA
[out]BB
[out]CorrelationCorrelation

Definition at line 39 of file MtkLinearRegressionCalc.c.


MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53