Mediation analysis in R - Method 1

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 16

  • @tidydata
    @tidydata  9 месяцев назад

    Note that, the a path coefficient should be 0.033 rather than 0.33 shown on the slides. My appologies.

  • @uauu9099
    @uauu9099 9 месяцев назад +1

    Think the in the final figure showing the ab c paths, it should be 0.033( not 0.33)

    • @tidydata
      @tidydata  9 месяцев назад

      Yes, you are correct. I will correct it in slides.

  • @tidydata
    @tidydata  2 года назад

    The R Code File:
    Complete R code for mediation analysis:
    github.com/TidyPython/Mediation_analysis/blob/main/Method%201%20R%20code.R
    Slides being used:
    github.com/TidyPython/Mediation_analysis/blob/main/Mediation%20Analysis%20in%20R_Slides.pdf

  • @karen-bu4dk
    @karen-bu4dk 5 месяцев назад

    Thanks for sharing! In regression, should we add control variables such as confounding variables and covariates into the three regression equations for path a, b and c? If so, should we respectively control for variables that affect 1) both X and M, 2) variables that affect both M and Y, and 3) variables that affect both X and Y? Alternatively, should we just control for covariates that affect M and Y respectively without focusing on the independent variables such as X and M?

    • @tidydata
      @tidydata  5 месяцев назад

      Hi, let me just focus on your first part of the question: there are 3 regressions, as mentioned in my video. If there are covariates, you just add them into each regression model. I do not understand your second part of the question. Sorry!

    • @karen-bu4dk
      @karen-bu4dk 5 месяцев назад

      @@tidydata Thanks for your reply. I was wondering if we should control for covariates or confounding variables? These are two different concepts, as covariates just affect the dependent variables such as M or Y, but confounding variables affect both X and M (for a path), or affect M and Y (for the b path), or affect X and Y (for the c' path). Thanks!

    • @tidydata
      @tidydata  5 месяцев назад

      @@karen-bu4dk Hi, you are welcome! Just a comment/question: Even if a confounding variable (e.g., Z) impacts both X and M, the linear regression model for a path will be: M = X + Z. Can you write it in another way? Or, do I miss anything here? (Note that, I only know the linear regression approach of medaition analysis and thus I could be wrong here.)

  • @user-fj8df2yr5l
    @user-fj8df2yr5l 3 месяца назад

    If I have other control variables, C,D,E, to control the results of regressions. should I include all control variables in all regressions, a b c?

    • @tidydata
      @tidydata  3 месяца назад +1

      Note that, there are two DVs in mediation analysis, namely mediator (M) and dependent measure (Y). If your control variables are for both M and Y, yes, you need to add them into all the regression models. I am not sure how to do that in the "Mediation" R package. But, if you have SPSS, you can use PROCESS, which has menu to directly do that.

  • @helenaliao5757
    @helenaliao5757 4 месяца назад

    Many thanks for the clear tutorial!! I use plm function to do the a.path & b.path, but the results show "Running nonparametric bootstrap
    Error in statistic(data, original, ...) :
    mediator model is not yet implemented" Can you help to solve this issue?
    thanks

    • @tidydata
      @tidydata  4 месяца назад

      Hi, you are welcome. Why do you use plm rather than just lm? If you look at my tutorial, I used lm in R. I am not sure if the mediation package supports plm. github.com/TidyPython/Mediation_analysis/blob/main/Method%201%20R%20code.R

  • @linlizhou760
    @linlizhou760 Год назад

    Why the b effect is based on the model 'Y~aX+bM', instead of 'Y~bM'?

    • @tidydata
      @tidydata  Год назад

      When testing the effect of mediator on DV, you need to control for IV (i.e., X) at the same time. Thus, it is a multiple linear regression, rather than simple linear regression. You can refer to this page: davidakenny.net/cm/mediate.htm

    • @linlizhou760
      @linlizhou760 Год назад

      @@tidydata Thanks! Could you please provide 1-3 sample articles that used this method? Most articles I found used PROCESS added in SPSS instead of R.

    • @tidydata
      @tidydata  Год назад

      @@linlizhou760 You are welcome! When M and Y are continuous data (or, numerical data), you use linear regressions for both a path and b path. In this case, the R package "mediation" and SPSS PROCESS are using the same method, just different software! Mediation analysis in social science uses the exact same method that I provided in this tutorial (refer to Baron and Kenny (1986)). Actually, PROCESS also can be used in R, and please refer to my another tutorial: ruclips.net/video/4Aq3RRRu0DI/видео.html