jhpro.tseries
Class HStatData
- java.lang.Object
-
- jhpro.tseries.HStatData
-
- All Implemented Interfaces:
- java.io.Serializable
public class HStatData extends java.lang.Object implements java.io.SerializableStandard data container to store and read time series. Standard interface to read data in different formats (ASCII, Gauss, Matlab, Excel) and present results (time series selector, editable data tables, number selectors with interval based validation, etc.). Data can be read from URL (if the path start from http or ftp). Data can be shown as tables or represented as plots (use P1D and P0D conversions and standard canvases, such as HPlot etc). This is very useful class for financial analysis and time series.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description HStatData()Initialise the containerHStatData(java.lang.String description)Initialse data for statistical analysis.HStatData(java.lang.String description, java.lang.String sfile)Reads many data formats (in ASCII, Gauss, Matlab, Excel) and converts the data (time series) to arrays for further processing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidappend(HStatData hs)Append a row.voiddoc()Show online documentation.double[]getColumn(int column)Return a column as a arrayJSCNArraygetData()Return data as arrayjava.lang.StringgetDescription()Get names of variables.intgetNumberColumns()Return number of columns in the dataintgetNumberRows()Return number of columns in the dataP0DgetP0D(int column)Get data as 1D array for a given columnP1DgetP1D(int column1, int column2)Convert 2 columns in P1D for plotting.PNDgetPND()Get data as PND objectdouble[]getRow(int index)Get a rowTS[]getTS()Return time series as arrayJSCSArraygetVarNames()Get names of variablesvoidreadData(java.lang.String sfile)Reads many data formats (in ASCII, Gauss, Matlab, Excel) and converts the data to arrays for further processing.voidreplaceColumn(int column, double[] d)Replace a column with anew array.voidsaveData(java.lang.String outfile, java.lang.String type)Save data in one of the formats.voidsetData(JSCNArray d)Set new data.voidsetDescription(java.lang.String d)Set new description for data setvoidsetPND(PND d)Set data from PND containervoidsetVarNames(JSCSArray d)Set variable names.java.lang.StringtoString()Convert to a stringvoidtoTable()Show the time series data as a table
-
-
-
Constructor Detail
-
HStatData
public HStatData(java.lang.String description)
Initialse data for statistical analysis. The data are typically represented as a time series. Use use readData() to fill with the data. You can also replace time series and save the data.- Parameters:
description- description
-
HStatData
public HStatData()
Initialise the container
-
HStatData
public HStatData(java.lang.String description, java.lang.String sfile)Reads many data formats (in ASCII, Gauss, Matlab, Excel) and converts the data (time series) to arrays for further processing. Input file can be on WWW.- Parameters:
description- descriptionsfile- input data file including the full path. If it starts from http: or ftp://, it is assumed that data should be read from the web location. Otherwise, data will be read from a local file. In case of URL, the filer will be copied to the local directory.
-
-
Method Detail
-
readData
public void readData(java.lang.String sfile)
Reads many data formats (in ASCII, Gauss, Matlab, Excel) and converts the data to arrays for further processing. Input file can url.- Parameters:
sfile- input data file including the full path. If it starts from http: or ftp://, it is assumed that data should be read from the web location. Otherwise, data will be read from a local file. In case of URL, the filer will be copied to the TMP directory.
-
toTable
public void toTable()
Show the time series data as a table
-
getData
public JSCNArray getData()
Return data as array- Returns:
-
setData
public void setData(JSCNArray d)
Set new data. The time series will be rebuild.- Parameters:
d- input data
-
setPND
public void setPND(PND d)
Set data from PND container
-
getPND
public PND getPND()
Get data as PND object- Returns:
- PND keeping this data.
-
toString
public java.lang.String toString()
Convert to a string- Overrides:
toStringin classjava.lang.Object- Parameters:
string- represending the data
-
getVarNames
public JSCSArray getVarNames()
Get names of variables- Returns:
-
setVarNames
public void setVarNames(JSCSArray d)
Set variable names. Time series will be rebult.- Parameters:
d- input variable names
-
getDescription
public java.lang.String getDescription()
Get names of variables.- Returns:
-
setDescription
public void setDescription(java.lang.String d)
Set new description for data set- Parameters:
d-
-
getP0D
public P0D getP0D(int column)
Get data as 1D array for a given column- Parameters:
column- column index- Returns:
- P0D
-
getColumn
public double[] getColumn(int column)
Return a column as a array- Parameters:
column- index of column- Returns:
- array with the column
-
getP1D
public P1D getP1D(int column1, int column2)
Convert 2 columns in P1D for plotting.- Parameters:
column1- column representing Xcolumn2- column representing Y- Returns:
- P1D
-
saveData
public void saveData(java.lang.String outfile, java.lang.String type)Save data in one of the formats. It can be ASCII,Excel,Matlab,GaussDAT,GaussFMT- Parameters:
outfile- Name of the output filetype- A string representing a format. It can be "ASCII" or "TXT", "Excel", "Matlab","GaussDAT","GaussFMT"
-
getNumberColumns
public int getNumberColumns()
Return number of columns in the data- Returns:
- Number of columns
-
getNumberRows
public int getNumberRows()
Return number of columns in the data- Returns:
- Number of Rows
-
getTS
public TS[] getTS()
Return time series as array- Returns:
-
doc
public void doc()
Show online documentation.
-
replaceColumn
public void replaceColumn(int column, double[] d)Replace a column with anew array.- Parameters:
column- column index to be replaced.d- array which will be used to replace the column.
-
append
public void append(HStatData hs)
Append a row.- Parameters:
hs- data to be appended.
-
getRow
public double[] getRow(int index)
Get a row- Parameters:
index- of this row.
-
-
DMelt 3.0 © DataMelt by jWork.ORG