
@b@cTutorials


There are four tutorials included in this file. All of them assume that the
tutorial dataset included in the xldlas distribution has been loaded into
memory. The file is called tutorial_data.lda. If you followed the suggested
installation procedure, then it should be in /usr/local/xldlas/help/.

This file can be loaded into xldlas using the Load button, or the Load entry
in the file menu. If you have unsaved data memory, it must be saved or
dropped before a new dataset can be loaded.


@b@cTutorial 1: Introduction and Getting Started
@c(or: Wow, What a Lot of Windows!)

This tutorial is intended to introduce you to xldlas's features. We will
move quickly from command to command so that you can get a feel for what
xldlas can do. 

	1) Make sure you've loaded in tutorial_data.lda

Often, the first command you'll execute after loading in a dataset is
Describe, which lists the names of the variables in memory along with the
number of observations in each and a description. Describe can be selected
by clicking the Describe button or by selecting Describe from the Data menu.

	2) Click the Describe button

As you can see, this dataset includes 9 variables, each of which contain 40
observations. If we want to see actual values of observations, then we need
to use the List command. We'll look at 'Time', 'S&P 500', and 'Gold'.

	3) Select List from the Data menu

This causes a small popup window to appear with the current variables
listed. Using the left mouse button:

	4) Highlight 'Time', 'S&P 500', and 'Gold'

You can constrain the listing to a limited number of observations by
adjusting the From: and To: counters, but let's just leave them at the
default values.

	5) Click OK

Two things just happened. The three variables were listed in the main xldlas
window, and an Abort window appeared and then disappeared. Since there are
only 40 observations for these variables, it probably happened quite
quickly, but if you decide to list a 5,000 observation variable, it's very
handy to be able to abort it.

Since long lists of data are very boring to read through, a useful
alternative is a summary of a variable. 

	6) Select Summarize from the Analysis menu

	7) Double click on the 'Gold' variable (or select 'Gold' and
	   click on OK)

This generates a table of summary statistics for the values contained in the
'Gold' variable. As you can see, the mean value is about 386 (these are US
dollar per ounce measurements). If we want a visual summary, we can use
the histogram routine.

	8) Select Histogram from the Graph menu

Now, either a Graph window appeared together with a gnuplot window, or you
got an error message that xldlas can't execute gnuplot. For the later, go
download a copy of gnuplot and install it (it's at ftp://sunsite.unc.edu). 

	9) Select 'Gold' from the X Variable browser

 	10) Click on Go!

The gnuplot window has now changed to show a histogram of the 'Gold'
variable together with a superimposed normal distribution (with the same
mean and variance as the 'Gold' variable). 

If we want to see what 'Gold' looks like over time, we have to do a plot
(rather than a histogram)

	11) Select the Plot light button

	12) Select 'Time' from the X Variable browser

	13) Select 'Gold' from the Y Variable browser

	14) Click on Go!

Now we have 'Gold' plotted over time. We could label the axis to reflect
this, or use the key option.

	15) Click the Key check button

	16) Click on Go!

We can add more variables to the same plot.

	17) Select 'S&P 500' from the Y Variable browser

	18) Click on Go!

Now we have two variables plotted, but we can't tell which one is which. 

	19) Double click on 'Gold' in the Y Variable Browser

	20) Change the Line Style to 2

	21) Click on Done

	22) Click on Go!

Since the plot window is quite small, the key may be a little difficult to
read. 

Astute viewers may have noticed that there seems to be a negative
relationship between these two variables (whenever 'Gold' goes down, 'S&P
500' seems to go up). Let's check this hypothesis.

	23) Select Done from the Graph Window

	24) Select Correlation from the Analysis menu

	25) Select 'S&P 500' and 'Gold' in the browser

	26) Click on OK

A correlation table has appeared, showing that the two variables are indeed
negatively correlated (-0.401882). We can also regress one against the other
to see if we get a negative coefficient.

	27) Select Regression from the Analysis menu

	28) Select 'Gold' in the Dependent Var browser

	29) Select 'S&P 500' in the Independent Var browser

	30) Click on Go

Now we get three tables of output describing the regression that was just
performed. On the third of these, we can see that the coefficient on 'S&P
500' is negative (and significant, since the t statistic is almost -6). 

That's it for the quick tour. You might want to play around with some of the
commands you've just used before going on to the second tutorial. If you
modify, edit, or create any existing data then you'll have to drop it or
save it before you can exit xldlas (see Data --> Drop or File --> Save).





@b@cTutorial 2: Regression and Genetic Algorithm Fitting
@c(or: How to Try and Beat the Stock Market)

This tutorial covers the regress, generate, GA Fit, and NN Fit commands.

	1) Make sure you've loaded the tutorial_data.lda dataset into memory

This dataset includes some stock market data, and we're going to use xldlas
to try and build a predictive model of the closing price of the S&P Index
(Major disclaimer: the author of xldlas has great faith in the efficient
market hypothesis).

First of all, let's run a multi-variable regression on S&P 500 to see what
kind of fit we can get.

	2) Select Regress from the Analysis menu

	3) Select 'S&P 500' in the Dependent Var browser

	4) Select 'Time', 'Gold', 'NYSE Volume', and 'NASDAQ Volume'
	   in the Independent Var browser

	5) Click on GO

Not bad, since we got an adjusted R-squared of about 0.73 (you'll probably
after to scroll the main window back a little bit to see that).
Unfortunately, our two Volume statistics don't seem to be very useful since
their t statistics are so low. Let's take them out of the model.

	6) Deselect 'NASDAQ Volume' and 'NYSE Volume'

	7) Click on Go

We could keep playing around with various variables, but you get the idea.
We already have a half decent model. To get a visual idea of how good our
fit is, we have to create some fitted values.

	8) Type 'regression fit' in the Fitted Values in: input window

	9) Click on Go

We have just run the same regression, except that the estimated coefficients
on our independent variables have been used to build a new variable called
'regression fit'. Let's look at a plot of it and our independent variable.

	10) Click on Done

	11) Click on the Plot button in the main xldlas window

	12) Select 'Time' in the X Variable browser

	13) Select 'S&P 500' and 'regression fit' in the Y Variable browser

	14) Double click on 'regression fit' and change the line style to 2

	16) Make sure the Key check button is selected

	17) Click on Go

So, that's how close our predictions come to reality. We have a problem
though, since we have been using current (ie. ``today's'') values of 'Time'
and 'Gold' to explain the current values of 'S&P 500'. As a way to make
money on the stock market, this leaves something to be desired, since by the
time we get today's value for 'Gold' the markets will have already closed.
What we need to do is use lagged values of our independent variable ('Time'
is not a problem since it is linear) to fit 'S&P 500' data so that we can
use today's gold price to try and _predict_ tomorrow's 'S&P 500' value.

	18) Click on Done in the Graph window

	19) Select Generate from the Data menu

The Generate command is used to perform mathematical transformations on
data. We're going to use the variable chooser which is marked '(current)' by
default.

	20) Select Gold from the variable chooser

	21) Click on lag1 button _just_ below the variable chooser

The operation '+ Gold[-1]' should now be listed in the Generate window. This
means we want to read in 'Gold' as a variable, but lag the observations by
one period. 

	22) Click on Go

The data browser in the Generate window now shows the observations from
'Gold' but if you scroll up to the first observation, you'll notice it is
-999999. This is xldlas's default value for a missing observation. Since we
have lagged the data by one period, the first observation is unknown. Now we
have to save this data into a variable

	23) Enter 'Gold lagged 1' into the Name: input field.

	24) Click on the Write button

	25) Click on Done

Now we want to run our old regression, but using the new lagged variable

	26) Select Regress from the Analysis menu

	27) Select 'S&P 500' in the Dependent Var browser

	28) Select 'Time' and 'Gold Lagged 1' in the Independent Var browser

	29) Make sure the Fitted Values in: input field reads 'regression fit'

	30) Make sure the overwrite check button is clicked in

	31) Click on Go

We have just overwritten our 'regression fit' variable with the fitted
values from our new model that includes a lag of the 'Gold' variable. 

Now let's look at another way of fitting data to an equation, namely the
Genetic Algorithm fitting routine. If you have no idea what a genetic
algorithm is, you might want to look under the Help entry for a brief over
view. 

	32) Select Done from the Regression window

	33) Select GA Fit from the Analysis menu

Wow, what a complicated looking window. All we want to do is try and fit the
same data together, and see how well we do versus the regression model we
used above.

	34) Select 'S&P 500' from the Dependent Variable browser

	35) Select 'Time' and 'Gold lagged 1' from the Independent browser

	36) Input 'ga fit' in the Fitted: input field

	37) Select Go

Lot's of stuff going on here. Basicly, xldlas is trying to fit a (possibly)
non-linear equation that best describes the data included. The bar chart
shows how far off all the current attempts are (ie. lower is better than
higher) There's also a number that keeps changing that indicates how far off
the best fit is (average sum of squared deviations between actual and
fitted). The abort window also appears to let you exit a fitting attempt
before it's completed. Most of the parameters are adjustable 'on the fly'.
See Help GA Fit (under Help Analysis) for a few more details.

Before we look at a plot of the results, we'll try the Neural Network
fitting routine on the same data;

	38) Select Done from the GA Fit window

	39) Select NN Fit from the Analysis Menu

	40) Select 'S&P 500' in the Output Variable browser

	41) Select 'Time' and 'Gold lagged 1' from the Input browser

	42) Enter 'nn fit' in the Fit: input area.

	43) Click on Go.

Wow, yet another window! The line graph shows the progress of xldlas's
attempt to train a neural network (see Help NN Fit for more details).

Well, how'd it do? To get an idea of how good all of the above fitting
routines went, let's look at a plot.

	44) Select Done from the NN Fit window

	45) Click the Plot button on the main xldlas window

	45) Select 'Time' in the X Variable browser

	46) Select 'S&p 500', 'regression fit', 'ga fit', and 'nn fit' in the 
	    Y variable browser

	47) Ensure the Key check box is clicked in

	48) Click on Go

That's it for this tutorial. If you want more information on Genetic
Algorithms, then news:comp.ai.genetic is a good place to start.




@b@cTutorial 3: Graphics and TeXLogs
@c(or: How to do a Statistics Assignment in Under an Hour)

This is just a brief tutorial to demonstrate one of xldlas's most useful
features, namely the ability to log its output to .tex format file. 

First, a word of warning. For TeX logging to work (at least with all
configurations at their default) you need TeX and xdvi installed on your
system, and you also need the epsf tex macros to be installed somewhere
where TeX can find them (these macros allow plain TeX to include postscript
graphics and are part of all major TeX distributions).

	1) Ensure the tutorial_data.lda dataset is loaded

	2) Select TeXLog from the Log menu

	3) Enter 'atexlog' in the File: input field

	4) Select Done

Now, generate a few tables. Maybe list a variable or two and do a regression
or a correlation (it doesn't matter what tables you generate as long as you
do generate something). Done? Ok,

	5) Select TeXLog from the Log menu

	6) Click on View DVI

After a second or two (and if all your TeX software is installed) an xdvi
window will appear that shows all the tables you just generated! That's
handy, but it gets even better.

	7) Close the xdvi window by typing 'Q'

	8) Select Done from the TeXLog window

	9) Click on Plot in the main xldlas window

	10) Select 'Time' in the X Variable browser

	11) Select 'S&P 500' in the Y Variable browser

	12) Enter 'a_figure' in the Save As: input field

	13) Click on Go!

	14) Click on Done

	15) Select TeXLog from the Log menu

	16) Click on View DVI

Now, when the xdvi window appears, use PageDown to get to the last page.
There you will find the plot you just generated included in your TeX
document!




@b@cTutorial 4: Playing with ANOVA
@c(or: What's the Difference between Within and Between)

This is a short tutorial on the ANOVA command.

	1) Ensure tutorial_data.lda is loaded into memory

Suppose we want to test the hypothesis that the advance/decline ratio on the
NASDAQ stock exchange is the same as the advance/decline ratio on the NYSE.
We could just summarize them and compare their mean values, but these are
never going to be _exactly_ the same even if our hypothesis is reasonable.
What we want to do is compare the two variables in total to see if the null
hypothesis of different means can be rejected.

	2) Select ANOVA from the Analysis menu

	3) Ensure that the One Way light-button is selected

	4) Select 'NYSE a/d' and 'NASDAQ a/d' from the ANOVA Variables
	   browser

	5) Click on Go

This produces a One Way Analysis of Variance table. The Between Groups row
shows how much the observations in 'NYSE a/d' differ from the observations
in 'NASDAQ a/d'. Since we only selected 2 variables, we have just one degree
of freedom for this measure (ie. 2 variables - 1). The Within Groups row
summarizes how much variation there is within 'NYSE a/d' and 'NASDAQ a/d'
(how much each of the 80 observations differ from their relevant means). The
F Ratio shows us a summary statistic for the null hypothesis that the means
of these two variables are different. Finally, Prob(F) shows us the
confidence level with which we can assert that they are different.

Suppose we would like to use some of our other data to further break down
the variation in the two a/d ratios. We can do this with a Two Way ANOVA
using a Block variable.

	6) Click on the Two Way Light Button

	7) Select 'Gold' in the Block Variable browser

	8) Click on Go

The 'Gold' variable has been automatically subdivided into 5 categories (5
is the default value for Block Categories), and a table is displayed showing
the category boundaries. The between groups variation has not changed at all
(we are still examing 'NASDAQ a/d' and 'NYSE a/d'), but we now have several
new categories of variation. Between Blocks shows how our data varies from
its relevant mean within each of the blocks described by the categories of
'Gold'. Interactions shows how much variation we have between data from a
given variable in a given block. 

We are again given F Ratios that summarize tests, but now we are really
conducting several tests. The first F represents a test that the population
means of the two a/d ratios are not the same. The second test is that these
means are not the same for all of the categories of the block variable. The
third F ratio considers the hypothesis that there is no interaction between
'Gold' prices and a/d ratios. In this example we have almost no confidence
that there is any interaction.

It's a little bizarre to be using ANOVA on this sort of data (especially
using 'GOLD' as a block variable) since ANOVA is usually used on panel data
such as household surveys where the block variable is usually something like
household income. But this tutorial is just to give you an idea of what
ANOVA is for, and the dataset isn't very important for that purpose.
