NDK_LRVAR

int __stdcall NDK_LRVAR ( double *  X,
size_t  N,
size_t  W,
double *  retVal 
)

Returns the long-run variance using a Bartlett kernel with window size k.

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/two dimensional array).
[in] N is the number of observations in X.
[in] w is the input Bartlett kernel window size. If omitted, the default value is the cubic root of the sample data size.
[out] retVal is the calculated value of this function.
Remarks
1. The input time series data may include missing values (NaN), but they will not be included in the calculations.
2. The long-run variance is computed as follows:
\[\sigma^2=\frac{1}{T}\sum_{t=k}^{T-k}\sum_{i=-k}^k w_i(x_t-\bar{x})(x_{t-i}-\bar{x})\]
Where:
  • \(x_{t} \in X\)  is a value from the input time series data.
  • \(\bar{x}\)  is the mean of the input time series data.
  • \(w_i\) is the Bartlett kernel weight, and it is defined as follows:
    • \(w_i= 1- \frac{\left | i \right |}{k+1}\)
  • \(k\) is the input window size for the Bartlett kernel.
Requirements
Header SFSDK.H
Library SFSDK.LIB
DLL SFSDK.DLL
Examples


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

Returns the long-run variance using a Bartlett kernel with window size k.

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/two dimensional array).
[in] nSize is the number of observations in pData.
[in] argMenthod is the input Bartlett kernel window size. If omitted, the default value is the cubic root of the sample data size.
[out] retVal is the calculated value of this function.
Remarks
1. The input time series data may include missing values (NaN), but they will not be included in the calculations.
2. The long-run variance is computed as follows:
\[\sigma^2=\frac{1}{T}\sum_{t=k}^{T-k}\sum_{i=-k}^k w_i(x_t-\bar{x})(x_{t-i}-\bar{x})\]
Where:
  • \(x_{t} \in X\)  is a value from the input time series data.
  • \(\bar{x}\)  is the mean of the input time series data.
  • \(w_i\) is the Bartlett kernel weight, and it is defined as follows:
    • \(w_i= 1- \frac{\left | i \right |}{k+1}\)
  • \(k\) is the input window size for the Bartlett kernel.
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