-
Notifications
You must be signed in to change notification settings - Fork 0
func
Rafat Hussain edited this page Apr 25, 2015
·
16 revisions
void linreg_clrm(double *x,double *y, int N, double* b,
double *var,double *res,double alpha,double *anv,
double* ci_lower, double* ci_upper);
/*
* Classic Linear Regression Model
* y = b[0] + b[1] * x + u
* x,y and res are all of same length - N
* where res is the residual
*
* alpha is used to determine confidence interval limits
* for a given 100*(1-alpha) % confidence interval
*
*
* Alpha takes values between 0 and 1.
*
* For 95% confidence interval, the value of alpha is 0.05
* For 90% confidence interval, the value of alpha is 0.10 etc.
*/
/*
* Parameters ( b is a double vector of length 2)
* b[0] - beta1
* b[1] - beta2
*/
/* Variances ( var is a double vector of length 5)
* var[0] - variance of residuals
* var[1] variance beta1
* var[2] variance beta2
* var[3] covariance beta1,beta2
* var[4] r^2 Goodness of Fit
*/
/*
* ANOVA ( anv is a double vector of length 7)
*
* anv[0] - TSS Total Sum Of Squares
* anv[1] - ESS Explained Sum Of Squares
* anv[2] - RSS Residual Sum Of Squares
* anv[3] - degrees of freedom of ESS
* anv[4] - degrees of freedom of RSS
* anv[5] - F Statistics = (anv[1] / anv[3]) / (anv[2] / anv[4])
* anv[6] - P value associated with anv[5] used to reject/accept
* zero hypothesis
*/
/* ci_lower and ci_upper (Confidence Interval Lower and Upper Limits)
* ( double vectors of length 3)
* ci_lower[0] - CI Lower Limit corresponding to b[0]
* ci_lower[1] - CI Lower Limit corresponding to b[1]
* ci_lower[2] - CI Lower Limit corresponding to var[0] (sigma^2)
* ci_upper[0] - CI Upper Limit corresponding to b[0]
* ci_upper[1] - CI Upper Limit corresponding to b[1]
* ci_upper[2] - CI Upper Limit corresponding to var[0] (sigma^2)
*/
void zerohyp_clrm(int N,double *b, double *val, double *tval, double *pval) {
Zero Hypothesis Test for CLRM