This document is intended to serve as a step-by-step guide to using the area of resilience to stress event (ARSE) method of quantifying the resilience process using the ‘arse’ R package. This guide is a companion to a paper introducing the ARSE method (Ratcliff, Nair, & Goldstein, under review). For ARSE, the resilience process is conceptualized as: for a given ‘y’ outcome occurring over time, resilience is characterized by the function of robustness (i.e., the degree of negative departure from the baseline of y) and rapidity (i.e., time to the return to baseline of y) in relation to the incursion of a stress event on an entity. To use this method, three things must be in place: (a) a baseline value (before the stress event) of a variable of interest ‘y’ needs to be known, (b) an incursion of a stress event needs to occur on an entity (e.g., individual, group), and (c) the variable of interest ‘y’ needs to be measured repeatedly after the incursion of a stress event. Thus, ARSE is the function of how much the variable ‘y’ negatively diverges from baseline levels after a stress event (i.e., robustness) and the time it takes ‘y’ to return to baseline levels (i.e., rapidity). The combination of robustness and rapidity form a series of points that can be connected into an irregular polygon from which an area can be derived. It is this area, ARSE, that is indicative of how much resilience is demonstrated to a stress event where smaller values of ARSE indicate better resilience and larger values indicate poor resilience. It should be noted that we refer to decreases as a default way of discussing departures from baseline levels, however, for variables in which higher numbers are characterized as less desirable (e.g., blood pressure), negative departures from the baseline would be increases from the baseline. The ARSE functions discussed below have an option ‘yinvert’ that accommodate cases in which higher values are not desirable. For the purposes of this walkthrough, we assume that higher values are more desirable and that decreases from the baseline level are not.
The following presents a step-by-step guide to analyzing ARSE using a fictitious data set.
To install arse, use install.packages("arse")
in R or
RStudio. Alternatively, the development version of the arse package can
be downloaded from github using
devtools::install_github("nr3xe/arse")
.
# Required R packages that need to be loaded
library(arse)
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#> Loading required package: pracma
library(dplyr)
library(pracma)
A Fictitious data set was used to demonstrate the calculation of ARSE In this data set, there are 50 fictitious “subjects” split into two groups with 25 members each (i.e., ‘group’ variable). The Control condition represents subjects in which training was not given before a stress event. In the Appraisal_Training condition, subjects were given a training to help cognitively reappraise a stressful situation and think of strategies to adapt to a stressor. Before random assignment to group condition, a baseline ‘tby’ is measured on the subject’s ability to place 100 colored-pegs in a specified patterned grid in one minute. Following baseline measurement, a stress event occurs for all subjects where they are asked to dip their hand in a bath of ice cold water for one minute (or as long as they can stand). Following the stress event, the subjects are asked to perform the peg task four more times with different patterns to match. subjects perform the peg task at three minute intervals. The fourth time the subject performs the task ‘t4y’ represents the subject’s end state at the end of the fictitious experiment. In the data set, ‘t#x’ values represent time on the x-axis using x-coordinates.
# Dataframe of stress_appraisal data set
head(stress_appraisal, 10) # shows the first ten rows of the 'stress_appraisal' ficticious data set found in the arse package
#> subj group tbx t1x t2x t3x t4x tby t1y t2y t3y t4y
#> 1 1 Control 0 1 2 3 4 64 40 35 38 47
#> 2 2 Appraisal_Training 0 1 2 3 4 59 57 64 60 57
#> 3 3 Control 0 1 2 3 4 41 28 20 19 28
#> 4 4 Appraisal_Training 0 1 2 3 4 62 70 75 67 61
#> 5 5 Control 0 1 2 3 4 43 41 42 43 43
#> 6 6 Appraisal_Training 0 1 2 3 4 45 40 38 44 48
#> 7 7 Control 0 1 2 3 4 70 61 69 80 75
#> 8 8 Appraisal_Training 0 1 2 3 4 55 52 60 61 69
#> 9 9 Control 0 1 2 3 4 44 44 43 42 44
#> 10 10 Appraisal_Training 0 1 2 3 4 60 56 44 30 50
Viewed above, the stress_appraisal data set has 12 columns and 50 rows that represent individual subjects. Each of the columns represent the following
To organize the data set, the baseline x-coordinate should be the
first column of x-coordinates. Accordingly, the baseline y-coordinate
value should be the first column of the y-coordinates. The functions
within the arse
package will default to the first column of
y-coordinates as the baseline value.
To plot an example case of ARSE, the plot_arse
function
provides a rough picture of the pattern of resilience. To plot a single
case of arse, the plot_arse
function requires a vector of
x-coordinates and a vector of y-coordinates. The baseline value defaults
to the first column of the y-coordinates but can be specified with the
ybase =
argument. Below, we indicate where in our dataframe
the x- and y-coordinates are located and enter them as vectors using the
as.integer()
prefix. The lower and upper limits of the
displayed scale are specified using the ll =
and
ul =
respectively (a best practice is to indicate the full
range of possible values for the scale of ‘y’ or reflect the full range
of observed values).
# Plot of ARSE for single subject
plot_arse(xcoord = as.integer(stress_appraisal[1,3:7]), ycoord = as.integer(stress_appraisal[1, 8:12]),
ll=0, ul=100, xlab = "Trial Number", ylab = "Number of Pegs")
From the plot above, you can see that the baseline is 64 and that, in this case, resilience was not achieved since the end state is below the baseline at a value of 47.
To calculate ARSE from our example case, the arse
function is used. The arse
function requires three
arguments: data, xcoord, and ycoord. For data, indicate the dataframe
that is being used, in our example this would be
stress_appraisal
. For xcoord
, a dataframe of
x-coordinates is required with the first column having the x-coordinate
of the baseline value of ‘y’. For ycoord
, a dataframe of
y-coordinates is required with the first column having the baseline
value of ‘y’. The baseline value defaults to the first column of the
y-coordinates but can be specified with the ybase =
argument (we strongly suggest that users rely on the default using the
first column of x- and y-coordinates). The arse
function
only calculates the area below the baseline; any points above the
baseline (i.e., growth) are set to the baseline level to only calculate
the area beneath the baseline. The arse
function, as well
as the related ARSE functions, will provide interpolation points for
x-coordinates where the line between two points crosses the baseline at
a point not measured in the data (using a function analogous to the
getintersectx
function in the arse
package
(see help for more details). In the example below, the first row of the
dataframe is selected with the corresponding columns for the x- and
y-coordinates. To calculate ARSE, an implementation of the shoelace
formula (Gauss’s area formula) for the area of irregular polygons is
used with the (polyarea()
) function from the
pracma
package.
The arse
function also has two additional arguments that
can be specified: yinvert
and saveout
. The
yinvert
argument can be used to calculate ARSE depending on
how the range of values of ‘y’ are to be interpreted. By default,
yinvert = FALSE
and assumes that higher values of ‘y’ are
more desirable or positive. However, if higher values of ‘y’ are not
desireable and lower values are, then yinvert = TRUE
will
calculate ARSE assuming that values above the baseline represent
resilience and values below the baseline represent growth. Lastly, the
saveout
argument is set to FALSE by default and will just
return a vector of values for the ARSE calculation. When set to TRUE,
saveout
will return the original dataframe and add a column
of the calculated ARSE values.
# Returns area of resilience to stress event (ARSE) for single subject
arse(data = stress_appraisal, xcoord = stress_appraisal[1, 3:7], ycoord = stress_appraisal[1, 8:12])
#> [1] 87.5
The function returns an ARSE value of 87.5. This area was calculated by using the x- and y-coordinates that form an irregular polygon. Since resilience was not achieved in this example (i.e., the end state value did not return or exceed the baseline), an additional point is interpolated at the same x-coordinate as the end state value with a y-coordinate value at the baseline (i.e., x = 4, y = 64). Doing so completes the appropriate shape to calculate ARSE.
In some cases, users may want to know how much growth a subject might have experienced (see plot below).
# Plot of area of growth (AoG) for single subject
plot_arse(xcoord = as.integer(stress_appraisal[4,3:7]), ycoord = as.integer(stress_appraisal[4, 8:12]),
ll=0, ul=100, xlab = "Trial Number", ylab = "Number of Pegs")
The plot shows that Subject #4 experienced growth (i.e., ‘y’ values above the baseline) after the incursion of a stress event.
To calculate areas of growth, the aog
function is used.
This function is exactly the same as the arse
function
above except that instead of setting values above the baseline to the
baseline, aog
sets values below the baseline to the
baseline to only look at the area above the baseline.
# Returns area of growth (AoG) value for single subject
aog(data = stress_appraisal, xcoord = stress_appraisal[4, 3:7], ycoord = stress_appraisal[4, 8:12])
#> [1] 25.58333
# Returns area of resilience to stress event (ARSE) value for single subject
arse(data = stress_appraisal, xcoord = stress_appraisal[4, 3:7], ycoord = stress_appraisal[4, 8:12])
#> [1] 0.08333333
The result of aog
returns a value of 25.58 indicating
the area of growth for Subject #4. However, since the subject had an end
state value below the baseline (t4y = 61), arse
can also be
calculated and return a value of 0.08. In this case, more growth was
achieved for the subject with a small area of resilience, indicating a
good response to the stress event.
In some cases, users may want to take into account both resilience
and growth. There is also a function, arse_t
, that
calculates the area of resilience (arse
) and area of growth
(aog
) and takes their difference (i.e., ARSET = ARSE − AoG)
to get a total area value for resilience. In these cases, ARSE can be
positive and negative depending on whether the area of resilience or
area of growth is larger.
# Returns area of resilience to stress event total (ARSE_T) value for single subject
arse_t(data = stress_appraisal, xcoord = stress_appraisal[4, 3:7], ycoord = stress_appraisal[4, 8:12])
#> [1] -25.5
The result of arse_t
returns a value of -25.5 which
reflects the subtraction of ARSE (0.08) from AoG (25.58). A negative
returned value indicates that the area of growth was larger than the
area of resilience.
In some cases, users may want to account for the end state being
above the baseline (growth) or below the the baseline (non-resilience).
The arse_s
function provides a scaling factor that accounts
for the end state where ARSES = ARSE * (Baseline/EndState).
When the end state is below the baseline, the scaling factor will make
ARSE larger and when the end state is above the baseline, the scaling
factor will make ARSE smaller.
# Returns area of resilience to stress event scaled (ARSE_S) value for single subject
arse_s(data = stress_appraisal, xcoord = stress_appraisal[1, 3:7], ycoord = stress_appraisal[1, 8:12])
#> [1] 119.1489
The result of arse_s
returns a value of 119.15. Recall
that the arse
value for this subject was 87.5 with a
baseline value of 64 and an end state value of 47. Thus, ARSES = 87.5 * (64/47)
or ARSES = 87.5 * 1.36
which returns a larger area (vs. the un-scaled ARSE) of 119.15.
In some cases, users may want to account for both growth and the end
state value; the arse_ts
function combines aspects of both
arse_t
and arse_s
. Specifically,
arse_ts
is calculated as follows: for arse_t
values that are >= 0, ARSET.S = ARSET * (Baseline/EndState)
while for arse_t
values that are < 0, ARSET.S = ARSET * (EndState/Baseline).
The two different calculations are needed to account for scaling
positive and negative values of arse_t
. For instance, if
arse_t
is negative and the the end state is above the
baseline, then the end state value needs to be in the numerator so that
the scaling factor can make a negative value larger (versus smaller when
arse_t
is zero or positive).
# Returns area of resilience to stress event total scaled (ARSE_TS) for single subject
arse_ts(data = stress_appraisal, xcoord = stress_appraisal[4, 3:7], ycoord = stress_appraisal[4, 8:12])
#> [1] -25.08871
The result of arse_ts
returns a value of -25.09. Recall
that arse_t
for this subject was -25.5 with a baseline of
62 and an end state of 61. Thus, ARSET.S = −25.5 * (61/62)
or ARSETS = −25.5 * (0.98)
which returns a smaller negative value (vs. un-scaled ARSET)
of -25.09.
Calculation of arse
and the ARSE family of functions for
the entire sample is the same as for individual cases.
# Returns area of resilience to stress event (ARSE) for entire sample with modified data set including calculated ARSE values
print(arse(data = stress_appraisal, xcoord = stress_appraisal[3:7], ycoord = stress_appraisal[8:12], saveout = TRUE), digits = 2)
#> subj group tbx t1x t2x t3x t4x tby t1y t2y t3y t4y arse
#> 1 1 Control 0 1 2 3 4 64 40 35 38 47 87.500
#> 2 2 Appraisal_Training 0 1 2 3 4 59 57 64 60 57 1.952
#> 3 3 Control 0 1 2 3 4 41 28 20 19 28 62.500
#> 4 4 Appraisal_Training 0 1 2 3 4 62 70 75 67 61 0.083
#> 5 5 Control 0 1 2 3 4 43 41 42 43 43 3.000
#> 6 6 Appraisal_Training 0 1 2 3 4 45 40 38 44 48 12.625
#> 7 7 Control 0 1 2 3 4 70 61 69 80 75 9.545
#> 8 8 Appraisal_Training 0 1 2 3 4 55 52 60 61 69 2.062
#> 9 9 Control 0 1 2 3 4 44 44 43 42 44 3.000
#> 10 10 Appraisal_Training 0 1 2 3 4 60 56 44 30 50 55.000
#> 11 11 Control 0 1 2 3 4 42 10 5 15 17 108.500
#> 12 12 Appraisal_Training 0 1 2 3 4 54 30 35 38 46 63.000
#> 13 13 Control 0 1 2 3 4 67 30 28 24 23 141.000
#> 14 14 Appraisal_Training 0 1 2 3 4 68 67 65 65 68 7.000
#> 15 15 Control 0 1 2 3 4 64 49 30 33 46 89.000
#> 16 16 Appraisal_Training 0 1 2 3 4 58 51 47 60 63 17.154
#> 17 17 Control 0 1 2 3 4 55 57 58 58 58 0.000
#> 18 18 Appraisal_Training 0 1 2 3 4 62 28 32 34 49 98.500
#> 19 19 Control 0 1 2 3 4 58 47 45 45 49 41.500
#> 20 20 Appraisal_Training 0 1 2 3 4 57 51 51 53 56 16.500
#> 21 21 Control 0 1 2 3 4 45 31 40 41 43 24.000
#> 22 22 Appraisal_Training 0 1 2 3 4 58 60 61 58 58 0.000
#> 23 23 Control 0 1 2 3 4 63 62 64 61 62 2.917
#> 24 24 Appraisal_Training 0 1 2 3 4 66 55 57 66 67 20.000
#> 25 25 Control 0 1 2 3 4 49 47 38 35 49 27.000
#> 26 26 Appraisal_Training 0 1 2 3 4 80 77 76 79 80 8.000
#> 27 27 Control 0 1 2 3 4 69 57 58 60 63 35.000
#> 28 28 Appraisal_Training 0 1 2 3 4 67 67 67 66 67 1.000
#> 29 29 Control 0 1 2 3 4 56 49 60 61 57 5.727
#> 30 30 Appraisal_Training 0 1 2 3 4 55 55 54 59 59 0.600
#> 31 31 Control 0 1 2 3 4 57 50 51 51 55 20.000
#> 32 32 Appraisal_Training 0 1 2 3 4 55 40 41 38 47 50.000
#> 33 33 Control 0 1 2 3 4 59 15 18 14 12 153.500
#> 34 34 Appraisal_Training 0 1 2 3 4 53 25 29 30 41 81.000
#> 35 35 Control 0 1 2 3 4 68 61 27 28 31 106.500
#> 36 36 Appraisal_Training 0 1 2 3 4 49 48 52 51 51 0.625
#> 37 37 Control 0 1 2 3 4 68 59 55 62 64 30.000
#> 38 38 Appraisal_Training 0 1 2 3 4 42 37 36 39 42 14.000
#> 39 39 Control 0 1 2 3 4 53 49 57 56 51 3.400
#> 40 40 Appraisal_Training 0 1 2 3 4 79 70 80 78 78 9.800
#> 41 41 Control 0 1 2 3 4 60 26 24 38 47 98.500
#> 42 42 Appraisal_Training 0 1 2 3 4 54 51 46 49 46 20.000
#> 43 43 Control 0 1 2 3 4 56 56 56 55 56 1.000
#> 44 44 Appraisal_Training 0 1 2 3 4 65 65 64 65 63 2.000
#> 45 45 Control 0 1 2 3 4 70 65 61 64 70 20.000
#> 46 46 Appraisal_Training 0 1 2 3 4 64 62 67 67 69 1.400
#> 47 47 Control 0 1 2 3 4 68 40 38 20 35 122.500
#> 48 48 Appraisal_Training 0 1 2 3 4 46 41 44 43 46 10.000
#> 49 49 Control 0 1 2 3 4 62 62 55 33 20 57.000
#> 50 50 Appraisal_Training 0 1 2 3 4 70 65 55 58 71 31.538
# Returns area of resilience to stress event total (ARSE_T) for entire sample with modified data set including calculated ARSE_T values
arse_t(data = stress_appraisal, xcoord = stress_appraisal[3:7], ycoord = stress_appraisal[8:12], saveout = TRUE)
#> subj group tbx t1x t2x t3x t4x tby t1y t2y t3y t4y arse_t
#> 1 1 Control 0 1 2 3 4 64 40 35 38 47 87.5
#> 2 2 Appraisal_Training 0 1 2 3 4 59 57 64 60 57 -3.0
#> 3 3 Control 0 1 2 3 4 41 28 20 19 28 62.5
#> 4 4 Appraisal_Training 0 1 2 3 4 62 70 75 67 61 -25.5
#> 5 5 Control 0 1 2 3 4 43 41 42 43 43 3.0
#> 6 6 Appraisal_Training 0 1 2 3 4 45 40 38 44 48 11.5
#> 7 7 Control 0 1 2 3 4 70 61 69 80 75 -2.5
#> 8 8 Appraisal_Training 0 1 2 3 4 55 52 60 61 69 -15.0
#> 9 9 Control 0 1 2 3 4 44 44 43 42 44 3.0
#> 10 10 Appraisal_Training 0 1 2 3 4 60 56 44 30 50 55.0
#> 11 11 Control 0 1 2 3 4 42 10 5 15 17 108.5
#> 12 12 Appraisal_Training 0 1 2 3 4 54 30 35 38 46 63.0
#> 13 13 Control 0 1 2 3 4 67 30 28 24 23 141.0
#> 14 14 Appraisal_Training 0 1 2 3 4 68 67 65 65 68 7.0
#> 15 15 Control 0 1 2 3 4 64 49 30 33 46 89.0
#> 16 16 Appraisal_Training 0 1 2 3 4 58 51 47 60 63 13.5
#> 17 17 Control 0 1 2 3 4 55 57 58 58 58 -9.5
#> 18 18 Appraisal_Training 0 1 2 3 4 62 28 32 34 49 98.5
#> 19 19 Control 0 1 2 3 4 58 47 45 45 49 41.5
#> 20 20 Appraisal_Training 0 1 2 3 4 57 51 51 53 56 16.5
#> 21 21 Control 0 1 2 3 4 45 31 40 41 43 24.0
#> 22 22 Appraisal_Training 0 1 2 3 4 58 60 61 58 58 -5.0
#> 23 23 Control 0 1 2 3 4 63 62 64 61 62 2.5
#> 24 24 Appraisal_Training 0 1 2 3 4 66 55 57 66 67 19.5
#> 25 25 Control 0 1 2 3 4 49 47 38 35 49 27.0
#> 26 26 Appraisal_Training 0 1 2 3 4 80 77 76 79 80 8.0
#> 27 27 Control 0 1 2 3 4 69 57 58 60 63 35.0
#> 28 28 Appraisal_Training 0 1 2 3 4 67 67 67 66 67 1.0
#> 29 29 Control 0 1 2 3 4 56 49 60 61 57 -2.5
#> 30 30 Appraisal_Training 0 1 2 3 4 55 55 54 59 59 -5.0
#> 31 31 Control 0 1 2 3 4 57 50 51 51 55 20.0
#> 32 32 Appraisal_Training 0 1 2 3 4 55 40 41 38 47 50.0
#> 33 33 Control 0 1 2 3 4 59 15 18 14 12 153.5
#> 34 34 Appraisal_Training 0 1 2 3 4 53 25 29 30 41 81.0
#> 35 35 Control 0 1 2 3 4 68 61 27 28 31 106.5
#> 36 36 Appraisal_Training 0 1 2 3 4 49 48 52 51 51 -5.0
#> 37 37 Control 0 1 2 3 4 68 59 55 62 64 30.0
#> 38 38 Appraisal_Training 0 1 2 3 4 42 37 36 39 42 14.0
#> 39 39 Control 0 1 2 3 4 53 49 57 56 51 -2.0
#> 40 40 Appraisal_Training 0 1 2 3 4 79 70 80 78 78 9.5
#> 41 41 Control 0 1 2 3 4 60 26 24 38 47 98.5
#> 42 42 Appraisal_Training 0 1 2 3 4 54 51 46 49 46 20.0
#> 43 43 Control 0 1 2 3 4 56 56 56 55 56 1.0
#> 44 44 Appraisal_Training 0 1 2 3 4 65 65 64 65 63 2.0
#> 45 45 Control 0 1 2 3 4 70 65 61 64 70 20.0
#> 46 46 Appraisal_Training 0 1 2 3 4 64 62 67 67 69 -6.5
#> 47 47 Control 0 1 2 3 4 68 40 38 20 35 122.5
#> 48 48 Appraisal_Training 0 1 2 3 4 46 41 44 43 46 10.0
#> 49 49 Control 0 1 2 3 4 62 62 55 33 20 57.0
#> 50 50 Appraisal_Training 0 1 2 3 4 70 65 55 58 71 31.5
# Returns area of resilience to stress event scaled (ARSE_S) for entire sample with modified data set including calculated ARSE_S values
print(arse_s(data = stress_appraisal, xcoord = stress_appraisal[3:7], ycoord = stress_appraisal[8:12], saveout = TRUE), digits = 2)
#> subj group tbx t1x t2x t3x t4x tby t1y t2y t3y t4y arse_s
#> 1 1 Control 0 1 2 3 4 64 40 35 38 47 119.149
#> 2 2 Appraisal_Training 0 1 2 3 4 59 57 64 60 57 2.021
#> 3 3 Control 0 1 2 3 4 41 28 20 19 28 91.518
#> 4 4 Appraisal_Training 0 1 2 3 4 62 70 75 67 61 0.085
#> 5 5 Control 0 1 2 3 4 43 41 42 43 43 3.000
#> 6 6 Appraisal_Training 0 1 2 3 4 45 40 38 44 48 11.836
#> 7 7 Control 0 1 2 3 4 70 61 69 80 75 8.909
#> 8 8 Appraisal_Training 0 1 2 3 4 55 52 60 61 69 1.644
#> 9 9 Control 0 1 2 3 4 44 44 43 42 44 3.000
#> 10 10 Appraisal_Training 0 1 2 3 4 60 56 44 30 50 66.000
#> 11 11 Control 0 1 2 3 4 42 10 5 15 17 268.059
#> 12 12 Appraisal_Training 0 1 2 3 4 54 30 35 38 46 73.957
#> 13 13 Control 0 1 2 3 4 67 30 28 24 23 410.739
#> 14 14 Appraisal_Training 0 1 2 3 4 68 67 65 65 68 7.000
#> 15 15 Control 0 1 2 3 4 64 49 30 33 46 123.826
#> 16 16 Appraisal_Training 0 1 2 3 4 58 51 47 60 63 15.792
#> 17 17 Control 0 1 2 3 4 55 57 58 58 58 0.000
#> 18 18 Appraisal_Training 0 1 2 3 4 62 28 32 34 49 124.633
#> 19 19 Control 0 1 2 3 4 58 47 45 45 49 49.122
#> 20 20 Appraisal_Training 0 1 2 3 4 57 51 51 53 56 16.795
#> 21 21 Control 0 1 2 3 4 45 31 40 41 43 25.116
#> 22 22 Appraisal_Training 0 1 2 3 4 58 60 61 58 58 0.000
#> 23 23 Control 0 1 2 3 4 63 62 64 61 62 2.964
#> 24 24 Appraisal_Training 0 1 2 3 4 66 55 57 66 67 19.701
#> 25 25 Control 0 1 2 3 4 49 47 38 35 49 27.000
#> 26 26 Appraisal_Training 0 1 2 3 4 80 77 76 79 80 8.000
#> 27 27 Control 0 1 2 3 4 69 57 58 60 63 38.333
#> 28 28 Appraisal_Training 0 1 2 3 4 67 67 67 66 67 1.000
#> 29 29 Control 0 1 2 3 4 56 49 60 61 57 5.627
#> 30 30 Appraisal_Training 0 1 2 3 4 55 55 54 59 59 0.559
#> 31 31 Control 0 1 2 3 4 57 50 51 51 55 20.727
#> 32 32 Appraisal_Training 0 1 2 3 4 55 40 41 38 47 58.511
#> 33 33 Control 0 1 2 3 4 59 15 18 14 12 754.708
#> 34 34 Appraisal_Training 0 1 2 3 4 53 25 29 30 41 104.707
#> 35 35 Control 0 1 2 3 4 68 61 27 28 31 233.613
#> 36 36 Appraisal_Training 0 1 2 3 4 49 48 52 51 51 0.600
#> 37 37 Control 0 1 2 3 4 68 59 55 62 64 31.875
#> 38 38 Appraisal_Training 0 1 2 3 4 42 37 36 39 42 14.000
#> 39 39 Control 0 1 2 3 4 53 49 57 56 51 3.533
#> 40 40 Appraisal_Training 0 1 2 3 4 79 70 80 78 78 9.926
#> 41 41 Control 0 1 2 3 4 60 26 24 38 47 125.745
#> 42 42 Appraisal_Training 0 1 2 3 4 54 51 46 49 46 23.478
#> 43 43 Control 0 1 2 3 4 56 56 56 55 56 1.000
#> 44 44 Appraisal_Training 0 1 2 3 4 65 65 64 65 63 2.063
#> 45 45 Control 0 1 2 3 4 70 65 61 64 70 20.000
#> 46 46 Appraisal_Training 0 1 2 3 4 64 62 67 67 69 1.299
#> 47 47 Control 0 1 2 3 4 68 40 38 20 35 238.000
#> 48 48 Appraisal_Training 0 1 2 3 4 46 41 44 43 46 10.000
#> 49 49 Control 0 1 2 3 4 62 62 55 33 20 176.700
#> 50 50 Appraisal_Training 0 1 2 3 4 70 65 55 58 71 31.094
# Returns area of resilience to stress event total scaled (ARSE_TS) for entire sample with modified data set including calculated ARSE_TS values
print(arse_ts(data = stress_appraisal, xcoord = stress_appraisal[3:7], ycoord = stress_appraisal[8:12], saveout = TRUE), digits = 3)
#> subj group tbx t1x t2x t3x t4x tby t1y t2y t3y t4y arse_ts
#> 1 1 Control 0 1 2 3 4 64 40 35 38 47 119.15
#> 2 2 Appraisal_Training 0 1 2 3 4 59 57 64 60 57 -3.11
#> 3 3 Control 0 1 2 3 4 41 28 20 19 28 91.52
#> 4 4 Appraisal_Training 0 1 2 3 4 62 70 75 67 61 -25.92
#> 5 5 Control 0 1 2 3 4 43 41 42 43 43 3.00
#> 6 6 Appraisal_Training 0 1 2 3 4 45 40 38 44 48 10.78
#> 7 7 Control 0 1 2 3 4 70 61 69 80 75 -2.33
#> 8 8 Appraisal_Training 0 1 2 3 4 55 52 60 61 69 -11.96
#> 9 9 Control 0 1 2 3 4 44 44 43 42 44 3.00
#> 10 10 Appraisal_Training 0 1 2 3 4 60 56 44 30 50 66.00
#> 11 11 Control 0 1 2 3 4 42 10 5 15 17 268.06
#> 12 12 Appraisal_Training 0 1 2 3 4 54 30 35 38 46 73.96
#> 13 13 Control 0 1 2 3 4 67 30 28 24 23 410.74
#> 14 14 Appraisal_Training 0 1 2 3 4 68 67 65 65 68 7.00
#> 15 15 Control 0 1 2 3 4 64 49 30 33 46 123.83
#> 16 16 Appraisal_Training 0 1 2 3 4 58 51 47 60 63 12.43
#> 17 17 Control 0 1 2 3 4 55 57 58 58 58 -9.01
#> 18 18 Appraisal_Training 0 1 2 3 4 62 28 32 34 49 124.63
#> 19 19 Control 0 1 2 3 4 58 47 45 45 49 49.12
#> 20 20 Appraisal_Training 0 1 2 3 4 57 51 51 53 56 16.79
#> 21 21 Control 0 1 2 3 4 45 31 40 41 43 25.12
#> 22 22 Appraisal_Training 0 1 2 3 4 58 60 61 58 58 -5.00
#> 23 23 Control 0 1 2 3 4 63 62 64 61 62 2.54
#> 24 24 Appraisal_Training 0 1 2 3 4 66 55 57 66 67 19.21
#> 25 25 Control 0 1 2 3 4 49 47 38 35 49 27.00
#> 26 26 Appraisal_Training 0 1 2 3 4 80 77 76 79 80 8.00
#> 27 27 Control 0 1 2 3 4 69 57 58 60 63 38.33
#> 28 28 Appraisal_Training 0 1 2 3 4 67 67 67 66 67 1.00
#> 29 29 Control 0 1 2 3 4 56 49 60 61 57 -2.46
#> 30 30 Appraisal_Training 0 1 2 3 4 55 55 54 59 59 -4.66
#> 31 31 Control 0 1 2 3 4 57 50 51 51 55 20.73
#> 32 32 Appraisal_Training 0 1 2 3 4 55 40 41 38 47 58.51
#> 33 33 Control 0 1 2 3 4 59 15 18 14 12 754.71
#> 34 34 Appraisal_Training 0 1 2 3 4 53 25 29 30 41 104.71
#> 35 35 Control 0 1 2 3 4 68 61 27 28 31 233.61
#> 36 36 Appraisal_Training 0 1 2 3 4 49 48 52 51 51 -4.80
#> 37 37 Control 0 1 2 3 4 68 59 55 62 64 31.88
#> 38 38 Appraisal_Training 0 1 2 3 4 42 37 36 39 42 14.00
#> 39 39 Control 0 1 2 3 4 53 49 57 56 51 -2.08
#> 40 40 Appraisal_Training 0 1 2 3 4 79 70 80 78 78 9.62
#> 41 41 Control 0 1 2 3 4 60 26 24 38 47 125.74
#> 42 42 Appraisal_Training 0 1 2 3 4 54 51 46 49 46 23.48
#> 43 43 Control 0 1 2 3 4 56 56 56 55 56 1.00
#> 44 44 Appraisal_Training 0 1 2 3 4 65 65 64 65 63 2.06
#> 45 45 Control 0 1 2 3 4 70 65 61 64 70 20.00
#> 46 46 Appraisal_Training 0 1 2 3 4 64 62 67 67 69 -6.03
#> 47 47 Control 0 1 2 3 4 68 40 38 20 35 238.00
#> 48 48 Appraisal_Training 0 1 2 3 4 46 41 44 43 46 10.00
#> 49 49 Control 0 1 2 3 4 62 62 55 33 20 176.70
#> 50 50 Appraisal_Training 0 1 2 3 4 70 65 55 58 71 31.06
In this example, we first calculate values of arse_ts
for the entire sample and create a new column ‘arse_ts’ by saving the
new dataframe as a new object ‘data1’. Second, we perform a
t-test by comparing the control and appraisal_training groups
under the ‘group’ factor.
# Returns area of resilience to stress event total scaled (ARSE_TS) for entire sample with modified data set including calculated ARSE_TS values
data1 <- arse_ts(data = stress_appraisal, xcoord = stress_appraisal[3:7], ycoord = stress_appraisal[8:12], saveout = TRUE)
t.test(data1$arse_ts ~ data1$group)
#>
#> Welch Two Sample t-test
#>
#> data: data1$arse_ts by data1$group
#> t = -2.5177, df = 26.175, p-value = 0.01826
#> alternative hypothesis: true difference in means between group Appraisal_Training and group Control is not equal to 0
#> 95 percent confidence interval:
#> -160.99391 -16.29634
#> sample estimates:
#> mean in group Appraisal_Training mean in group Control
#> 21.27067 109.91580
# Boxplot of two group conditions
boxplot(data1$arse_ts~data1$group, data = data1,
xlab="Trials", ylab="Number of Pegs")
The result of the t-test reveals a significant difference between the two groups at an alpha level of 0.05. Specifically, subjects in the appraisal training condition had smaller ARSETS values (M = 21.27) compared to the control condition (M = 109.92).
# Plots the mean values of 'y' across x-coordinates for the control group
stress_appraisal_group <- subset(stress_appraisal, group == "Control", select = c("subj", "group", "tbx", "t1x", "t2x", "t3x", "t4x", "tby", "t1y", "t2y", "t3y", "t4y"))
plot_arse(xcoord = as.integer(stress_appraisal_group[1,3:7]),
ycoord = c(mean(stress_appraisal_group[,8]),mean(stress_appraisal_group[,9]),mean(stress_appraisal_group[,10]),
mean(stress_appraisal_group[,11]), mean(stress_appraisal_group[,12])),
ll=0, ul=100, xlab = "Trial Number", ylab = "Number of Pegs")
The plot above reflects the mean values of the ‘y’ variable at each time interval to show the average shape of the ARSE for subjects in the control condition.
# Plots the mean values of 'y' across the x-coordinates for the appraisal training group
stress_appraisal_group <- subset(stress_appraisal, group == "Appraisal_Training", select = c("subj", "group", "tbx", "t1x", "t2x", "t3x", "t4x", "tby", "t1y", "t2y", "t3y", "t4y"))
plot_arse(xcoord = as.integer(stress_appraisal_group[1,3:7]),
ycoord = c(mean(stress_appraisal_group[,8]),mean(stress_appraisal_group[,9]),mean(stress_appraisal_group[,10]),
mean(stress_appraisal_group[,11]), mean(stress_appraisal_group[,12])),
ll=0, ul=100, xlab = "Trial Number", ylab = "Number of Pegs")
The plot above reflects the mean values of the ‘y’ variable at each time interval to show the average shape of the ARSE for subjects in the appraisal training condition.
Ratcliff, N. J., Nair, D. T., & Goldstein, J. R. (under review). The Area of Resilience to Stress Event (ARSE): A New Conceptual Clarification and Method for Quantifying the Process of Resilience.