This exercise uses the data generated in Exercise One and Exercise Two. If you have not completed these exercises, STOP and complete the exercises. The model used in this exercise follows the data generating process below:
$$ y_i = 2 + 3.5x_i + \epsilon_i $$
Step One: Load the saved
In the last part of this tutorial series, we saved two matrices
y. You can load them by entering:
load x, y;
This command will look for the files
y.fmt in your current working directory. It will then create matrices
y in your GAUSS workspace and fill them with the data from the corresponding file.
Specify a load path
If keep your data in a separate directory that you do not want to be your working directory, you can specify a separate 'load' path. When you specify a 'load' path, GAUSS will look in that directory when you load data with the
load path = C:\gauss24\data;
load x, y;
This code will attempt to load
y from the directory
Step Two: Graph the data
Create a new file
Open a new program file by clicking the New File toolbar button, or using the hotkey
Save the file
Save the file by either clicking the Save File toolbar button or by using the hotkey
CTRL+S. Give the file the name
Add commands to the program file
load command from above. Next, add the command:
to your file.
As you start typing
plot… GAUSS will provide you with an autocomplete menu listing all functions that begin with plot. You may use the arrow buttons to scroll to one of the functions in this dropdown list and hit enter to have GAUSS enter this command into your file.
You may also notice that when you type the opening parenthesis, GAUSS will give you a tooltip listing the inputs for the function.
myPlot in the screenshot, indicate that the input is optional. To get more information about the function, click on the function name in the editor and hit the
Draw the graph
To run the file, either use the hotkey
CTRL+R or select Current File from the drop-down menu to the right of the Run button.
After your file is run, you should see a graph that is similar to the image below.
While your graph will look quite similar to the graph above, it may show a different color for the points or have the grid turned on for example. All of these settings come from your graphics preference settings.
Change graphics preferences
To open your graphics preferences, select Tools > Preferences from the main menu. This will open the preferences dialog menu. Select Graphics from the left side of the preferences menu.
Towards the top of the Graphics preferences window, under Profiles is a list of graph types. In the above image, the current profile is Scatter (Default).
The Graph Settings are below. This section contains the settings for the currently selected graph profile. The Series one through five, control the settings for each column of data that you draw.
To change the color, or symbol for the one column of data that you are graphing in this example, click Series 1 as shown in the above image and customize its settings.
After you have made some changes to the graph, save your changes by clicking Apply button and then OK. Now run your file again and see your changes reflected in the new graph.