HStatData
jhpro.tseries

Class HStatData

  • All Implemented Interfaces:
    Serializable


    public class HStatDataextends Objectimplements Serializable
    Standard 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 Detail

      • HStatData

        public HStatData(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(String description,         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 - description
        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 local directory.
    • Method Detail

      • readData

        public void readData(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 String toString()
        Convert to a string
        Overrides:
        toString in class 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 String getDescription()
        Get names of variables.
        Returns:
      • setDescription

        public void setDescription(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 X
        column2 - column representing Y
        Returns:
        P1D
      • saveData

        public void saveData(String outfile,            String type)
        Save data in one of the formats. It can be ASCII,Excel,Matlab,GaussDAT,GaussFMT
        Parameters:
        outfile - Name of the output file
        type - 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.

SCaVis 2.2 © jWork.ORG