Select("condition", "env_att_scale", # predictors (experimental condition and environmental attitude)Īll_of(dep_vars_env)) # dependent variables Or you can access the data directly from R: library("httr") To be able to replicate the code and create the table, you can either manually download the file “df_study1.RData” from, put it in the folder where your R code is located (or set the working directory accordingly), and load the data into R: load("df_study1.RData") # this only works if data is downloaded manually "gtools") # to convert p-values into significance stars "broom", # for extracting information from linear models "kableExtra", # for customizing and displaying tables "sjlabelled", # working with item labels (e.g., display their actual content) "purrr", # applying the linear regression function to several dependent variables The results will look more or less like this:Ĭheck if the necessary packages are available and install them if they are not: if (!require("pacman")) install.packages("pacman") Fit multiplicative regression models (direct and interactive effects) and save the relevant statistics.Fit additive regression models (direct effects) and save the relevant statistics. The approach presented here includes the following five steps: The table can be adapted to suit different requirements for example, you can include other statistical information.The code can directly be included in R Markdown documents (to create papers directly from R).The analyses can be shared and replicated quickly and effortlessly.You can quickly adapt the code to conduct similar analyses with other variables (as was the case in this project, in which we examined similar processes in the context of health).In case you need to change something in your analyses (e.g., because a peer-reviewer asks you to use factor scores instead of means to represent your constructs or because you need to include control variables or exclude participants with certain characteristics), you can save a lot of time.You can avoid mistakes that occur when transferring numbers from R to text editors (e.g., Word) or tables.You can avoid mistakes that occur when copying and adapting R code (e.g., for other dependent variables).We looked for a solution to create complex tables programmatically. However, this kind of manual work is both error-prone and cannot be programmatically replicated as it happens outside the R environment. Of course, one could create individual tables for the different dependent variables in R and then combine them into a single table in Word. If adding the interaction terms results in a statistically significant improvement of the model, the next step is to do follow-up analyses to visualize and better understand the interaction (Cohen, Cohen, West, and Aiken, 2003 Spiller, Fitzsimons, Lynch, and McClelland, 2013).Īlthough there are already easy-to-use packages to create nice tables for multiple regression models (or blocks e.g., apaTables), I could not find an existing solution to create a table that includes the results for several dependent variables. Fit a second model that also includes the interaction terms of the predictors (interaction effect).Fit a model with the two predictors that are expected to interact (direct effects).Using a regression approach to examine whether the predictors interacted, we followed the typical two-step procedure (Cohen, Cohen, West, and Aiken, 2003): In 2018, my co-author and I (Brügger and Höchli, 2019) wrote an article in which we examined possible interaction effects between people’s attitude towards the environment and two experimental conditions (dummy variable: recalling environmentally friendly vs. unfriendly behaviour) on many dependent variables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |