public class PanelData<S> extends Object
Modifier and Type | Class and Description |
---|---|
class |
PanelData.Row
This is one row of the data in a panel.
|
static interface |
PanelData.Transformation
Transforms the data, e.g., taking log.
|
Constructor and Description |
---|
PanelData(String subjectHeader,
String timeHeader,
String[] headers)
Constructs a panel of two-dimensional data.
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(PanelData.Row row)
Inserts a row of data into the panel.
|
void |
addRow(S subject,
String time,
double... values)
Inserts a row of data into the panel.
|
List<S> |
getAllSubjects()
Gets the name of all subjects.
|
String[] |
getExtHeaders()
Gets the extended headers, including the subject and time headers.
|
String |
getExtHeadersString()
Gets the extended headers, including the subject and time headers.
|
double[][] |
getPanelValuesByHeaders(List<PanelData.Row> rows)
Gets the values from a panel data.
|
double[][] |
getPanelValuesByHeaders(List<PanelData.Row> rows,
String[] headers)
Gets the values from a panel data.
|
double[][] |
getPanelValuesByHeaders(List<PanelData.Row> rows,
String[] headers,
PanelData.Transformation[] transformations)
Gets the (transformed) values from a panel data.
|
double[][] |
getPanelValuesByTime(List<PanelData.Row> rows)
Gets the (transformed) values from a panel data.
|
double[][] |
getPanelValuesByTime(List<PanelData.Row> rows,
String[] headers,
PanelData.Transformation[] transformations)
Gets the (transformed) values from a panel data.
|
PanelData.Row |
getRow(S subject,
String time)
Gets one particular row indexed by a pair of subject and time.
|
List<PanelData.Row> |
getRows()
Gets all of the panel data.
|
List<PanelData.Row> |
getRowsForSubject(S subject)
Get all the rows pertaining to a particular subject.
|
String[] |
getValueHeaders()
Gets the headers, excluding the subject and time headers.
|
String |
getValueHeadersString()
Gets the headers, excluding the subject and time headers.
|
boolean |
isBalanced()
Checks if the panel is balanced, i.e., all subjects have the same number
of observations (times).
|
int |
size()
Get the number of rows in the panel.
|
String |
toString() |
public void addRow(S subject, String time, double... values)
subject
- the subjecttime
- the timevalues
- the row datapublic void addRow(PanelData.Row row)
row
- a rowpublic int size()
public boolean isBalanced()
true
if the panel is balancedpublic String[] getExtHeaders()
public String getExtHeadersString()
public String[] getValueHeaders()
public String getValueHeadersString()
public List<PanelData.Row> getRows()
public List<PanelData.Row> getRowsForSubject(S subject)
subject
- the subjectpublic PanelData.Row getRow(S subject, String time)
subject
- the subjecttime
- the timepublic List<S> getAllSubjects()
public double[][] getPanelValuesByHeaders(List<PanelData.Row> rows, String[] headers, PanelData.Transformation[] transformations)
rows
- the panel dataheaders
- the columns to be extractedtransformations
- the transformation to be applied to the column
valuespublic double[][] getPanelValuesByHeaders(List<PanelData.Row> rows, String[] headers)
rows
- the panel dataheaders
- the columns to be extractedpublic double[][] getPanelValuesByHeaders(List<PanelData.Row> rows)
rows
- the panel datapublic double[][] getPanelValuesByTime(List<PanelData.Row> rows)
rows
- the panel datapublic double[][] getPanelValuesByTime(List<PanelData.Row> rows, String[] headers, PanelData.Transformation[] transformations)
rows
- the panel dataheaders
- the columns to be extractedtransformations
- the transformation to be applied to the column
valuesCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.