11  LAB I: Introduction to Jamovi

When we have finished this Lab, we should be able to:

Learning objectives
  • Navigate Jamovi, import files and transform the data.
  • Filter data.
  • Compute new variables based on other variables in our data.
  • Transform existing variables.

 

11.1 Why Jamovi?

Jamovi is a new fee open “3rd generation” statistical software that is built on top of the programming language R (Figure 11.1). Designed from the ground up to be easy to use, Jamovi is a compelling alternative to costly statistical products such as SPSS and SAS.

Figure 11.1: Jamovi is free and open statistical software
Some other advantages are:
  1. Point-and-click environment
  2. It provides informative tables and neat visuals
  3. Enables integration with R
  4. Gives access to a user guide and community resources from the Jamovi website

11.2 Downloading and installing Jamovi

Jamovi is available for Windows (64-bit), macOS, Linux and ChromeOS. Installation on desktop is quite straight-forward. Just go to the Jamovi download page https://www.jamovi.org/download.html, and download the latest version (current release) for your operating system.

11.4 Types of Variables in Jamovi

Data variables can be one of four measure types:

  • Nominal: This type is for nominal categorical variables.

  • Ordinal: This type is for ordinal categorical variables.

  • Continuous : this type is for variables with numeric values which are considered to be of Interval or Ratio scales.

  • ID: This will usally be our first column. This can be text or numbers, but it should be unique to each row.

 

and one of three data types:

  • Integer: These are full numbers e.g. 1, 2, 3, ... 100, etc. - Integers can be used for all three measure types . When used for Nominal/Ordinal data numbers will represent labels e.g. male=1; female=2.

  • Decimal: These are numbers with decimal points. e.g. 1.3, 5.6, 7.8, etc. - This will usually only be used for continuous data.

  • Text: This can be used for ordinal and nominal data.

The measure types are designated by the symbol in the header of the variable’s column. Note that some combinations of data-type and measure-type don’t make sense, and Jamovi won’t let us choose these.

Table 11.2: Types of data and measures
Measure
Data Nominal Ordinal Continuous
Integer \({\checkmark}\) \({\checkmark}\) \({\checkmark}\)
Decimal \({\checkmark}\)
Text \({\checkmark}\) \({\checkmark}\)

 

11.5 Importing data

The dataset

It is possible to simply begin typing values into the Jamovi spreadsheet as we would with any other spreadsheet software. Alternatively, existing data sets in a range of formats (OMV, Excel, CSV, SPSS, R data, Stata, SAS) can be opened in Jamovi. We will use the dataset named arrhythmia as an example (Figure 11.4).

Figure 11.4: Table with raw data of arrhythmia data set.

The meta-data (data about the data) for this dataset are as following:

  1. age: age (yrs)
  2. sex: sex (0=male, 1=female)
  3. height: height (cm)
  4. weight: weight (kg)
  5. QRS: mean duration of QRS (ms)
  6. heart_rate: heart rate (beats/min)

Opening the file

To open this Jamovi file, click on the File tab at the top left hand corner (just left of the Variables tab) (Figure 11.5).

Figure 11.5: Click on the File tab

This will open the menu shown in Figure 11.6. Select ‘Open’ and then ‘This PC’, and choose the excel file ‘arrhythmia’ from the files listed on ‘Browse’ which are stored on our computer folders:

Figure 11.6: Open an existing file stored on our computer into Jamovi.

 

The flowchart of the process is:

flowchart LR
  A(File tab) -.-> B(Open) -.-> C(This PC) -.-> D(Browse) -.-> E(Open \n 'arrhythmia')

 

We should see data now in the Spreadsheet view (Figure 11.7).

Figure 11.7: The dataset ‘arrhythmia’.

As we can see this is a data set with 452 observations and 6 variables. The categorical variable sex is coded as 0 for males and 1 for females, and it is stored as nominal . All other variables are continuous .

11.6 Transforming data

Adding labels to codes

We can add labels to numerically coded values of categorical variables. Double-click on the variable name sex. We will get an extra menu opened at the top of the Jamovi screen Figure 11.8:

Figure 11.8: Adding labels to numerically coded Values

At this extra menu there is the Levels setup. We can set the labels that should appear for each level of that category. Click on the number ‘0’ in the Levels box to enter the label for this level. Change this from a ‘0’ to the word ‘male’. Click on the number ‘1’ and change it to ‘female’.

Notice how the numbers 0 and 1 move to the lower right under the text we’re typing, so we can still see which label refers to which number. Click anywhere outside the labels box to save these labels.

We close the variable settings by pressing the arrow in the top-right corner .

 

Filtering data

Next, we select the Filters button from the Data tab. This opens the “Row FILTERS” view at the top of the Jamovi screen where we can add a filter called “Filter 1” (Figure 11.9). Let’s say that we want to study only the adults from the participants.

Figure 11.9: Adding a filter

In order to access functions, press the icon in the filter settings and from “VARIABLES” double-click on age (or we just type the variable name but if the variable has a space, we must use '..' around the variable name). Then type the condition age >= 18 and press ENTER from the keyboard in the formula box.

Relational (or comparison) operators in Jamovi
symbol read as
< less than
> greater than
== equal to
<= less than or equal to
>= greater than or equal to
!= not equal to

Notice that a column named Filter 1 has been added to the Spreadsheet view. Cells that meet the condition age >= 18 are checked with a green tick , while the rest have a red x symbol . Lines with an X are grayed out indicating that these observations are now outside of the current dataset.

There is also a switch where we can activate or inactivate the filter (note that an inactivate filter will remain visible and can be toggled to active at any time).

It is also possible to hide all filter columns by clicking on the eye symbol of the filters. In this case, all filters and the filtered data will remain active but will be invisible.

Finally, if we want to delete the filter permanently, click on the cross of the filter.

But we can do more complicated filters than this! Let’s say that we’re interested in the adult females. In fact we can specify this in three ways:

a) by using the and operator in “Filter 1” which means that both conditions (adults and females) in the expression must be true at the same time. Therefore, we type the expression age >= 18 and sex == 'female' (Figure 11.10):

Figure 11.10: Combining conditions with and operator in one expression.

Note that in the above expression we can also use double quotes around the "female" (i.e. age >= 18 and sex == "female") or even the coded value (i.e. age >= 18 and sex == 1).

b) by adding the second condition (i.e. sex == "female") as another expression to “Filter 1” (by clicking the small + beside the first expression) (Figure 11.11):

Figure 11.11: Multiple expressions in the same filter.

This additional expression comes to be represented with its own column F1(2) (Figure 11.11), and by looking at the ticks and crosses, we can see which expression is responsible for excluding each row.

c) adding a new “Filter 2” (by selecting the large + to the left of the filters dialog box) (Figure 11.12). In this case, we can activate or inactivate the filters separately.

Figure 11.12: Multiple expressions using multiple filters.

We close the filter settings by pressing the arrow in the top-right corner .

Important

Filters in Jamovi exclude the rows for which the expression is not true. When filters are active, all results will be based on the filtered data. If we want to see unfiltered results we will either need to delete the filter or toggle it to inactive.

 

Computing a new variable

Sometimes we may need to compute a new variable based on existing information (from other variables) in our data. For example, we may want to compute the body mass index (BMI), from weight (Kg) and height (m) using the formula:

\[BMI = weight/height^2 \tag{11.1}\]

Body Mass Index (BMI)

BMI is a person’s weight in kilograms divided by the square of height in meters. A high BMI can indicate high body fatness.

Adding computed variables to a Jamovi spreadsheet is straightforward. Click on Add button available on the Data tab and then select Append from the Computed Variable list. (Alternatively, select the Compute button ). An empty column has been created at the end of our dataset (Figure 11.13). The black dot symbol in the right of the column header indicates that this is a computed variable.

Figure 11.13: Adding computed variables to a Jamovi spreadsheet.

To set up the computed variable, either double-click on the column header, or select Setup button ) from the Data tab. This opens the “COMPUTED VARIABLE” view where we can set the name of the computed variable as BMI and specify the Equation 11.1 in the Formula box (note that we must divide the height by 100 and use the exponentiation operator ^ or **) (Figure 11.14):

Figure 11.14: Setting up the computed variable.

Finally, we can round the variable BMI to one decimal place using the ROUND() function:

Figure 11.15: Rounding up the computed variable.

Transforming a variable

Sometimes it can be useful to convert a quantitative variable into a qualitative variable with levels. For example, the BMI is often categorized as follows:

  • less than 18.5 underweight

  • 18.5 to <25.0 healthy weight

  • 25.0 to <30.0 overweight

  • 30.0 or higher obesity

Click on Add button available on the Data tab and select Append from the Transformed Variable list. (Alternatively, select the Transform button ). An empty column has been created at the end of our dataset (Figure 11.16).

Figure 11.16: Adding transformed variables to a Jamovi spreadsheet.

To set up the transformed variable, either double-click on the column header, or select Setup from the Data tab. This opens the “TRANSFORMED VARIABLE” view where we can set the name of the transformed variable such as BMI2 and create the transformation by selecting the source variable, here the BMI, in the Source Variable field, and creating a new transformation using transform field (Figure 11.17).

flowchart LR
  A(Source variable) -.-> B[[BMI]]
  C(using transform) -.-> D[[Create New Transform...]]

Figure 11.17: Setting up the transformation of a variable.

This opens the “TRANSFORM” view where Jamovi gives each transformation a name (e.g., Transform 1; if we want we can change it). This allows us to use it again later on other variables if we wish. We can also add a description (Figure 11.18).

Figure 11.18: Adding conditions window.

Now we need to add conditions. Jamovi uses simple if ... else statements and executes each statement starting from the top. So let’s start!

First, select + Add recode condition. Second, we need to fill the boxes with the information as follows (Figure 11.19):

  • The $source is the variable we want to transform (here BMI)- don’t change this.
  • Select the appropriate comparison operator (here < )
  • In the next box, we will put the BMI value we want as the cut off point.
  • After the use, add our new label (here 'underweight'). If we are using text we must enclose it in '...'

Figure 11.19: Adding the first condition.

We can add as many conditions as we want by selecting + Add recode condition. This will add a new if $source line into the box. Remember they will be executed in order.

Figure 11.20: Adding more conditions.

Finally, after the else use box just add the label for the data that does not meet the above conditions (here 'obese').

Figure 11.21: Adding the last label for the data that does not meet the above conditions.
Editing the transformed variable

The red dot symbol in the right of the column header indicates that this is a transformed variable. Additionally, we can edit existing transformations by selecting Edit… (Figure 11.22).

Figure 11.22: The transformed variable is recognized by a red dot in the right of the column header

 

Exercises

Exercise

Download and import the birthwt dataset into Jamovi. This dataset includes the birth weight (in grams) of 189 newborn babies along with some characteristics (e.g., age, smoking status) of their mothers. The data were collected at Baystate Medical Center, Springfield, MA, during 1986.

The dataset includes the following variables:

  • low: indicator of birth weight less than 2.5 kg (0 = normal birth weight, 1 = low birth weight).
  • age: mother’s age in years.
  • lwt: mother’s weight in pounds at last menstrual period.
  • race: mother’s race (1 = white, 2 = African-American, 3 = other).
  • smoke: smoking status during pregnancy (0 = not smoking, 1 = smoking).
  • ptl: number of previous premature labors.
  • ht: history of hypertension (0 = no, 1 = yes).
  • ui: presence of uterine irritability (0 = no, 1 = yes).
  • ftv: number of physician visits during the first trimester.
  • bwt: birth weight in grams.

Try to:

A. Describe the variables of the dataset.

B. Add labels to the codes of categorical variables.

C. Compute a new variable named bwt.kg in which the values of birth weight are given in kilograms (Kg).