Closed lebebr01 closed 10 months ago
Here are the revised sections (updated on the JOSE branch), in which we now describe the dataset used as well as the results of the analyses:
Below we provide example code using the
mtcars
dataset, which was extracted from the 1974 Motor Trend US magazine. The dataset contains fuel consumption and 10 characteristics of automobile design and performance for 32 different car models (see?mtcars
for details). We chose this dataset because it is accessible from base R and familiar to many R users. We might want to conduct specific statistical analyses on this data set, say, t tests or structural equation modelling, but first, we want to check for outliers that may influence those test results.Because the automobile names are stored as column names in
mtcars
, we first have to convert them to an ID column to benefit from thecheck_outliers()
ID argument. Furthermore, we only really need a couple columns for this demonstration, so we choose the first four (mpg
= Miles/(US) gallon;cyl
= Number of cylinders;disp
= Displacement;hp
= Gross horsepower). Finally, because there are no outliers in this dataset, we add two artificial outliers before running our function.library(performance) outliers <- check_outliers(data, method = "zscore_robust", ID = "car") outliers
What we see is that
check_outliers()
with the robust z score method detected two outliers: cases 33 and 34, which were the observations we added ourselves. They were flagged for two variables specifically:mpg
(Miles/(US) gallon) andcyl
(Number of cylinders), and the output provides their exact z score for those variables.We describe how to deal with those cases in more details later in the paper, but should we want to exclude these detected outliers from the main dataset, we can extract row numbers using
which()
on the output object, which can then be used for indexing: [...]
This is great added context. May seem superfluous given the usage of the data within R, but I really like the flow this adds to the paper.
One last element related to the "Instructional Design" and "Description" items for the JOSE review: I thought the JOSE paper would benefit from some contextualization of the analysis. For example, what are the goals of the analysis and context of the data? This can aid those trying to learn the material, helping them understand the context of the data and what the analysis is doing.
You could accomplish this in multiple ways. For example, one way could be a few sentences describing the example data at the beginning and some description of the results in the problem context.
https://github.com/openjournals/jose-reviews/issues/221