With any statistical software - including JASP - the fun only really begins once we
have some data, and when we have that data, our next step will be to set the
levels of measurement and the value labels...something we call setting the
variables.
The datasets included with JASP come in two file formats: we have JASP files
and we have raw data files. Data in the JASP file format already have the
variable set, but we are here to LEARN how to set variables, so we are going to
open a raw data file, which is a CSV. Click on Main Menu icon -> open -> data
library. Scroll to the bottom of the list and select debug data set. We know
that this is raw data because we do not see the JASP logo on the icon.
This will open the new data set in a new pane. Each variable has a name with a small
icon next to it. The icon tells us the level of measurement for that variable.
The icons are established by JASP when you open the data set, but they are
changeable. We have three types of categorical variables in JASP. The icon
with the three balls is a nominal variable. These are categorical variables
in which we use numbers to stand for groups, such as using 1 and 0 to stand
for experimental and control groups, or yes and no, or whether this patient has
diabetes or not. A second type of categorical variable is called a nominal
text variable. This type of variable is also recognizable by its having three
balls, but this time with a small letter a tattooed on the blue ball. The only
difference between nominal and nominal text variables is that nominal text
variables have been entered as text. In this case, Gender has been entered as 'M'
and'F' for male and female. SPSS calls these string variables. Ordinal variables are
the third type of categorical variable. They have some underlying order to them,
such as diabetes that is mild, moderate, or severe; or a time variable with
pretest, post-test, three-month follow-up. Like Goldilocks, ordinal variables are
recognized by their three bars. JASP will treat all three types of categorical
variables as a factor. Factors are groupings that are often used as
independent variables, such as in a t-test or a factorial ANOVA. The fourth
level of measurement in JASP is continuous numeric data, or what SPSS
calls scale data. Continuous data are signified by the yellow ruler because
they are measuring something. Scale data often have decimals. Continuous variables
do not have levels like the categorical variables; however, you can change the
level of measurement for any variable.
All categorical variables have the option to set value labels and those
labels will appear in your results. Click on the column name of the factor
variable contBinom. Click on the variable name, not the icon. A box opens above the data.
Now double-click on the label 0 (not the value) type "Control" to change this
label. Tap the enter or return key on your keyboard to confirm the changes.
You have now changed a value label. Now double-click on the label 1 (again, not
the value). Type "Experimental" to change this label. Tap the enter or return key
on your keyboard to confirm the changes, and notice that as we made the changes
in the labels JASP automatically updated the table for the independent samples
t-test. So that the value labels now show up their value labels can be reordered.
Click on the column name for the ordinal variable facFive. Click on the variable
name, not the ordinal icon. This variable codes for each of five conditions,
labeled 1 through 5 ,under which an experiment might occur. Perhaps we want
to reorder them, or even reverse their order. Notice the changes in the
frequency table as we do this example. Don't worry about what the conditions
are. For now, I want you to simply focus on the technique. We want to reverse the
order of these value labels. In other words, we want to put 1 on the bottom
and 5 on the top. With the other numbers in order, we could reorder one label at a
time. Click on the label 1 and click on the downward triangle to
move the selected label down. We could keep clicking until the numbers were
reordered as we prefer, but that would require a lot of clicking. Instead, we
should put the 1 back where it started. Click the upward triangle to move the
label 1 up. Now click the reverse arrows to reverse
the sequence. This reorders the sequence as we wanted. When you import any data,
JASP does a remarkably good job of reading the variables and suggesting a
level of measurement; however, you can change those suggested levels if they do
not match the true state of your data. First, we will change a scale variable to
categorical. Look at this first column: V1. This variable is a random identification
number for each participant. JASP thinks that these are scale data because they are
numeric, but we want to treat them as nominal because they simply stand in for
names. Click on the ruler icon to change column type. Change the variable type to
nominal. Note that scale variables do not have value labels by default, but if you
change a scale variable to a categorical variable, it WILL have labels. I will
use this trick for creating frequency tables in a later video.
In the same way, we could change a nominal variable to scale, such as this
contBinom variable; however, you notice that in making this change
we lost our value labels, so be careful that this is the change that you want to
make. Some variables cannot be changed to other types. This continuous exponent
variable has been read as Scale.
If I try to change it to ordinal... it will not change. If I try to change it to
nominal... it comes back as a nominal text variable, because it has letters in it.
If JASP simply will not allow you to make changes it is usually best to leave the
variables set as they are. Now if you are absolutely certain that this is an
ordinal variable, but JASP will not let you change it, that is because you have
some kind of error in the data and you will need to do some data cleaning to
the original data, first. Now another type of variable that cannot be changed is
nominal text variables. Those can only be texts. This facGender variable is
coded as M and F. Try to change it to scale...or to ordinal... it will always
stay set to nominal text. Some users prefer not to have to specify the
variable types, which can be laborious especially if you have a large data set.
So the variable types in JASP are generally not enforced. They usually
serve only as guides. So you could, for example, assign a nominal variable as the
dependent variable in a t-test. Now in this situation, the nominal variable
would be treated as a continuous variable, and by the way, this is the same
behavior as in SPSS.
Although you are not forced to set levels, setting levels helps you in three
ways. First, setting levels helps with variable selection in tests.To help you
use the software, JASP gives you hints as to what type of variable goes where. When
you do a t-test, you know where to place your scale variable and where to place
your categorical variable. Two, it forces you to examine your data set before you
use it. This makes you more familiar with the
data and alerts you to potential problems, and this is a best practice for
data cleaning. And C, setting levels lets JASP choose the best way to
display your data. It gives you bar graphs for nominal data
and histograms for continuous data.
We are not going to use this debug data set for any other examples, so feel
free to close it without saving it, or simply throw it away. Now you will notice
that I did not spend any time explaining the data, just the variable labels and
the levels...because I want you to focus on the techniques. But next, I am going to
use a more meaningful data set and I'm going to show you how to handle
variables in a real world example.