Skip to content

This is a careless responder identification package for Ecological Momentary Assessment (EMA) data.

License

Notifications You must be signed in to change notification settings

manateelab/EMAeval-R-Package

Repository files navigation

EMAeval Description

Noah Kraus 11/03/2020

EMAeval R Markdown

The R package EMAeval contains functions created to help researchers identify careless responses as well as responders ine EMA data. An example dataset is included in the package to help the user better understand the uses of each function. This dataset “EMAeval_Data” is used in the example code below.

There are 4 “participants,” each having 50 assessments. Each was asked 8 questions per assessment.

EMAeval_Data Example

ID

StartDate

EndDate

Q1

Q2

Q3

Q4

Q5

Q6

Q7

Q8

1

1001

2020-01-02 10:01:23

2020-01-02 10:02:07

61

9

46

39

5

64

74

32

56

1002

2020-01-07 10:01:16

2020-01-07 10:01:24

45

50

49

48

54

55

48

52

111

1003

2020-01-12 10:00:46

2020-01-12 10:12:08

72

99

25

68

23

42

21

25

172

1004

2020-01-23 09:58:22

2020-01-23 09:58:38

15

5

12

30

73

83

36

6

Functions

Below are the functions in the R package EMAeval. The functions are:

  • flagging_df
  • flagging_plots
  • TPI_cutoff
  • SD_cutoff
  • Perc_Mode_cutoff
  • Combined_cutoff
  • Combined_cutoff_percent

Each section will be dedicated to a particular function, giving an example of the usage with the EMAeval_Data and showing the output.

flagging_df

*This function creates a dataframe that reports Time to Complete (TTC), Time per Item (TPI), Item Standard Deviation (SD), and Longstring. If the Longstring returns NA, then there was no longstring response because all item responses were different. The partial results of the flagging_df function are based from the EMAeval_Data Example above. *

flaggingDF <- flagging_df(EMAeval_Data, 
                          ttc.colnames = c("StartDate", "EndDate"), 
                          item.colnames = colnames(EMAeval_Data[,4:11]))

Flagging Dataframe Example

TTC

TPI

SD

Longstring

1

44

5.50

25.21

NA

56

8

1.00

3.36

48

111

682

85.25

29.31

25

172

16

2.00

30.22

NA

flagging_plots

This function creates a histograms of each of the calculations reported in the flagging_df function. This can be used to help users identify the cutoff values for TPI and SD.

flagging_plots(EMAeval_Data, 
               ttc.colnames = c("StartDate", "EndDate"), 
               item.colnames = colnames(EMAeval_Data[,4:11]),
               number.items = 8)

Note: the Longstring histogram has a much smaller scale for the Count. This is due to the lack of longstring values because many assessments do not have a Longstring value because all item responses differ.

TPI_cutoff

This function creates a dataframe of ID and data indices in which the assessment met the cutoff criterion for Time per Item. The user inputs their own cutoff for TPI. The user can also specify what type of comparison they would like to complete with the cutoff value using condition =… If responses to all items are mandatory, then the following response should be included:

mandatory.response = TRUE

Below is the code for the function.

TPI_cutoff(EMAeval_Data, 
           cutoff = 1, 
           condition = "<=",  
           ttc.colnames = c("StartDate", "EndDate"),  
           number.items = 8,
           mandatory.response = TRUE, 
           item.colnames = colnames(EMAeval_Data[,4:11]), 
           ID.colname = "ID")

Assessments Flagged by TPI Cutoff

ID

Index_of_Flagged_Assessment

1002

51

1002

52

1002

53

1002

54

1002

55

1002

56

1002

57

1002

58

1002

62

1002

63

1002

65

1002

67

1002

68

1002

69

1002

70

1002

71

1002

72

1002

75

1002

76

1002

78

1002

79

1002

80

1002

81

1002

82

1002

83

1002

87

1002

90

1002

91

1002

92

1002

93

1002

96

1002

97

1002

98

1002

99

1003

116

SD_cutoff

This function creates a dataframe of ID and data indices in which the assessment met the cutoff criterion for Item Score Standard Deviation. The user inputs their own cutoff for SD. The user can also specify what type of comparison they would like to complete with the cutoff value using condition =…

Below is the code for the function.

SD_cutoff(EMAeval_Data, 
          cutoff = 5,  
          condition = "<=", 
          item.colnames = colnames(EMAeval_Data[,4:11]), 
          ID.colname = "ID")

Assessments Flagged by SD Cutoff

ID

Index_of_Flagged_Assessment

1002

51

1002

52

1002

53

1002

54

1002

55

1002

56

1002

57

1002

58

1002

59

1002

60

1002

61

1002

62

1002

63

1002

64

1002

65

1002

66

1002

67

1002

68

1002

69

1002

70

1002

71

1002

72

1002

73

1002

74

1002

75

1002

76

1002

77

1002

78

1002

79

1002

80

1002

81

1002

82

1002

83

1002

84

1002

85

1002

86

1002

87

1002

88

1002

89

1002

90

1002

91

1002

92

1002

93

1002

94

1002

95

1003

142

Perc_Mode_cutoff

This function creates a dataframe of ID and data indices in which the assessment met the cutoff criterion for the Percent of Items at Mode. The user inputs their own cutoff for Percent of Items at Mode. The user can also specify what type of comparison they would like to complete with the cutoff value using condition =…

Below is the code for the function.

Perc_Mode_cutoff(EMAeval_Data, 
                 cutoff = 0.7,  
                 condition = ">=", 
                 item.colnames = colnames(EMAeval_Data[,4:11]), 
                 ID.colname = "ID")

Assessments Flagged by PErcent of Items at Mode Cutoff

ID

Index_of_Flagged_Assessment

1002

100

1003

138

1003

140

1003

142

1003

150

Combined_cutoff

This function creates a dataframe of ID and data indices in which the assessment met the cutoff criteria for Time per Item OR Item Score Standard Deviation OR Percent of Items at Mode. The user inputs their own cutoff for TPI, SD and Percent of Items at Mode. The user can also specify what type of comparison they would like to complete with each cutoff value using either SD.condition =… and TPI.condition=… and Perc.Mode.condition=… Users can also specify the logical component for the criteria, specifying with Combined.logic = … If responses to all items are mandatory, then the following response should be included:

mandatory.response = TRUE

Below is the code for the function.

Combined_cutoff(EMAeval_Data, 
                SD.cutoff = 5, SD.condition = "<=", 
                TPI.cutoff = 1, TPI.condition = "<=", 
                Perc.Mode.cutoff = 0.7, Perc.Mode.condition = ">=", 
                Combined.logic = "or", 
                ttc.colnames = c("StartDate", "EndDate"), 
                number.items = 8, mandatory.response = TRUE, 
                item.colnames = colnames(EMAeval_Data[,4:11]), 
                ID.colname = "ID")

Assessments Flagged by TPI, SD or Percent of Items at Mode Cutoffs

ID

Index_of_Flagged_Assessment

1002

51

1002

52

1002

53

1002

54

1002

55

1002

56

1002

57

1002

58

1002

59

1002

60

1002

61

1002

62

1002

63

1002

64

1002

65

1002

66

1002

67

1002

68

1002

69

1002

70

1002

71

1002

72

1002

73

1002

74

1002

75

1002

76

1002

77

1002

78

1002

79

1002

80

1002

81

1002

82

1002

83

1002

84

1002

85

1002

86

1002

87

1002

88

1002

89

1002

90

1002

91

1002

92

1002

93

1002

94

1002

95

1002

96

1002

97

1002

98

1002

99

1003

116

1003

142

Combined_cutoff_percent

This function creates a dataframe of ID and percent of responses in which assessments met the cutoff criteria for Time per Item OR Item Score Standard Deviation OR Percent of Items at Mode. The user inputs their own cutoff for TPI, SD and Percent of Items at Mode. The user can also specify what type of comparison they would like to complete with each cutoff value using either SD.condition =… and TPI.condition=… and Perc.Mode.condition=… Users can also specify the logical component for the criteria, specifying with Combined.logic = … If responses to all items are mandatory, then the following response should be included:

mandatory.response = TRUE

Below is the code for the function.

Combined_cutoff_percent(EMAeval_Data, 
                        SD.cutoff = 5, SD.condition = "<=", 
                        TPI.cutoff = 1, TPI.condition = "<=",  
                        Perc.Mode.cutoff = 0.7, Perc.Mode.condition = ">=", 
                        Combined.logic = "or",
                        ttc.colnames = c("StartDate", "EndDate"),  
                        number.items = 8, mandatory.response = TRUE, 
                        item.colnames = colnames(EMAeval_Data[,4:11]), 
                        ID.colname = "ID")

Percentage of Assessments Flagged by TPI, SD or Percent of Items at Mode Cutoffs

ID

Percent_Flagged

1002

100

1003

10

About

This is a careless responder identification package for Ecological Momentary Assessment (EMA) data.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages