StatBean Name: AutocorrelationsPlot

Purpose: Plots the sample autocorrelation or partial autocorrelation function for a time series.

DataSource: any.


Read/Write Properties
NameTypeDescriptionPossible ValuesDefault Value
confidenceLeveldoubleLevel of confidence for the probability limits as a percentage.0.0001-99.999995.0
maximumLagintMaximum lag at which estimate in desired.1+12
partialbooleanWhether to display partial autocorrelations.true,falsefalse
probabilityLimitsColorColorThe color of the probability limits.Any valid Color.Color.red
replaceMissingValuesbooleanReplace any missing values within time time series.true,falsetrue
seasonalLengthintThe number of time periods comprising a season.1+1
showProbabilityLimitsbooleanWhether to display probability limits around zero.true,falsetrue
timeSeriesVariableNameStringThe name of the column with data values to be plotted.Any string.""

Other Public Methods
NameDescriptionArgumentsReturn Value
double getAcfStandardError(int lag)Returns the standard error of the estimated autocorrelation.Lag (1-maximumLag).Standard error.
double getAutocorrelation(int lag)Returns the estimated autocorrelation.Lag (1-maximumLag).Estimated coefficient.
int getNumberOfMissingValuesReplaced()Returns the number of missing values replaced with estimates.None.Number replaced.
double getPacfStandardError(int lag)Returns the standard error of the estimated partial autocorrelation.Lag (1-maximumLag).Standard error.
double getPartialAutocorrelation(int lag)Returns the estimated partial autocorrelation.Lag (1-maximumLag).Estimated coefficient.


Code Sample

//create a datasource bean
FileDataSource fileDataSource1 = new STATBEANS.FileDataSource();

//set the file name to be read
fileDataSource1.setFileName("c:\\statbeans\\samples\\stocks.txt");

//create a plot bean
AutocorrelationsPlot plot1 = new STATBEANS.AutocorrelationsPlot();

//override the top title
plot1.setTopTitleLine1("Plot of Stock Price Data");

//override the axis titles
plot1.setXaxisTitle("day");

//set the variable names for plotting
plot1.setTimeSeriesVariableName("price");

//set number of lags desired
plot1.setMaximumLag(24);

//add the plot to the application frame
add(plot1);

//make the plot bean a listener for changes in the FileDataSource bean
fileDataSource1.addDataChangeListener(plot1.listenerForDataChange);

//instruct the fileDataSource bean to read the file
fileDataSource1.readData();