Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: cafpe
See also: tp/cafpe/cafpe tp/cafpe/cafpedefault tp/cafpe/capfeload

Quantlet: cafpefull
Description: Quantlet to conduct lag selection for conditional mean or conditional volatility function of nonlinear autoregressive models. It also allows for prior data transformations. It can be based on either the local linear estimation of the Asymptotic Final Prediction (AFPE) or a corrected version (CAFPE). However, only for CAFPE the used plug-in bandwidth is consistent.

Reference(s):

Usage: { crmin,crpro,crstore,crstoreadd,hstore,hstoretest } = cafpefull(y,truedat,xresid,trueres,xdataln,xdatadif,xdatastand,lagmax,volat,searchmethod,dmax,selcrit,robden,perA,perB,startval,noutputf,outpath)
Input:
ATTENTION: this quantlet requires to open locling.dll, density.dll (NT) or locling.so, denc.so (UNIX). This can be done with the quantlet cafpeload or directly with garb = dlopen ("\locling.dll") on NT, garb = dlopen ("\density.dll") on NT, garb = dlopen ("/locling.so") on UNIX, garb = dlopen ("/denc.so") on UNIX.
y (n x 1) vector of univariate time series
truedat character variable that contains path and name of ascii data file if y=0
xresid (nr x 1) vector of residuals for selecting lags of conditional volatility function; if not needed set xresid = 0
trueres character variable that contains path and name of residuals stored in ascii file if xresid=0; needed if volat = resid
xdataln character variable: "yes" takes natural logs, "no" doesn't
xdatadif character variable: "yes" takes first differences of data, "no" doesn't
xdatastand character variable: "yes" standardizes data, "no" doesn't
lagmax scalar, largest lag to be considered
volat character variable: "no" conducts lag selection for conditional mean function; "resid" conducts lag selection for conditional volatility function, the residuals of fitting a conditional mean function have to be contained in xresid
searchmethod character variable for determining search method "full": full search over all possible input variable combinations; "directed": directed search a la Tjostheim & Auestad (1994)
dmax scalar, maximal number of lags
selcrit character variable to select lag selection critierion: "lqafpe": estimating the asymptotic Final Prediction Error (AFPE) using local linear estimation and a plug-in bandwidth based on partial local quadratic estimator "lqcafpe": estimating the corrected asymptotic Final Prediction Error (CAFPE) using local linear estimation and a plug-in bandwidth based on partial local quadratic estimator
robden character variable for switching on/off robustification of density estimation a la Tjostheim & Auestad (1994), see also Section 5 in TY "yes": on; "no": off
perA scalar, parameter used for screening off 0 <= perA <= 1 percent of the observations with the lowest density for estimating A, see eq. (3.1) and Section 5 in TY
perB scalar, parameter like perA but for screening of perB observations with lowest density for estimating B
startval character variable, to control treatment of starting values "different": for each lag vector as few starting values are used as necessary; "same": for each lag vector the same starting value is used which is determined by the largest lag used in the lag selection quantlet xorigxe
noutputf character variable, name of output file
outpath character variable, path for output file
Output:
crmin vector that stores for all considered lag combinations in the first dmax rows the selected lag vector in the dmax+1 row the estimated criterion in the dmax+2 row the computed Ahat if (C)AFPE is used in the dmax+3 row the estimated variance of the white noise process
crpro matrix that stores for each number of lags in the first dmax rows the selected lag vector in the dmax+1 row the estimated asymptotically optimal bandwidth for estimating A and (C)AFPE in the dmax+2 row the used bandwidth for estimating B in the dmax+3 row the used bandwidth for estimating C in the dmax+4 row the estimated criterion in the dmax+5 row the computed Ahat if (C)AFPE is used in the dmax+6 row the estimated variance of the white noise process
crstore matrix that stores lag vector and criterion value for all lag combinations and bandwidth values considered in the first dmax rows all considered lag vector are stored in the dmax+1 to dmax+number of bandwidths in grid the estimated criterion for each lag vector and bandwidth combination is stored
crstoreadd matrix that stores those criteria that are evaluated in passing for all lag combinations where all values for one lag combination are stored in one column, see program for details
hstore row vector that stores the bandwidths used in computing (C)AFPE for each lag vector
hstoretest matrix that stores for each lag vector in one column the estimated asymptotically optimal bandwidth, hS(m+2) and hC (see section 5 in TY)

Example:
pathcafpe 	= "tp/cafpe/" 		; path for CAFPE quantlets
library("xplore")
library("times")
func(pathcafpe + "cafpeload"); load required XploRe files of CAFPE
cafpeload(pathcafpe)    	
n              	= 50
truedat      	= ""
xresid		= 0
trueres 	= ""		; name of potential residuals file
xdataln      	= "no";
xdatadif     	= "no";
xdatastand   	= "no";
lagmax       	= 4
searchmethod 	= "full"
dmax         	= 4
volat 		= "no"		; conduct lag selection for cond. volatility
selcrit		= "lqcafpe"	; use CAFPE with plug-in bandwidth
robden    	= "yes"		; robustify density estimation
perA  		= 0
perB  		= 0.05		; screen off data with lowest density
startval	= "different"
noutputf	= ""		; name of output file
outpath		= "test"	; path for output file
; generate data
randomize(0)     ; sets seed value for random number generator
y=genexpar(1,0.1,0.3|0.6, 2.2|-0.8,normal(n))  ; generate exponential AR(2) process
; plot generated data
title        = "Realisation of exponential AR(2) process"
xlabel       = "Time"
ylabel       = "Values"
plot(1:n~y)
; conduct lag selection
{crmin,crpro,crstore,crstoreadd,hstore,hstoretest}= cafpefull(y,truedat,xresid,trueres,xdataln,xdatadif,xdatastand,lagmax,volat,searchmethod,dmax,selcrit,robden,perA,perB,startval,noutputf,outpath)
"selected lag vector, estimated CAFPE "
crmin[,1:dmax+1]
"number of lags, chosen lag vector, estimated CAFPE, plug-in bandwidth"
(0:dmax)~crpro[,1:dmax|(dmax+4)|(dmax+1)]
Result:
the selected lags according to the CAFPE critierion
and the estimated bandwidths
as described by Tschernig and Yang (2000)

Library: cafpe
See also: tp/cafpe/cafpe tp/cafpe/cafpedefault tp/cafpe/capfeload

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Author: Tschernig 000420
(C) MD*TECH Method and Data Technologies, 27.4.2000