You are here

Possible bug and question: Variable name interference with dummy variable name & Average effect size

3 posts / 0 new
Last post
jasperd's picture
Offline
Joined: 06/28/2016 - 22:32
Possible bug and question: Variable name interference with dummy variable name & Average effect size
AttachmentSize
File metaSEMCAP.csv2.4 KB
File metaSEMnocap.csv2.4 KB
Binary Data metaSEMnames.R1.3 KB

Hi Mike,

I have two questions, both are related to finding the average effect size of categories in covariates with metaSEM. I've been trying to find the correct way to find the average effect sizes and have found a variety of results for different approaches. One of the reason for these differences seem to be related to my first question/issue, and may be a bug. The second question is simply about the correct way to find average effect sizes.

  1. When running one of my 3-level mixed-effects models I use the same name for a dummy variable to indicate categories as for a non-related variable in the data set ("Parent"). This seems to interfere with the results of the 3-level mixed-effects model.

When using the exact same name for the dummy variable ("Parent") as for the non-related variable in the data set, the intercept effect size is -.55. When giving the dummy variable name low caps ("parent") the intercept effect size of the same analysis is -.46 (same when giving a completely different name). The same difference in effect size appears when changing the name of the non-related variable in the data set. I attached an Rscript and two csv files for you to test this. Both csv data sets are identical, apart from the non-related variable name for which one uses a capital ("Parent") and the other does not ("parent").

  1. I want to find the average effect sizes with metaSEM for each category for every covariate in my meta-analysis. I understand the following 3 approaches should give the same average effect sizes (as example I'll use the covariate "Parent", consisting of groups "Mother" and "Father"; note, I use a 3-level mixed-effects model in my analysis):

-Run a 3-level mixed-effects model, and use Mother as a reference group, the intercept will give me the average effect size for Mother. I could get the effect size of Father by adding slope1 estimate of those results to the effect size of Mother, or simply run the same model with Father as reference group.
-Run the 3-level mixed effects model while constraining the intercept to 0 and get the effect sizes of Mother and Father both at once.
-Simply run a 3-level mixed-effects model with a data set that ONLY has effect sizes related to Mother, and do the same for Father separately.

The first and second approach mostly give the same or similar effect sizes. The third approach gives different, but more plausible average effect sizes. Which of these methods am I supposed to use to find the average effect sizes of each group with metaSEM?

Thank you kindly in advance Mike.

Best,
Jasper

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Hi Jasper, Thanks for

Hi Jasper,

Thanks for providing a clear and reproducible example.

This is NOT a bug. This is an expected behavior in R. R reads "Parent" from the dataset MA or MB. If "Parent" is not available in MA (or MB), it tries to find "Parent" from the global environment. This issue is related to the variable scoping in R (local vs. global variables). I have also made the same mistake a couple of times. I have attached an example in lm().

For your second question, you may estimate the average effects for all three groups by including all the dummy codes and the "intercept.constraints = 0" argument. Please note that two studies with report=4 was incorrectly included in your analysis. You may need to exclude them before the analysis.

Hope it helps.

Best,
Mike

jasperd's picture
Offline
Joined: 06/28/2016 - 22:32
I had no idea this is what R

I had no idea this is what R does. Bit confusing, it took me a while before I realised why the results seemed strange. Thanks for the detailed example.

As for the average effect sizes, I was aware of the report = 4 studies, I did not know it wrongly influenced the analysis. I'll use the intercept constrained to 0 approach.

Very much appreciated, thanks Mike.

Best,
Jasper