library(knitr)
Psychologists are, for historical reasons, familiar with categorical predictors. These are reffered to as "effects" of different conditions upon an outcome variable. Interestingly, one of the first topic that is taught to first year students, in experimental psychology, is "interactions". When I started doing statistics, after a bachelor in psychology, there was, to me, no such things as nested effects or variables. You tested a model (often directly the ANOVA) with the interaction or without.
Let's take interest in the relationship between life satisfaction, sex and concealing (the tendency to suppress or hide one's emotions)
library(tidyverse) library(psycho) df <- psycho::affective %>% select(Salary, Life_Satisfaction, Adjusting) summary(df)
anova_results <- aov(Life_Satisfaction ~ Sex * Concealing, data=df) analyze(anova_results)
fit <- lm(Life_Satisfaction ~ Sex * Concealing, data=df) summary(fit)
analyze(anova(fit))
First, note that running an anova on the linear model produces EXACTLY the same results. But we can to have a look at the model itself, which is richer than the ANOVA.
analyze(fit)
Again, three lines of "effect". One could think these a similar to the one
fit <- lm(Life_Satisfaction ~ Adjusting / Concealing, data=df) summary(fit) df %>% refdata(c("Concealing", "Adjusting"), length.out = 5) %>% get_predicted(fit, .) %>% ggplot(aes(x=Adjusting, y=Life_Satisfaction_Predicted, alpha=Concealing, group=Concealing)) + geom_line()
Of course, these reporting standards should change, depending on new expert recommandations or official guidelines. The goal of this package is to flexibly adaptive to new changes and good practices evolution. Therefore, if you have any advices, opinions or such, we encourage you to either let us know by opening an issue, or even better, try to implement them yourself by contributing to the code.
This package helped you? Don't forget to cite the various packages you used :)
You can cite psycho
as follows:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.