|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jstatcom.util.UData
public final class UData
This class contains a collection of methods to be used with
JSCData
objects. Some methods are directly related to time
series analysis. The methods defined here should help to prepare parameters
for procedure calls, as well as to make simple data transformations often
needed to prepare input panels. They are not used as often as to make them
part of particular JSCData
implementations.
Method Summary | |
---|---|
static JSCSArray |
appendSuffix(JSCSArray arg,
java.lang.String suffix,
java.lang.String newName)
Creates a new data object with suffix being appended to
all string elements in arg . |
static JSCNArray |
createDeterministic(TSDateRange range,
JSCNArray dummies,
boolean isIntercept,
boolean isSeasDum,
boolean isSeasDumCentered,
boolean isTrend,
java.lang.String newName)
Creates a data object with the deterministic variables to be used for estimation according to the parametrization. |
static JSCNArray |
createResMat(JSCNArray det,
JSCNArray end,
JSCNArray ex,
java.lang.String name)
Creates a restriction matrix to be used for model estimation. |
static JSCNArray[] |
createYZMat(JSCNArray detData,
JSCNArray endData,
JSCNArray exData,
int endLags,
int exLags,
java.lang.String yName,
java.lang.String zName)
Creates the Y and Z matrices to be used for estimation. |
static boolean |
hasFullColumnRank(JSCNArray arg,
int truncationLag)
Checks the rank of arg after deleting the first
truncationLag rows of it. |
static JSCNArray[] |
imp2ExpRes(JSCNArray res,
JSCNArray r)
Gets the explicit representation of restrictions on the cointegrating space, given the implicit representation. |
static JSCNArray |
indexData(JSCNArray arg,
java.lang.String newName)
Gets a new array with the elements of arg being
transformed into an index with the mean of each column being normalized
to +100 or -100, depending on the sign of the mean. |
static JSCData[] |
mergeTS(JSCSArray namesOfData,
java.lang.String nameDat,
java.lang.String nameRange)
Merges time series with possibly different length and fills them with missing values at the beginning and/or the end. |
static JSCNArray[] |
splitDeterministics(JSCNArray dets,
boolean zeroBased)
Takes an array with deterministic terms and computes indices for the breaks of all dummy variables. |
static JSCNArray |
standardize(JSCNArray dat,
java.lang.String name)
Creates a new data object with the elements of dat divided
by the standard devitation of the respective columns of dat . |
static java.lang.String |
stringForArray(JSCSArray data)
String representation of the first row of a string data object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static JSCSArray appendSuffix(JSCSArray arg, java.lang.String suffix, java.lang.String newName)
suffix
being appended to
all string elements in arg
.
arg
- the original data objectsuffix
- the string to be appended to all elements of arg
newName
- the name of the new data object to be created
java.lang.IllegalArgumentException
- if (arg == null || suffix == null || newName == null)
or if arg
is not of a string typepublic static JSCNArray createDeterministic(TSDateRange range, JSCNArray dummies, boolean isIntercept, boolean isSeasDum, boolean isSeasDumCentered, boolean isTrend, java.lang.String newName)
dummies~intercept~seasonal dummies~trend
, where each
component may be there or not. If nothing is specified, an empty data
object is returned.
range
- the TSDateRange
defining start and enddummies
- impulse and shift dummies, or other manually specified
deterministics, can be either empty or null
isIntercept
- true
if a constant should be includedisSeasDum
- true
if seasonal dummies should be included,
this automatically sets isIntercept=true
as
well, false
otherwiseisSeasDumCentered
- true
if centered seasonal dummies should be
used, only if (isSeasDum)
isTrend
- true
if a trend should be includednewName
- the name of the new data object to create
dummies~intercept~seasonal dummies~trend
java.lang.IllegalArgumentException
- if (newName == null || range == null)
or if
the number of observations in dummies
does not
fit with range
public static JSCNArray createResMat(JSCNArray det, JSCNArray end, JSCNArray ex, java.lang.String name)
det, end, ex
).
This method only supports exclusion restrictions for certain
coefficients .
det
- K x d matrix containing zeros and ones to exclude the
respective coefficient for the deterministicsend
- K x K*py matrix containing zeros and ones to exclude the
respective coefficient for the endogenous partex
- K x X(px+1) matrix containing zeros and ones to exclude the
respective coefficient for the exogenous partname
- the name of the data object to create
java.lang.IllegalArgumentException
- if (name == null || det == null || end == null || ex == null )
public static JSCNArray[] createYZMat(JSCNArray detData, JSCNArray endData, JSCNArray exData, int endLags, int exLags, java.lang.String yName, java.lang.String zName)
The order of the variables within Z must be det|end|ex. If subset restrictions are set, then this must correspond to the ordering of R.
The following symbols are defined:
detData
- data object with dimension
T + Math.max(endLags, exLags) x D
endData
- data object with dimension
T + Math.max(endLags, exLags) x K
, must not be
emptyexData
- data object with dimension
T + Math.max(endLags, exLags) x X
endLags
- number of endogenous lags in levelsexLags
- number of exogenous lags in levelsyName
- name of data object for Y matrixzName
- name of data object for Z matrix
java.lang.IllegalArgumentException
- if one of the arguments was null
or
if (endLags < 0 || exLags < 0)
or
if (endData.isEmpty())
or if the dimensions of
the nonempty data objects are not the same or if there are
too many lags for the given sample dizepublic static boolean hasFullColumnRank(JSCNArray arg, int truncationLag)
arg
after deleting the first
truncationLag
rows of it. Returns whether the rank is
equal to arg.getCols()
.
arg
- the data object to be checked for column ranktruncationLag
- the number of rows to delete from arg
before
checking the rank
true
if rank(arg) == >arg.getCols()
,
false
otherwise
java.lang.IllegalArgumentException
- if (arg == null)
or
if (truncationLag < 0)
or
if (arg.isEmpty())
public static JSCNArray[] imp2ExpRes(JSCNArray res, JSCNArray r)
res*vec(beta') = r
H*eta + h
, with
eta
being the free parameters.
In the context of cointegration analysis, beta
is the part
of the Beta
matrix in Beta = [I_r : beta]
,
because the first r
columns of Beta
are
normalized, with r
being the cointegration rank.
eta
are the elements of beta
that are
freely estimated after imposing the restrictions.
res
- the matrix with implicit restrictions (J x K-r)r
- a vector with numbers (J x 1)
H
, a vector of
zeros and ones selecting the free elements of vec(beta') and h,
respectively
java.lang.IllegalArgumentException
- if (res == null || r == null)
or
if (res.getRows() != r.getRows())
or if
res
contains restrictions that are linearly
dependentpublic static JSCNArray indexData(JSCNArray arg, java.lang.String newName)
arg
being
transformed into an index with the mean of each column being normalized
to +100 or -100, depending on the sign of the mean. This is usefull to
compare series which differ greatly in levels. The index is computed as
arg[i][j] * 100 / mean[j]
arg
- the data object with the numbers to be transformed to an indexnewName
- the name of the new data object to be created
java.lang.IllegalArgumentException
- if (arg == null || newName == null)
public static JSCData[] mergeTS(JSCSArray namesOfData, java.lang.String nameDat, java.lang.String nameRange)
namesOfData
- data object with the names of the time series in the
TSHolder
nameDat
- name of the new data object which holds the observationsnameRange
- name of the new data object which holds the date range
namesOfData
java.lang.IllegalArgumentException
- if (namesOfData == null || nameDat == null
|| nameRange == null)
public static JSCNArray[] splitDeterministics(JSCNArray dets, boolean zeroBased)
This method splits the data object with deterministic variables into the following data objects:
dets
- the data object containing the deterministic variableszeroBased
- whether zero based index should be used, if false
then 1 based index is used (like in Gauss)
java.lang.IllegalArgumentException
- if (dets == null)
public static JSCNArray standardize(JSCNArray dat, java.lang.String name)
dat
divided
by the standard devitation of the respective columns of dat
.
dat
- the original data objectname
- the name of the new data object to create
java.lang.IllegalArgumentException
- if (dat == null || name == null)
public static java.lang.String stringForArray(JSCSArray data)
data
- array containing names
"y x invest cons"
java.lang.IllegalArgumentException
- if (array == null)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |