The 'meta' and 'metafor' packages provide this. See also the meta-analysis task
view: https://cran.r-project.org/web/views/MetaAnalysis.html (especially:
"Investigating small study bias").
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician | Department of Psychiatry and
But the second column in coef(summary(ols1)) gives you the SE, so why not use
that? Otherwise, you may want to look into the 'multcomp' package and its
glht() function.
Best,
Wolfgang
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Steven
> Yen
>
Try this:
When fitting the model based on the subset data, fix the variance components to
the values from the model with the categorical moderator. So, in your rma.mv()
call, use:
sigma2=c(0.065, 0.113)
(ideally, use values that are less rounded). The overall effect size estimate
from this
No, this is not possible. But you can just add the weights yourself. One
difficulty here is that you want the weights to the right of the estimates and
corresponding CIs and those are always placed at the right of the figure. One
possibility would be to make the right margin large and then use
ct. Any advice on what
> may be wrong here? Thanks greatly,
> John
>
> On 7 December 2015 at 04:02, Viechtbauer Wolfgang (STAT)
> <wolfgang.viechtba...@maastrichtuniversity.nl> wrote:
> The code you posted is totally mangled up, but it's just what
terson [mailto:john.peterson@gmail.com]
> Sent: Tuesday, December 08, 2015 14:25
> To: Viechtbauer Wolfgang (STAT)
> Cc: R-help@r-project.org
> Subject: Re: [R] metafor package
>
> Hi Dr. Viechtbauer,
>
> The code provided in the metafor projects website for subgroup includes
&g
The code you posted is totally mangled up, but it's just what can be found here:
http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups
If you don't want an overall estimate, just pass the estimates and
corresponding sampling variances to the forest() function (and not the
I would say the issue of how to deal with 'double-zero' studies is far from
settled. For example, under the (non-central) hypergeometric model, studies
with no events have a flat likelihood, so they are automatically excluded. That
may go against our intuition (for various reasons, some of them
Something like this?
http://stats.stackexchange.com/questions/12209/percentage-of-overlapping-regions-of-two-normal-distributions
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician | Department of Psychiatry and
Neuropsychology | Maastricht University | P.O. Box 616 (VIJV1) | 6200 MD
P.O. Box 616 (VIJV1) | 6200 MD
Maastricht, The Netherlands | +31 (43) 388-4170 | http://www.wvbauer.com
> -Original Message-
> From: Marco Colagrossi [mailto:marco.colagro...@gmail.com]
> Sent: Monday, August 31, 2015 18:37
> To: Michael Dewey
> Cc: Viechtbauer Wo
Message-
From: Marco Colagrossi [mailto:marco.colagro...@gmail.com]
Sent: Tuesday, August 25, 2015 17:59
To: Viechtbauer Wolfgang (STAT)
Cc: r-help@r-project.org; Michael Dewey
Subject: Re: [R] Metafor and forest(); not showing 'ilab' and text
Thanks again for your help. I'm sorry to bother
Further comments in line as well.
-Original Message-
From: Michael Dewey [mailto:li...@dewey.myzen.co.uk]
Sent: Tuesday, August 25, 2015 13:23
To: Marco Colagrossi; Viechtbauer Wolfgang (STAT)
Cc: r-help@r-project.org
Subject: Re: [R] Metafor and forest(); not showing 'ilab
I cannot reproduce the issue with 'ilab' not being shown when using 'subset'.
My guess is that the values for 'ilab.xpos' specified are actually outside of
the plotting region. After you have drawn the forest plot, try:
par(usr)[1:2]
to see what the default limits actually are. Then use 'xlim'
Use the 'alim' argument (or the 'at' argument) to restrict the axis limits, so
that CI bounds below/above are indicated with an arrow. And play around with
the 'xlim' argument to make better use of the space in the plotting region. And
the 'ilab' argument allows you to add columns with
Probably these are non-exported functions. Try:
getAnywhere(function name)
Or if you know which package a function comes from:
package name:::function name
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Neuropsychology
School for Mental
This is correct (for getting likelihood ratio tests). Manually setting a
component to 0 is also the same as just leaving out the corresponding random
effect. So, you could also do:
model2 - rma.mv(y, v, random = list(~ 1 | y, ~ 1 | ID), data=dat)
model3 - rma.mv(y, v, random = ~ 1 | y,
Hi, I have a quesite on meta-analysis with 'metafor'.
I would like to calculate the standardized mean difference (SMD), as
Hedges' g, in pre-post design studies.
I have data on baseline (sample size, mean and SD in both the
experimental
and the control group) and at end of treatment (same as
Yes, a comparison of the two objects would tell you what's been added.
An object returned by the trimfill() function also has a vector added to it,
named 'fill', which indicates whether the data (which are stored in the vector
'yi') are observed or augmented values. So, for example:
Dear All,
Just wondering: Is there any official policy on announcing R-related courses
and books on r-help?
I didn't find anything on this in the posting guide, but
http://www.r-project.org/mail.html#instructions says that r-help is, among
other things, for announcements (not covered by
Here is a reproducible bug in nlme (reported in 2008) that still crashes R
today:
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2008q3/001425.html
Seems to be related to memory corruption (as diagnosed by Martin and William
Dunlap at the time):
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Antonello Preti
Sent: Monday, November 24, 2014 00:35
To: r-help@r-project.org
Subject: [R] arcsine transformation with metafor
# I'm trying to adapt to my own data the double
Those hazard ratios and CIs seem a bit strange. On the log-scale, they should
be symmetric, but they are not. Could be due to heavy rounding though. At any
rate, it comes down to this:
hr- c(3.12, 1.15)
ci.lb - c(2.2, 1.03)
ci.ub - c(4.1, 2.6)
meta - c(1,2)
### log-transform hazard ratios
With geometric mean 1 CI /3.92, I assume you mean (upper bound - lower
bound) / 3.92. Two things:
1) That will give you the SE of the mean, not the SD of the observations (which
is what you need as input).
2) Probably the CI for the geometric mean was calculated on the log-scale (as
Michael
Yes, that should be fine.
By the way, you do not have to name the variables 'yi' and 'vi' (if this is
what you meant by 'coding these as yi and vi respectively'). Indeed, the
*argument names* for supplying pre-calculated effect sizes estimates and
corresponding sampling variances are 'yi' and
The warning message pretty much says it: When one of the variances is zero,
then the I^2 statistic (and various other things) cannot be computed, at least
if one sticks to the usual equations/methods. So, if you think the 0 sampling
variances really make sense and you really want to get
Somehow that initial post slipped under the radar for me ...
Yes, I would give the same suggestion as Michael. Besides random effects for
'site', I would also suggest to add random effects for each estimates (as in a
regular random-effects model). So, if you have an 'id' variable that is unique
guess it's a font issue. There may be others that can give more useful
advice.
Best,
Wolfgang
-Original Message-
From: Dietlinde Schmidt [mailto:schmidt.dietli...@web.de]
Sent: Monday, July 07, 2014 10:09
To: Viechtbauer Wolfgang (STAT); r-help@r-project.org
Subject: Re: [R] metafor
I found this:
https://stat.ethz.ch/pipermail/r-help/2012-August/321057.html
So, use this before drawing the forest plot:
options(OutDec=\xB7)
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Psychology
School for Mental Health and Neuroscience
Faculty
From help(forest.rma):
pch -- plotting symbol to use for the observed effect sizes or outcomes. By
default, a solid circle is used. Can also be a vector of values. See points for
other options.
pch.fill -- plotting symbol to use for the effect sizes or outcomes filled in
by the trim and fill
Pass 'slab' to the rma() function instead of the forest() function. Also,
'slab' is evaluated in the data frame passed via the 'data' argument, so no
need to use empa$... And there is a 'subset' argument for rma(). Might as well
use it. This should do it:
resultREML - rma(yi=yi, vi=vi,
Yes, the 'traditional' Egger test is a weighted regression of the effect size
estimates against their standard errors with weights s2/vi, where s2 is a
multiplicative dispersion parameter. This is what you will get with:
regtest(x, model=lm, predictor=sei)
where 'x' is an object returned by
).
Best,
Wolfgang
-Original Message-
From: Verena Weinbir [mailto:vwein...@gmail.com]
Sent: Tuesday, May 06, 2014 15:09
To: Michael Dewey
Cc: Viechtbauer Wolfgang (STAT); r-help@r-project.org
Subject: Re: [R] Metafor: How to integrate effectsizes?
Thank you very much for your
1) There is no function that will do that automatically for you, but it's easy
to do with text() and paste(). If you have fitted a random-effects model with
rma(), then you can find the Q-statistic in res$QE, the I^2 statistic in
res$I2, and probably whatever else you need, and then just
If you know the d-value and the corresponding group sizes for a study, then
it's possible to add that study to the rest of the dataset. Also, if you only
know the test statistic from an independent samples t-test (or only the p-value
corresponding to that test), it's possible to back-compute
I think this may help:
http://www.metafor-project.org/doku.php/tips:handling_missing_data
I am not sure I understand your second question. All studies are shown (for
which the standardized residual can be computed), but since there are so many
studies, these plots are not really all that
You will have to enter the external IP address and then use port forwarding.
Just google for that term (port forwarding) ... For example:
http://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/
http://en.wikipedia.org/wiki/Port_forwarding
Best,
Wolfgang
The standardized mean change using 'change score standardization' is described
in this article:
Gibbons, R. D., Hedeker, D. R., Davis, J. M. (1993). Estimation of effect
size from a series of experiments involving paired comparisons. Journal of
Educational Statistics, 18(3), 271-279.
For a
Often, there is a mix of information available from the various studies that
needs to be used to compute the effect sizes or outcomes to be used for the
meta-analysis. Then you have to 'build up' your dataset in multiple steps and
you cannot bypass first using escalc().
As a very basic
Good advice already from Michael and S Ellison.
I must apologize for the 'hack-job of a function' called forest() in metafor. I
realized a while ago that people would prefer more fine-grained control over
the various elements of the plot (this has come up a few times before). I think
Paul
Regarding your question: Do you want *another* line or do you just want to move
the reference line to the value of the summary estimate? The latter can be done
by passing the value of the summary estimate to the 'refline' argument. If you
want another line, you could just use the abline
The model you are fitting is a random-effects model and does not include any
potential moderators/covariates. Therefore, the estimated intercept of that
model is *the* estimated/predicted (average) effect and it applies to each
study. That is why the predict function also just gives you that
One more thing ... You used the command:
iat_result = rma(yi=Mean, vi=Variance_rounded, ni=N, sei=Std_error,
slab=Study_Name, subset=(Country == AUT), data=cma_iat, method=HS)
This probably does not do what you want it to do. First of all, if you specify
vi, there is no need to specify sei (or
Wolfgang (STAT)
wolfgang.viechtba...@maastrichtuniversity.nl
To: petre...@unina.it petre...@unina.it, r-help@r-project.org
r-help@r-project.org
Subject: Re: [R] metafor escalc(measure=SMCC)
Message-ID:
077E31A57DA26E46AB0D493C9966AC730D9925568A@UM-
MAIL4112.unimaas.nl
Dear Mario,
You can always just inspect the code:
escalc.default
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Psychology
School for Mental Health and Neuroscience
Faculty of Health, Medicine, and Life Sciences
Maastricht University,
Can you provide a minimal and self-contained example showing/illustrating what
you have done and would like to test? Based on the information provided, I
could only make a vague suggestion along the lines of: You could include dose
in an appropriate meta-regression model and then examine
Wolfgang (STAT); r-help@r-project.org
Subject: Re: [R] Meta-analysis on a repeated measures design with multiple
trials per subject using metafor
Dear Michael and other readers,
Please see below for my answers to your questions about my data.
On 07/06/2013 02:56 PM, Michael Dewey wrote
Dear Marc,
Let me see if I understand the type of data you have. You say that you have 5
experiments. And within each experiment, you have n subjects and for each
subject, you have data in the form described in your post. Now for each
subject, you want to calculate some kind of measure that
I have come across this issue many times. I have yet to find a pattern in what
causes this.
At least I can offer a workaround. Instead of using Save As to create the
pdf, what I do is Print with Adobe PDF as the printer. This gets rid of
those lines and the resulting pdf looks just as nice.
...@gmail.com]
Sent: Wednesday, May 22, 2013 20:38
To: Viechtbauer Wolfgang (STAT); r-help
Subject: Re: RE: [R] using metafor for meta-analysis of before-after
studies (escalc, SMCC)
Dear Dr. Viechtbauer:
Thank you very much for sparing your precious time to answer my question.
I still want
Dear Branwen,
This means that your design matrix is not of full rank (in a more recent
version of the metafor package, the error message is a bit more informative;
i.e., please upgrade). Since continent is a factor, this should imply that
one of the levels never actually occurs, leading to a
Please see my answers below.
Best,
Wolfgang
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Moon Qiang
Sent: Thursday, May 16, 2013 19:12
To: r-help
Subject: [R] using metafor for meta-analysis of before-after studies
See comments below.
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Psychology
School for Mental Health and Neuroscience
Faculty of Health, Medicine, and Life Sciences
Maastricht University, P.O. Box 616 (VIJV1)
6200 MD Maastricht, The
Dear Owen,
What is your definition of multivariate analysis? Do you mean: A
meta-regression model with more than one predictor/moderator? In that case,
yes, metafor handles that. Usually, this is referred to as multiple
regression (as opposed to simple regression with a single predictor) --
Same idea, but just using base graphics and using an x-axis with log units:
library(metafor)
data(dat.bcg)
res - rma(measure=OR, ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg,
slab=paste(dat.bcg$author, dat.bcg$year, sep=, ))
forest(res, cex=.9, at=log(c(.05, .25, 1, 4)), xlim=c(-10,7),
Absolutely correct. The documentation wasn't clear on that. Changed for the
next version of the package. And the escalc() function now no longer checks for
sd2i, since it is not needed anyway (for SMCR). For now, you will just have
to set sd2i to something (e.g., 0).
Thanks for bringing this
Please see my comments below.
Best,
Wolfgang
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Rachel Slatyer
Sent: Wednesday, February 27, 2013 06:00
To: R-help@r-project.org
Subject: [R] metafor - interpretion of QM in
Dear Alma,
either there is a whole lot of miscommunicaton here, or you (and your
supervisor) are way in over your head.
You say that you are working with Cohen's d values. And you mentioned CMA. So,
let me ask you some questions:
1) Has CMA computed those d values for you?
2) If yes, what
Hello Christian,
First of all, it's good to see that you are well aware of the fact that lme()
without lmeControl(sigma=1) will lead to the estimation of the residual
variance component, which implies that the sampling variances specified via
varFixed() are only assumed to be known up to a
As Michael already mentioned, the error:
Error in qr.solve(wX, diag(k)) : singular matrix 'a' in solve
indeed indicates that your design matrix is not of full rank (i.e., there are
linear dependencies among your predictors). With this many factors in the same
model, this is not surprising if k
Dear Brian,
At the moment, the various forest() functions are not meant to accept 'col' as
an argument. While it is indeed possible to specify a 'col' argument, it will
be passed on via the ... argument to further functions within forest() and this
is where things can go awry.
To give a more
Dear Xudong,
First of all, most attachments are stripped on r-help -- yours didn't make it
through either. Since you sent a separate e-mail to me personally (including
the attachment), I can see what you want to accomplish, but let's keep this on
the list.
Second, your mail to r-help
There are multiple issues here. First of all, you should simplify your code to:
metacor(cor, n, title=title, complab=comparison, outclab=outcome)
The rest of your call to metacor() is just using the defaults, so no need to
repeat all of that in your call and apparently one of these arguments is
Dear Romita,
It is not quite clear to me what exactly you want the graph to look like. What
do you mean by plots of the unadjusted and adjusted models?
In general though, it sounds to me as if the graph you have in mind is rather
complex. It may be possible to accomplish this with the forest()
Dear Chunyan,
One possibility would be to use the harmonic mean of the person-time at risk
values. You will have to do this manually though at the moment. Here is an
example:
### let's just use the treatment group data from dat.warfarin
data(dat.warfarin)
dat - escalc(xi=x1i, ti=t1i,
I was not sure who I should contact about this, so I am posting this here.
There are a few broken links on the R website.
1) http://www.r-project.org/search.html - link to the Nabble R Forum. I belive
the correct/new URL should be: http://r.789695.n4.nabble.com/
2)
Dear Meghan,
you can do this with rma() in metafor, but you will have to set up the loop
yourself. Here is an example. First, I need to simulate some data:
library(metafor)
library(MASS)
k - 40
As usual, Michael was faster than I in responding. Let me add a few thoughts of
my own. See comments below in text.
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Psychology
School for Mental Health and Neuroscience
Faculty of Health,
The pooled standard deviation is calculated exactly how you describe it. There
are, however, two differences between your approach and the way escalc()
computes the SMD and corresponding sampling variance:
1) Instead of the equation for approximating the correction factor (J),
escalc() uses
I had noticed this oversight a while ago. In an updated version of the metafor
package (hopefully to be released in the near future), the argument will be
called maxiter (as intended). Using maxit will then work as well, due to
partial matching.
Thanks for bringing this to my attention though.
This is not an odds ratio. You simply calculated 27/131 = .206, which is the
odds of having the disease given 40%. You can calculate a confidence interval
for this with:
exp(log(27/131) - 1.96 * sqrt(1/27 - 1/(27+131)))
exp(log(27/131) + 1.96 * sqrt(1/27 - 1/(27+131)))
which yields (0.146,
There is a simple explanation:
1) The command:
factor(ftype)
does not actually turn 'ftype' permanently into a factor, since you are not
re-assigning it back to the object 'ftype'. You have to use:
ftype - factor(ftype)
2) If you want to use the formula interface for specifying moderators,
Just to follow up on what Michael wrote:
I cannot reproduce that error. For example, this all works as intended:
data(dat.bcg)
dat - escalc(measure=RR, ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg,
append=TRUE)
rma(yi, vi, mods = ~ alloc, data=dat) ### 'alloc' automatically converted to a
Just to follow up on that: You can use the 'btt' argument in the rma() function
to specify which coefficients to include in the QM test. For example:
data(dat.bcg)
dat - escalc(measure=RR, ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg,
append=TRUE)
rma(yi, vi, mods = ~ factor(alloc) + year +
Are you sure that output was produced by: rma(yi, vi, data=dat,
mods=cbind(LateralWedge,Dome,Complex))?
Because your model does not have an intercept, which suggests that you actually
used:
rma(yi, vi, data=dat, mods=cbind(LateralWedge,Dome,Complex), intercept=FALSE)
In that case, the
Dear Dushanthi,
Please keep your e-mails on the R-Help list, where Michael has already given
you some excellent advice. As Michael already explained, metafor can handle
proportions, but does not have any specific functionality for categorical
variables with more than 2 levels (at the moment).
Just replace the fixed y coordinate values in the text() calls with something
that will change appropriately with the number of studies/effects included in
the plot. For example:
text(c(-9.5,-8,-6,-4.5), res$k+2, c(TB+, TB-, TB+, TB-))
text(c(-8.75,-5.25), res$k+3, c(Vaccinated, Control))
I think Michael already gave you some really good hints. To add a bit more
details to this, first of all, I suggest to use:
q2 - rma(yi, vi, mods=cbind(grupo), data=qim)
forest(q2, transf=transf.ztor, digits=3, alim=c(0,1), refline=.5, addfit=FALSE)
so that the fitted values for that
At the moment, there is no possibility of specifying the weights with the rma()
function. While the main model fitting part could be easily adapted to
incorporate user-specified weights, the problem comes in with all the
additional statistics that can be computed based on a fitted model. How
Michael just provided a good suggestion, using the subset argument to make sure
that you are really using the same data in both analyses.
However, I would not expect the results to be exactly the same anyway. Remember
that these are random/mixed-effects models you are using. So, when you use
To add to Michael's response:
There are several things you can do:
1) If the dependent variable is the same in each study, then you could conduct
the meta-analysis with the (raw) mean changes, i.e., yi = m1i - m2i, where m1i
and m2i are the means at time 1 and 2, respectively. The sampling
I do not see any major difficulties with this case either. Suppose you have OR
= 1.5 (with 95% CI: 1.19 to 1.90) indicating that the odds of a particular
outcome (e.g., disease) is 1.5 times greater when the (continuous) exposure
variable increases by one unit. Then you can back-calculate the
...@gmail.com [mailto:mp.sylves...@gmail.com]
Sent: Thursday, April 05, 2012 15:23
To: Viechtbauer Wolfgang (STAT); Marie-Pierre Sylvestre
Cc: r-help@r-project.org; Thomas Lumley
Subject: Re: RE: [R] meta-analysis, outcome = OR associated with a
continuous independent variable
For some reason I
Dear Faiz,
in principle, you can include whatever moderators you want in a meta-regression
model. A technical issue here is that the two follow-up variables are probably
strongly correlated, so this may create issues with the model fitting and it
also complicates the interpretation of the
I do not know how Metawin calculates the confidence interval for the QQ-plot.
The manual lists Chambers, Cleveland, Kleiner, and Tukey (1983) as a reference
for the method used. Not sure whether that is the classical confidence
interval.
The method used in metafor is based on Cook and Weisberg
Yes, I forgot to divide the weights by the sum of the weights (and multiply by
100) for weights.rma.mh(). This bug was pointed out to me a few weeks ago and
this will be changed in the next version of the package.
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of
Here is an example. It requires a bit of extra work, but that's the beauty of R
-- you can essentially customize a graph to your taste with low-level
functions. I also added the prediction interval using the addcred argument (as
suggested by Michael), since it gives the same information as that
Essentially, this is a side-by-side forest plot, where the plot on the left is
for sensitivity and the plot on the right is for specificity. For 2x2 table
data from diagnostic studies, it is easy to calculate the sensitivity and
specificity values (and corresponding sampling variances) by hand.
I assume you mean Cohen's kappa. This is not what the OP is asking about. The
OP wants to know how to test for a difference in the proportions of 1's.
Cohen's kappa will tell you what the level of agreement is between the two
tests. This is something different.
Also, the OP has now clarified
Hello Andrew,
Take a look at the following:
predict(model1, addx=T)
predict(model2, addx=T)
predict(model3, addx=T)
As you can see, the factor was turned into dummy variables. However, the
predict.rma() function does not expand a factor passed via newmods into the
corresponding dummy
Acutally,
?mcnemar.test
since it is paired data.
Best,
Wolfgang
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Bert Gunter
Sent: Wednesday, September 07, 2011 15:34
To: John Sorkin
Cc: r-help@r-project.org
Subject: Re:
, 2011 16:47
To: Viechtbauer Wolfgang (STAT)
Cc: r-help@r-project.org; John Sorkin
Subject: Re: [R] suggestion for proportions
Wolfgang:
On Wed, Sep 7, 2011 at 7:28 AM, Viechtbauer Wolfgang (STAT)
wolfgang.viechtba...@maastrichtuniversity.nl wrote:
Acutally,
?mcnemar.test
since
See ?par and its mar argument.
Could you tell me also how to change the size of the chart? There is not
enough space below the chart to add the arrows!
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
...@gmail.com]
Sent: Thursday, August 25, 2011 10:57
To: Viechtbauer Wolfgang (STAT)
Cc: r-help@r-project.org; Bernd Weiss
Subject: Re: [R] Change color in forest.rma (metafor)
Thank you for your attention and help!
In this way I get the diamond coloured, but actually I would have the
squares
Another way would be to consider this as a path model and use the sem or lavaan
package to fit this model. Here is an example:
x - rnorm(1000)
e1 - rnorm(1000)
e2 - e1 + rnorm(1000)
e1 - e1 + rnorm(1000)
y1 - 2 + 1*x + e1
y2 - 4 + 2*x + e2
dat - data.frame(x, y1, y2)
model - 'y1 ~ x
Thank you, Bernd, for looking into this.
Yes, at the moment, the color of the summary estimate for models without
moderators is hard-coded (as black). I didn't think people may want to change
that. I guess I was wrong =)
A dirty solution for the moment is to add:
addpoly(dfs, efac=6, row=-1,
Dear Emilie,
Regarding your questions:
1) It's not the weighting that is the main issue when you do not have the SDs.
The problem is that you need the SDs to calculate the sampling variances of the
mean differences (I assume that this is your outcome measure for the
meta-analysis). Those are
Dear Jokel,
If a moderator has 4 levels, then you need 3 dummy variables (one of the levels
will become your reference level, so you do not need a dummy for that one).
You can do the dummy-coding yourself or let R handle it. For example, if the
moderator is called catmod, then:
rma(yi, vi,
Dear Jokel,
Unfortunately, this won't work. The derivation of the equation given in the
Handbook shows why this is so. First of all, note that
d = (m1 - m2) / sp,
where m1 and m2 are the means of the two groups and sp is the pooled SD. The
two independent samples t-test (assuming
And at that point, one is essentially doing a meta-analysis. For example:
library(metafor)
ri - c(.5, .4)
ni - c(40, 25)
res - rma(ri=ri, ni=ni, measure=ZCOR, method=FE)
predict(res, transf=transf.ztor, digits=2)
pred se ci.lb ci.ub
0.46 NA 0.24 0.64
You also get the CI (in addition to
Dear Jokel,
Right now, none of the functions return that information. But it's easy to
calculate those CIs by hand (simply take yi +- 1.96 sqrt(vi) and apply, if
needed, some appropriate transformation). For example:
data(dat.bcg)
dat - escalc(measure=RR, ai=tpos, bi=tneg, ci=cpos, di=cneg,
1 - 100 of 167 matches
Mail list logo