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

Michael Dewey lists at dewey.myzen.co.uk
Tue Sep 1 09:43:45 CEST 2015


Dear Navien

If anyone on the list is going to help you you need to

1 - provide a minimal, self-contained and reproducible example of your 
problem
2 - start a new thread

Note that in general list members provide help about R rather than 
statistics for which there are other lists.

On 31/08/2015 18:29, Navien wrote:
> Dear Wolfgang,
>
> Kindly please i have an issue with R code could you please help me.
>
> Best Regards
>
> On Mon, Aug 31, 2015 at 6:24 PM, Viechtbauer Wolfgang (STAT)-2 [via R] <
> ml-node+s789695n4711682h19 at n4.nabble.com> wrote:
>
>> Have you read help(rma.mv)? It describes in detail what "random = ~ 1 |
>> author" does. Also, I think you may find some of these useful:
>>
>>
>> http://www.metafor-project.org/doku.php/analyses#multivariate_multilevel_meta-analysis_models
>>
>> Especially:
>> http://www.metafor-project.org/doku.php/analyses:konstantopoulos2011
>>
>> Using "random = ~ 1 | author" is likely to be insufficient. You also need
>> to add random effects at the observation level.
>>
>> Best,
>> Wolfgang
>>
>> --
>> Wolfgang Viechtbauer, Ph.D., Statistician | Department of Psychiatry and
>>
>> Neuropsychology | Maastricht University | P.O. Box 616 (VIJV1) | 6200 MD
>>
>> Maastricht, The Netherlands | +31 (43) 388-4170 | http://www.wvbauer.com
>>
>>
>>> -----Original Message-----
>>> From: Marco Colagrossi [mailto:[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4711682&i=0>]
>>> Sent: Monday, August 31, 2015 18:37
>>> To: Michael Dewey
>>> Cc: Viechtbauer Wolfgang (STAT); [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4711682&i=1>
>>> Subject: Re: [R] Metafor and forest(); not showing 'ilab' and text
>>>
>>> The solution that you proposed works perfectly, thank you very much.
>>>
>>> I'll wait for Wolfgang answer as I'm having few doubts about the models.
>>>
>>> Thanks
>>>
>>> On 31 August 2015 at 18:34, Michael Dewey <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4711682&i=2>>
>>> wrote:
>>>> Comments in line
>>>>
>>>> On 31/08/2015 16:08, Marco Colagrossi wrote:
>>>>>
>>>>> Thanks for your help,
>>>>>
>>>>> I got the mistake I was making and I managed to find a solution
>>>>> regarding those graphs; I don't want to abuse of your patience but I
>>>>> have three further questions:
>>>>>
>>>>> 1. Always regarding the forest plots, it is possible to make a
>>>>> cross-subset? I try to explain my self better; I have one dummy
>>>>> variable called pub and another variable called SIMiv that can take
>>>>> the values of "share", "loan", "number" and "duration". How can I
>>>>> subset my sample so that the forest shows only (for example) studies
>>>>> when the dummy takes the value of 1 and the SIMiv variable takes the
>>>>> values of "share" and "loan"?
>>>>> Something like this:
>>>>> forest(pc, var, ci95m, ci95p, slab = authoryear2, psize=1,
>>>>> subset=(pub==1, SIMiv=("share", "loan", "duration"))
>>>>>
>>>>
>>>> Do you not want something like
>>>> (pub == 1) & (SIMIv %in% c("share", "loan", "duration"))
>>>>
>>>>
>>>>> 2. I have few doubts regarding the multilevel modeling;
>>>>>       rma.mv(pc, var, random = ~ 1 | author, data=codebook)
>>>>>      if I'm correct this should be a multilevel model nested at
>>> "author"
>>>>> level; what I cannot understand If it is a varying intercept
>>>>> (Y=A+BjX), a varying slope (Y=Aj+BX) or a varying intercept&slope
>>>>> model (Y=Aj+BjX). Are there the formulas for it somewhere? So far I
>>>>> only found the formulas for the estimators included in the metafor
>>>>> package.
>>>>>
>>>>
>>>> I think it a random intercept but Wolfgang may correct me there.
>>>>
>>>>
>>>>> 3. metareg1 <- rma.mv(pc, var, random = ~ 1 | author, mods = ~ pub +
>>>>> SIMiv, data=codebook)
>>>>> Again, if I'm correct this should be a multilevel meta regression
>>>>> (correct me if I'm wrong); I have the same doubts as before.
>>>>>
>>>>> Thank you again
>>>>>
>>>>> Marco
>>>>>
>>>>> On 25 August 2015 at 19:24, Michael Dewey <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4711682&i=3>>
>>> wrote:
>>>>>>
>>>>>> Dear Marco
>>>>>>
>>>>>> When you change xlim it increases the width of the forest plot in
>> the
>>>>>> sense
>>>>>> you describe. It does not push your text out of the way to make
>> space
>>> for
>>>>>> it
>>>>>> but instead overprints it. You may like to use alim to truncate your
>>>>>> confidence interval whiskers to fit within the space you see or make
>>> your
>>>>>> labels shorter.
>>>>>>
>>>>>>
>>>>>> On 25/08/2015 17:25, Marco Colagrossi wrote:
>>>>>>>
>>>>>>>
>>>>>>> I think I've not explained myself well. When I say "the width of
>> the
>>>>>>> forest plot" I mean the region above the observed outcome, the
>>>>>>> "actual" forest plot, not the plot as a whole. Even if I change
>>> values
>>>>>>> for Xlim, cex or ilab.xpos the width of that particular region
>>> within
>>>>>>> the plot doesn't change.
>>>>>>>
>>>>>>> Best,
>>>>>>>
>>>>>>> Marco
>>>>>>>
>>>>>>> On 25 August 2015 at 18:11, Viechtbauer Wolfgang (STAT)
>>>>>>> <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4711682&i=4>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> The 'xlim' argument does not change the actual width of the
>>> plotting
>>>>>>>> device. For that, you need to use the 'width' argument with
>>> whatever
>>>>>>>> device
>>>>>>>> you are actually using. You can then use the 'xlim' argument to
>>> create
>>>>>>>> appropriate spacing to the left/right of the part of the plot that
>>>>>>>> shows the
>>>>>>>> estimates and their CIs. Within that space, you can then add
>>> additional
>>>>>>>> columns with the 'ilab' argument. It's up to you to find an
>>> appropriate
>>>>>>>> combination of plotting device width, character/symbol expansion
>>> factor
>>>>>>>> ('cex' argument), 'xlim' values, and 'ilab.xpos' values to create
>> a
>>>>>>>> nice
>>>>>>>> looking plot that has no overlapping text and no excessive white
>>> space.
>>>>>>>> An
>>>>>>>> example is this:
>>>>>>>>
>>>>>>>>
>>>>>>>> http://www.metafor-
>>> project.org/doku.php/plots:forest_plot_with_subgroups
>>>>>>>>
>>>>>>>> Note that it took me dozens of iterations to create that plot. You
>>> just
>>>>>>>> have to start experimenting.
>>>>>>>>
>>>>>>>> Best,
>>>>>>>> Wolfgang
>>>>>>>>
>>>>>>>>> -----Original Message-----
>>>>>>>>> From: Marco Colagrossi [mailto:[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4711682&i=5>]
>>>>>>>>> Sent: Tuesday, August 25, 2015 17:59
>>>>>>>>> To: Viechtbauer Wolfgang (STAT)
>>>>>>>>> Cc: [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4711682&i=6>; Michael Dewey
>>>>>>>>> Subject: Re: [R] Metafor and forest(); not showing 'ilab' and
>> text
>>>>>>>>>
>>>>>>>>> Thanks again for your help. I'm sorry to bother you but I don't
>>> get
>>>>>>>>> how to widen the forest plot; if I try to change the values of
>>> xlim or
>>>>>>>>> the ilab.xpos values the width of the forest plot region does not
>>>>>>>>> change, but only moves on the graphs. What I'm I missing?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1,
>>>>>>>>> subset=(pub==1),
>>>>>>>>>           xlim = c(-16, 6),
>>>>>>>>>           ilab = data.frame(SIMdv, SIMiv),
>>>>>>>>>           ilab.xpos = c(-7.5, -5.5), cex = 0.75)
>>>>>>>>> op <- par(cex=.75, font=2)
>>>>>>>>>          text(c(-7.5, -5.5), 54, c("DV", "IV"))
>>>>>>>>>          text(-16,                54, "Author(s) and Year",
>>> pos=4)
>>>>>>>>>          text(6,                  54, "Outcome [95% CI]", pos=2)
>>>>>>>>> par(op)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> par("usr")[1:2]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> [1] -16   6
>> ______________________________________________
>> [hidden email] <http:///user/SendEmail.jtp?type=node&node=4711682&i=7>
>> mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://r.789695.n4.nabble.com/Metafor-and-forest-not-showing-ilab-and-text-tp4711432p4711682.html
>> To start a new topic under R help, email
>> ml-node+s789695n789696h53 at n4.nabble.com
>> To unsubscribe from R, click here
>> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=789695&code=bmF2aW5nMnVrQGdtYWlsLmNvbXw3ODk2OTV8LTczNzQxMTY0Ng==>
>> .
>> NAML
>> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Metafor-and-forest-not-showing-ilab-and-text-tp4711432p4711683.html
> Sent from the R help mailing list archive at Nabble.com.
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-help mailing list