NDK_AVERAGE

int __stdcall NDK_AVERAGE ( double *  X,
size_t  N,
WORD  reserved,
double *  retVal 
)

Calculates the sample average.

Returns
status code of the operation
Return values
NDK_SUCCESS Operation successful
NDK_FAILED Operation unsuccessful. See Macros for full list.
Parameters
[in] X is the input data sample (a one dimensional array).
[in] N is the number of observations in X.
[in] reserved This parameter is reserved and must be 1.
[out] retVal is the calculated average value.
Remarks
  • The input data sample may include missing values (NaN), but they will not be included in the calculation.
  • The average is defined as follow:
\[\bar{x}=\frac{\sum_{i=1}^N{x_i}}{N}\]
Requirements
Header SFSDK.H
Library SFSDK.LIB
DLL SFSDK.DLL
Examples
#include "SFMacros.h"
#include "SFSDK.h"
    
double data[10]={12.0, 13.0, 15.0, 11.5, 12.5, 17.0, 16.0, 18.9, 9.0, 15.0};

double retVal = -1.0
nRet = NDK_AVERAGE(data,10, 1, &retVal );
if( nRet &lth; NDK_SUCCESS){
  // Error occured
  // Call NDK_MSG() to get the error message, and write it to the log
  
}

	
Namespace:  NumXLAPI
Class:  SFSDK
Scope:  Public
Lifetime:  Static
int NDK_AVERAGE ( double  pData,
UIntPtr  nSize,
short  argMenthod,
ref double  retVal 
)

Calculates the sample average.

Return Value

a value from NDK_RETCODE enumeration for the status of the call. 

NDK_SUCCESS  operation successful
Error  Error Code
Parameters
[in] pData is the input data sample (a one dimensional array).
[in] nSize is the number of observations in pData.
[in] argMenthod This parameter is reserved and must be 1.
[out] retVal is the calculated average value.
Remarks
  • The input data sample may include missing values (NaN), but they will not be included in the calculation.
  • The average is defined as follow:
\[\bar{x}=\frac{\sum_{i=1}^N{x_i}}{N}\]
Requirements
Header SFSDK.H
Library SFSDK.LIB
DLL SFSDK.DLL
Examples
#include "SFMacros.h"
#include "SFSDK.h"
    
double data[10]={12.0, 13.0, 15.0, 11.5, 12.5, 17.0, 16.0, 18.9, 9.0, 15.0};

double retVal = -1.0
nRet = NDK_AVERAGE(data,10, 1, &retVal );
if( nRet &lth; NDK_SUCCESS){
  // Error occured
  // Call NDK_MSG() to get the error message, and write it to the log
  
}

	
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI
Class SFSDK
Scope Public
Lifetime Static
Package NumXLAPI.DLL
Examples
	
References
* Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
* Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740
* D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
* Box, Jenkins and Reisel; Time Series Analysis: Forecasting and Control; John Wiley & SONS.; 4th edition(Jun 30, 2008), ISBN: 470272848