libtpcmodel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Functions
runs_test.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "include/runs_test.h"
#include "include/normaldistr.h"
Include dependency graph for runs_test.c:

Go to the source code of this file.

Functions

int runs_test (double *data1, double *data2, int N, double alpha, double *p)
void residuals (double *d1, double *d2, int Nr, int *Rnr, int *Nminus, int *Nplus)
int mrl_between_tacs (double y1[], double y2[], int n)

Function Documentation

int mrl_between_tacs ( double  y1[],
double  y2[],
int  n 
)

Calculates the maximum run length between given two arrays of data.

Returns:
Returns the MRL.

Definition at line 148 of file runs_test.c.

void residuals ( double *  d1,
double *  d2,
int  Nr,
int *  Rnr,
int *  Nminus,
int *  Nplus 
)

Residuals function calculates the nr of runs (a sequence of consecutive positive or negative residuals) and nr of negative and positive residuals for two data arrays.

Returns:
Returns 0, if ok.
Parameters:
d1double array with data points
d2double array with data points
Nrnumber of data points in both arrays
Rnrnr of runs
Nminusnr of negative residuals
Nplusnr of positive residuals

Definition at line 100 of file runs_test.c.

Referenced by runs_test(), and test_runst().

int runs_test ( double *  data1,
double *  data2,
int  N,
double  alpha,
double *  p 
)

Runs_test function tests if residuals of two data arrays are independent.

Returns:
Returns 0, if residuals are independent, -1, if residuals are dependent and >0 in case of an error.
Parameters:
data1double array with data points
data2double array with data points
Nnumber of data points in both arrays
alphasignificance level percentage (set to negative value to use default 5%)
pcalculated probability p; enter NULL if not needed

Definition at line 56 of file runs_test.c.

References ndtr(), R, and residuals().

Referenced by test_runst().

Here is the call graph for this function: