Re: [R] funnel plot asymmetry

2016-08-01 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] t-test for regression estimate

2016-06-28 Thread Viechtbauer Wolfgang (STAT)
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 >

Re: [R] Mean effect size in meta-analysis using Metafor

2015-12-21 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] R: forest plot metafor

2015-12-12 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor package

2015-12-08 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor package

2015-12-08 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor package

2015-12-07 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor - Meta-Analysis of rare events / beta-binomial regression

2015-11-27 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] How to calculate the shared area of 2 plots?

2015-10-31 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor and forest(); not showing 'ilab' and text

2015-08-31 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor and forest(); not showing 'ilab' and text

2015-08-25 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor and forest(); not showing 'ilab' and text

2015-08-25 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor and forest(); not showing 'ilab' and text

2015-08-24 Thread Viechtbauer Wolfgang (STAT)
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'

Re: [R] Altering Forest plot in Metafor package

2015-07-14 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Looking up the code for a function

2015-05-06 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor - rma.mv function - variance components

2015-04-21 Thread Viechtbauer Wolfgang (STAT)
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,

Re: [R] 'metafor' - standardized mean difference in pre-post design studies

2015-04-14 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Trim and fill procedure

2015-04-07 Thread Viechtbauer Wolfgang (STAT)
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:

[R] Course and book announcements on r-help

2015-03-13 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] How to have NLME return when convergence not reached

2014-12-03 Thread Viechtbauer Wolfgang (STAT)
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):

Re: [R] arcsine transformation with metafor

2014-11-24 Thread Viechtbauer Wolfgang (STAT)
-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

Re: [R] Comparing summary hazard ratios in meta-analysis

2014-11-21 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor - code for analysing geometric means

2014-11-14 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Using compute.es and metafor together

2014-10-03 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor -can't calculate heterogeneity with non-positive sampling variances

2014-08-27 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Correlating multiple effect sizes within a study to study-level predictors: metafor package

2014-07-14 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor package: changing decimal in forest plot to midline decimal

2014-07-07 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor package: changing decimal in forest plot to midline decimal

2014-07-05 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor: Strange Trim and Fill Outcome?

2014-05-26 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor: forest plot for subset

2014-05-26 Thread Viechtbauer Wolfgang (STAT)
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,

Re: [R] Help conduction Egger's test

2014-05-12 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor: How to integrate effectsizes?

2014-05-06 Thread Viechtbauer Wolfgang (STAT)
). 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

Re: [R] matafor package: adding additional information under a forest plot

2014-05-03 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor: How to integrate effectsizes?

2014-04-25 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor - rstudent(res) - omitted rows

2014-04-22 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] R, RStudio, and a server for my iPad.

2014-04-12 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] {metafor} variance explaination for paired pre-test/posttest

2014-04-08 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor - why use escalc?

2014-03-14 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor package

2014-02-12 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] refline in forest() {metafor}

2013-12-12 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] How do I print predicted effect sizes in forest plot?

2013-12-06 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] How do I print predicted effect sizes in forest plot?

2013-12-06 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor escalc(measure=SMCC)

2013-11-21 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor escalc(measure=SMCC)

2013-11-19 Thread Viechtbauer Wolfgang (STAT)
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,

Re: [R] Dose-response relationship using metafor?

2013-09-19 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Meta-analysis on a repeated measures design with multiple trials per subject using metafor

2013-07-08 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Meta-analysis on a repeated measures design with multiple trials per subject using metafor

2013-07-04 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Strange behaviour of R graphics copied to PowerPoint

2013-06-03 Thread Viechtbauer Wolfgang (STAT)
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.

Re: [R] using metafor for meta-analysis of before-after studies (escalc, SMCC)

2013-05-23 Thread Viechtbauer Wolfgang (STAT)
...@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

Re: [R] metafor matrix error

2013-05-22 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] using metafor for meta-analysis of before-after studies (escalc, SMCC)

2013-05-21 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Error when adding lines to a plot using the mixed-effect model and metafor package

2013-03-20 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor - multivariate analysis

2013-03-15 Thread Viechtbauer Wolfgang (STAT)
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) --

Re: [R] Create patterns within a plot?

2013-03-14 Thread Viechtbauer Wolfgang (STAT)
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),

Re: [R] Metafor SMCR Pre-Post Effect sizes

2013-03-04 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor - interpretion of QM in mixed-effects model with factor moderator

2013-02-27 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] dummy encoding in metafor

2013-01-28 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] mixed effects meta-regression: nlme vs. metafor

2013-01-23 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] dummy encoding in metafor

2013-01-21 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] package metafor: error when setting 'col' and 'at' for a forest plot

2013-01-07 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] a problem for metafor package

2012-12-31 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Help: Meta-analysis with metacor

2012-11-20 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] combine unadjusted and adjusted forest plots

2012-10-18 Thread Viechtbauer Wolfgang (STAT)
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()

Re: [R] What to use for ti in back-transforming summary statistics from F-T double square-root transformation in 'metafor'

2012-09-28 Thread Viechtbauer Wolfgang (STAT)
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,

[R] Broken Links on http://www.r-project.org

2012-09-26 Thread Viechtbauer Wolfgang (STAT)
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)

Re: [R] using alternative models in glmulti

2012-09-12 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor package: study level variation

2012-09-10 Thread Viechtbauer Wolfgang (STAT)
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,

Re: [R] (Slight) calculation discrepancy in escalc (metafor package)

2012-08-21 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Error in metafor documentation on maximum iterations

2012-08-16 Thread Viechtbauer Wolfgang (STAT)
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.

Re: [R] What package to use to calculate odds ratio and the confidence interval?

2012-08-14 Thread Viechtbauer Wolfgang (STAT)
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,

Re: [R] Factor moderators in metafor

2012-08-09 Thread Viechtbauer Wolfgang (STAT)
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,

Re: [R] metafor- interpretation of moderators test for raw proportions

2012-08-04 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Metafor package: Including multiple (categorical) predictors

2012-08-03 Thread Viechtbauer Wolfgang (STAT)
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 +

Re: [R] metafor- interpretation of moderators test for raw proportions

2012-08-03 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor package, proportions: single groups wrt to a categorical dependent variableā€

2012-08-01 Thread Viechtbauer Wolfgang (STAT)
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).

Re: [R] Annotate forest plot 'forest.rma()' for meta-analysis with metafor package

2012-07-25 Thread Viechtbauer Wolfgang (STAT)
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))

Re: [R] tweaking forest plot (metafor package)

2012-07-19 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] package metafor: specify weights?

2012-05-24 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor

2012-05-07 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] using metafor for meta-analysis of before-after studies

2012-04-05 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] meta-analysis, outcome = OR associated with a continuous independent variable

2012-04-05 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] meta-analysis, outcome = OR associated with a continuous independent variable

2012-04-05 Thread Viechtbauer Wolfgang (STAT)
...@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

Re: [R] Metafor: Moderator variables for each study arm

2012-02-21 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] meta-analysis normal quantile plot metafor

2012-01-16 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] metafor: weights computation in Mantel-Haenszel method

2012-01-15 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Overlaying density plot on forest plot

2011-12-12 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Sensitivity and Specificity Forest Plots

2011-11-22 Thread Viechtbauer Wolfgang (STAT)
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.

Re: [R] suggestion for proportions

2011-09-08 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] predict.rma (metafor package)

2011-09-08 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] suggestion for proportions

2011-09-07 Thread Viechtbauer Wolfgang (STAT)
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:

Re: [R] suggestion for proportions

2011-09-07 Thread Viechtbauer Wolfgang (STAT)
, 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

Re: [R] Change color in forest.rma (metafor)

2011-08-29 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Change color in forest.rma (metafor)

2011-08-25 Thread Viechtbauer Wolfgang (STAT)
...@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

Re: [R] Bivariate normal regression in R

2011-08-25 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Change color in forest.rma (metafor)

2011-08-24 Thread Viechtbauer Wolfgang (STAT)
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,

Re: [R] questions about metafor package

2011-08-17 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Main-effect of categorical variables in meta-analysis (metafor)

2011-08-05 Thread Viechtbauer Wolfgang (STAT)
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,

Re: [R] Converting F-value from ANOVA to cohen's d in meta-analysis (metafor-package)

2011-07-27 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] compute the mean of two (or more) correlations

2011-07-26 Thread Viechtbauer Wolfgang (STAT)
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

Re: [R] Extract confidence intervals from rma object (metafor package)

2011-07-18 Thread Viechtbauer Wolfgang (STAT)
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   2   >