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

2015-09-01 Thread Michael Dewey

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+s789695n4711682...@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]

]

Sent: Monday, August 31, 2015 18:37
To: Michael Dewey
Cc: Viechtbauer Wolfgang (STAT); [hidden email]



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]

>

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
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]

>

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]

> 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


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

2015-09-01 Thread Marco Colagrossi
I did read the help(rma.mv) and I also had look at the analysis by
Konstantopoulos (2011) in the past few days. You have to apologize me
but is the first meta analysis I'm trying to carry on, it is the first
I'm working on R and moreover the terminology here is somehow
different (and confusing) with respect to the terminology I was used
in panel data analysis.

It looks to me - correct me if I'm wrong - that a model such:

 rma.mv(pc, var, random = ~ 1 | author, data=codebook)

or

 rma.mv(pc, var, random = ~ 1 | author, mods = ~ pub + SIMiv, data=codebook)

it is a varying intercept model (using Gelman-Hill Yi = Aji+BXi+Ei).
Why do you say that "Using "random = ~ 1 | author" is likely to be
insufficient. You also need to add random effects at the observation
level"? Could you please walk me through what you mean by that?

I'll (try to) explain to you what I'm doing here so you might be able
to help me out.
I'm carrying on a meta-analysis (and ultimately, few meta-regressions)
of the relationship between firm performances and bank-firm
relationship. Since I have different proxies for the latter, I
computed as effect size a raw partial correlation, a continuous
Fisher’s z-score and the one-tail p-value as a continuous
interpretation of the direction and the significance of an effect
size.

The number of studies in my meta-analysis is 29, but most of them have
multiple cases so, ultimately, I have 98 different cases. All of the
29 studies have repeated yearly observation in the same country for
different time span; let's say one from 1985 to 1991 in Spain, one
from 1987 to 1999 in China, one from 1981 to 2002 in the US and so on.
Even in case in which two different study investigates the same
country and some of the years in the time span overlaps I'm sure that
their population is drawn from different samples.

My idea was too confront what in econometrics is called a study-fixed
effect (or author fixed effect since authors have no more than one
study in my analysis), that is:

   rma(pc, var, mods = ~ I(study), data=codebook)

With a multilevel model, in order to account for the fact that
observation from the same study are not independent.

May I have your opinion on what I'm trying to do here guys?
Do you think I should take into account also a autoregressive
structure over time and correct that with struct="HAR" ?

Sorry for the long mail, I wanted to explain as better as possible,
and thank you again for your help, It is incredibly appreciated.

Marco

On 31 August 2015 at 19:28, Viechtbauer Wolfgang (STAT)
 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:marco.colagro...@gmail.com]
>> Sent: Monday, August 31, 2015 18:37
>> To: Michael Dewey
>> Cc: Viechtbauer Wolfgang (STAT); r-help@r-project.org
>> 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 
>> 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, 

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

2015-08-31 Thread Marco Colagrossi
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"))

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
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.

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  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)
>>  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: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 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
>
>
> --
> Michael
> http://www.dewey.myzen.co.uk/home.html

__
R-help@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.


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

2015-08-31 Thread Michael Dewey

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
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  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)
 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: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 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



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




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

__
R-help@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.


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

2015-08-31 Thread Marco Colagrossi
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  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
>> 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  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)
  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: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 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, 

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

2015-08-31 Thread Viechtbauer Wolfgang (STAT)
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:marco.colagro...@gmail.com]
> Sent: Monday, August 31, 2015 18:37
> To: Michael Dewey
> Cc: Viechtbauer Wolfgang (STAT); r-help@r-project.org
> 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 
> 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
> >> 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 
> 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)
>   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:
> >
> >
> > 

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

2015-08-31 Thread Navien
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+s789695n4711682...@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]
> ]
> > Sent: Monday, August 31, 2015 18:37
> > To: Michael Dewey
> > Cc: Viechtbauer Wolfgang (STAT); [hidden email]
> 
> > 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]
> >
> > 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
> > >> 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]
> >
> > 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]
> > 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 

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

2015-08-25 Thread Viechtbauer Wolfgang (STAT)
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: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 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
__
R-help@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.


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

2015-08-25 Thread Marco Colagrossi
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

On 25 August 2015 at 15:54, Viechtbauer Wolfgang (STAT)
wolfgang.viechtba...@maastrichtuniversity.nl wrote:
 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' and text

 Hello Marco

 Comments in line again

 On 24/08/2015 18:49, Marco Colagrossi wrote:
  I tried to upload the file once again. I tweaked it a bit, now my code
 is:
 
  forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1,
 subset=(pub==1),
  xlim = c(-16, 6),
  ilab = cbind(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)
 
  I managed to show both the Ilab argument and the text above. I still
  have 3 issues:
  - now the forest plot is too narrow - that is, pretty unreadable;

 You need to re-read Wolfgang's advice again. The forest function tells
 you what values of xlim it used and you can then adjust them to suit.
 This will take a few attempts in my experience.

  - I cannot still export it properly, as shown in the enclosed .png

 It looked correctly exported to me. One comment, do you really need the
 complete citation of each study? Most of the forest plots I see as a
 reviewer just use the first author name and the year. This would
 potentially give you a lot more space.

 Also, if you have lots of outcomes, you may need to increase the height of 
 the plotting device to make everything fit (or you need to reduce the font 
 size even further, but things will become illegible eventually).

  - SIMdv, SIMiv are shown as number while on mine .csv are actually
  text variable.

 Those variables are apparently coded as factors, so use data.frame() instead 
 of cbind() to avoid the coercion to integer codes.

  regarding the rma.mv package, I set it up this way (preliminarily)
 

 I will leave this one to Wolfgang to answer.

  multi - rma.mv(pc, var, random = ~ 1 | author, data=codebook)
 
  I'm trying to compare the results with this equation, which is what -
  I think, correct me if I'm wrong -  in econometrics we call
  author-fixed effect, that is, model which are constant across
  individuals (the random\fix notation is a bit tricky):
 
  author_fix - rma(pc, var, mods = ~ I(author), data=codebook,
 method=ML)
 
  What I was wondering if that the two equation above mentioned also
  correct for heteroskedasticity which I need since my studies have
  different sample and specifications.

 I cannot comment on model choices. But yes, the functions properly account 
 for the fact that the sampling variances are heteroskedastic.

  Thanks for your help, your patience and your time, and many
  compliments for the package, is guiding me through the use of R for
  the first time - as you might have guessed.
 
  Marco
 
 
  On 24 August 2015 at 16:50, Viechtbauer Wolfgang (STAT)
  wolfgang.viechtba...@maastrichtuniversity.nl wrote:
  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' to adjust
 the limits to your taste. And then use appropriate values for
 'ilab.xpos', so they are inside those limits.
 
  Moreover, the graph is showed correctly only within the zoom in
  Rstudio but if I save it it is showed as enclosed.
 
  Nothing was enclosed (or it was stripped).
 
  Moreover, how would you suggest to handle (graphically) the
  multiple-cases-per-study thing? It's a 'good' way to average the
 cases
  among different studies in the graphs?
 
  Maybe add some space between groupings (i.e., studies). The example
 given here can provide some clues how one could go about this:
 http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups
 But drawing a plot like this requires a lot of hand-tweaking.
 
  Best,
  Wolfgang
 
  --
  

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

2015-08-25 Thread Michael Dewey

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)
wolfgang.viechtba...@maastrichtuniversity.nl 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: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 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


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

__
R-help@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.


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' and text
 
 Hello Marco
 
 Comments in line again
 
 On 24/08/2015 18:49, Marco Colagrossi wrote:
  I tried to upload the file once again. I tweaked it a bit, now my code
 is:
 
  forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1,
 subset=(pub==1),
  xlim = c(-16, 6),
  ilab = cbind(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)
 
  I managed to show both the Ilab argument and the text above. I still
  have 3 issues:
  - now the forest plot is too narrow - that is, pretty unreadable;
 
 You need to re-read Wolfgang's advice again. The forest function tells
 you what values of xlim it used and you can then adjust them to suit.
 This will take a few attempts in my experience.
 
  - I cannot still export it properly, as shown in the enclosed .png
 
 It looked correctly exported to me. One comment, do you really need the
 complete citation of each study? Most of the forest plots I see as a
 reviewer just use the first author name and the year. This would
 potentially give you a lot more space.

Also, if you have lots of outcomes, you may need to increase the height of the 
plotting device to make everything fit (or you need to reduce the font size 
even further, but things will become illegible eventually).

  - SIMdv, SIMiv are shown as number while on mine .csv are actually
  text variable.

Those variables are apparently coded as factors, so use data.frame() instead of 
cbind() to avoid the coercion to integer codes.

  regarding the rma.mv package, I set it up this way (preliminarily)
 
 
 I will leave this one to Wolfgang to answer.
 
  multi - rma.mv(pc, var, random = ~ 1 | author, data=codebook)
 
  I'm trying to compare the results with this equation, which is what -
  I think, correct me if I'm wrong -  in econometrics we call
  author-fixed effect, that is, model which are constant across
  individuals (the random\fix notation is a bit tricky):
 
  author_fix - rma(pc, var, mods = ~ I(author), data=codebook,
 method=ML)
 
  What I was wondering if that the two equation above mentioned also
  correct for heteroskedasticity which I need since my studies have
  different sample and specifications.

I cannot comment on model choices. But yes, the functions properly account for 
the fact that the sampling variances are heteroskedastic.

  Thanks for your help, your patience and your time, and many
  compliments for the package, is guiding me through the use of R for
  the first time - as you might have guessed.
 
  Marco
 
 
  On 24 August 2015 at 16:50, Viechtbauer Wolfgang (STAT)
  wolfgang.viechtba...@maastrichtuniversity.nl wrote:
  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' to adjust
 the limits to your taste. And then use appropriate values for
 'ilab.xpos', so they are inside those limits.
 
  Moreover, the graph is showed correctly only within the zoom in
  Rstudio but if I save it it is showed as enclosed.
 
  Nothing was enclosed (or it was stripped).
 
  Moreover, how would you suggest to handle (graphically) the
  multiple-cases-per-study thing? It's a 'good' way to average the
 cases
  among different studies in the graphs?
 
  Maybe add some space between groupings (i.e., studies). The example
 given here can provide some clues how one could go about this:
 http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups
 But drawing a plot like this requires a lot of hand-tweaking.
 
  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: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Marco
  Colagrossi
  Sent: Monday, August 24, 2015 16:04
  To: r-help@r-project.org
  Subject: [R] Metafor and forest(); not showing 'ilab' and text
 
  Hello folks,
 
  I have a couple of issues with the metafor package, specifically with
  the forest graphs.
  I am currently conducting a Meta-Analysis in economics throughout the
  metafor package.
 
  My meta-analysis has the specific of having different cases from
  single studies, and this proven to be 

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

2015-08-25 Thread Michael Dewey

Hello Marco

Comments in line again

On 24/08/2015 18:49, Marco Colagrossi wrote:

I tried to upload the file once again. I tweaked it a bit, now my code is:

forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1, subset=(pub==1),
xlim = c(-16, 6),
ilab = cbind(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)

I managed to show both the Ilab argument and the text above. I still
have 3 issues:
- now the forest plot is too narrow - that is, pretty unreadable;


You need to re-read Wolfgang's advice again. The forest function tells 
you what values of xlim it used and you can then adjust them to suit. 
This will take a few attempts in my experience.



- I cannot still export it properly, as shown in the enclosed .png


It looked correctly exported to me. One comment, do you really need the 
complete citation of each study? Most of the forest plots I see as a 
reviewer just use the first author name and the year. This would 
potentially give you a lot more space.



- SIMdv, SIMiv are shown as number while on mine .csv are actually
text variable.

regarding the rma.mv package, I set it up this way (preliminarily)



I will leave this one to Wolfgang to answer.


multi - rma.mv(pc, var, random = ~ 1 | author, data=codebook)

I'm trying to compare the results with this equation, which is what -
I think, correct me if I'm wrong -  in econometrics we call
author-fixed effect, that is, model which are constant across
individuals (the random\fix notation is a bit tricky):

author_fix - rma(pc, var, mods = ~ I(author), data=codebook, method=ML)

What I was wondering if that the two equation above mentioned also
correct for heteroskedasticity which I need since my studies have
different sample and specifications.

Thanks for your help, your patience and your time, and many
compliments for the package, is guiding me through the use of R for
the first time - as you might have guessed.

Marco


On 24 August 2015 at 16:50, Viechtbauer Wolfgang (STAT)
wolfgang.viechtba...@maastrichtuniversity.nl wrote:

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' to adjust the 
limits to your taste. And then use appropriate values for 'ilab.xpos', so they 
are inside those limits.


Moreover, the graph is showed correctly only within the zoom in
Rstudio but if I save it it is showed as enclosed.


Nothing was enclosed (or it was stripped).


Moreover, how would you suggest to handle (graphically) the
multiple-cases-per-study thing? It's a 'good' way to average the cases
among different studies in the graphs?


Maybe add some space between groupings (i.e., studies). The example given here 
can provide some clues how one could go about this: 
http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups But 
drawing a plot like this requires a lot of hand-tweaking.

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: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Marco
Colagrossi
Sent: Monday, August 24, 2015 16:04
To: r-help@r-project.org
Subject: [R] Metafor and forest(); not showing 'ilab' and text

Hello folks,

I have a couple of issues with the metafor package, specifically with
the forest graphs.
I am currently conducting a Meta-Analysis in economics throughout the
metafor package.

My meta-analysis has the specific of having different cases from
single studies, and this proven to be challenging especially when
trying to plot graphically the results I'm obtaining.

Here's the code:

forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1,
subset=(pub==1),
ilab = cbind(ys, f_dim, SIMdv, SIMiv),
ilab.xpos = c(-9.5, -8, -6, -4.5), cex = 0.75)
par(font=2)
   text(c(-9.5,-8,-6,-4.5), 26, c(Years, Firm(s) Dimension, DV,
IV))
   text(-16,26, Author(s) and Year, pos=4)
   text(6,  26, Observed Outcome [95% CI], pos=2)
par(op)

'pc' is the 'effect size', 'var' the variance, 'ci95m  ci95p' the CI,
'pub' if the paper has been published or not. the pub subset was the
first idea I had in order to split my sample that otherwise would have
been to big. The issue with this solution is that forest() displays
only the slap argument and the forest with the confidence interval,
completely ignoring the lab argument and the text I'm trying to add.
Moreover, the graph is 

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' to adjust the 
limits to your taste. And then use appropriate values for 'ilab.xpos', so they 
are inside those limits.

 Moreover, the graph is showed correctly only within the zoom in
 Rstudio but if I save it it is showed as enclosed.

Nothing was enclosed (or it was stripped).

 Moreover, how would you suggest to handle (graphically) the
 multiple-cases-per-study thing? It's a 'good' way to average the cases
 among different studies in the graphs?

Maybe add some space between groupings (i.e., studies). The example given here 
can provide some clues how one could go about this: 
http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups But 
drawing a plot like this requires a lot of hand-tweaking.

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: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Marco
 Colagrossi
 Sent: Monday, August 24, 2015 16:04
 To: r-help@r-project.org
 Subject: [R] Metafor and forest(); not showing 'ilab' and text
 
 Hello folks,
 
 I have a couple of issues with the metafor package, specifically with
 the forest graphs.
 I am currently conducting a Meta-Analysis in economics throughout the
 metafor package.
 
 My meta-analysis has the specific of having different cases from
 single studies, and this proven to be challenging especially when
 trying to plot graphically the results I'm obtaining.
 
 Here's the code:
 
 forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1,
 subset=(pub==1),
ilab = cbind(ys, f_dim, SIMdv, SIMiv),
ilab.xpos = c(-9.5, -8, -6, -4.5), cex = 0.75)
 par(font=2)
   text(c(-9.5,-8,-6,-4.5), 26, c(Years, Firm(s) Dimension, DV,
 IV))
   text(-16,26, Author(s) and Year, pos=4)
   text(6,  26, Observed Outcome [95% CI], pos=2)
 par(op)
 
 'pc' is the 'effect size', 'var' the variance, 'ci95m  ci95p' the CI,
 'pub' if the paper has been published or not. the pub subset was the
 first idea I had in order to split my sample that otherwise would have
 been to big. The issue with this solution is that forest() displays
 only the slap argument and the forest with the confidence interval,
 completely ignoring the lab argument and the text I'm trying to add.
 Moreover, the graph is showed correctly only within the zoom in
 Rstudio but if I save it it is showed as enclosed.
 
 What I'm doing wrong? I tried both to look at the package
 documentation and online but I can't figure it out.
 
 Moreover, how would you suggest to handle (graphically) the
 multiple-cases-per-study thing? It's a 'good' way to average the cases
 among different studies in the graphs?
 In my meta-analysis I'm using a multilevel model as shown in
 Gelman-Hill but graphically (and in tables) I'm struggling.
 
 Thanks for your help and patience
 
 __
 R-help@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.

__
R-help@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.


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

2015-08-24 Thread Marco Colagrossi
Hello folks,

I have a couple of issues with the metafor package, specifically with
the forest graphs.
I am currently conducting a Meta-Analysis in economics throughout the
metafor package.

My meta-analysis has the specific of having different cases from
single studies, and this proven to be challenging especially when
trying to plot graphically the results I'm obtaining.

Here's the code:

forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1, subset=(pub==1),
   ilab = cbind(ys, f_dim, SIMdv, SIMiv),
   ilab.xpos = c(-9.5, -8, -6, -4.5), cex = 0.75)
par(font=2)
  text(c(-9.5,-8,-6,-4.5), 26, c(Years, Firm(s) Dimension, DV, IV))
  text(-16,26, Author(s) and Year, pos=4)
  text(6,  26, Observed Outcome [95% CI], pos=2)
par(op)

'pc' is the 'effect size', 'var' the variance, 'ci95m  ci95p' the CI,
'pub' if the paper has been published or not. the pub subset was the
first idea I had in order to split my sample that otherwise would have
been to big. The issue with this solution is that forest() displays
only the slap argument and the forest with the confidence interval,
completely ignoring the lab argument and the text I'm trying to add.
Moreover, the graph is showed correctly only within the zoom in
Rstudio but if I save it it is showed as enclosed.

What I'm doing wrong? I tried both to look at the package
documentation and online but I can't figure it out.

Moreover, how would you suggest to handle (graphically) the
multiple-cases-per-study thing? It's a 'good' way to average the cases
among different studies in the graphs?
In my meta-analysis I'm using a multilevel model as shown in
Gelman-Hill but graphically (and in tables) I'm struggling.

Thanks for your help and patience

__
R-help@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.


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

2015-08-24 Thread Michael Dewey

Dear Marco

Comments inline

On 24/08/2015 15:03, Marco Colagrossi wrote:

Hello folks,

I have a couple of issues with the metafor package, specifically with
the forest graphs.
I am currently conducting a Meta-Analysis in economics throughout the
metafor package.

My meta-analysis has the specific of having different cases from
single studies, and this proven to be challenging especially when
trying to plot graphically the results I'm obtaining.

Here's the code:

forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1, subset=(pub==1),
ilab = cbind(ys, f_dim, SIMdv, SIMiv),
ilab.xpos = c(-9.5, -8, -6, -4.5), cex = 0.75)


At this point I think you meant to close the call to forest with another 
) as the subsequent calls to text are further commands and not internal 
to the call of forest.



par(font=2)
   text(c(-9.5,-8,-6,-4.5), 26, c(Years, Firm(s) Dimension, DV, IV))
   text(-16,26, Author(s) and Year, pos=4)
   text(6,  26, Observed Outcome [95% CI], pos=2)
par(op)


For that to have worked you probably meant to go
op - par() somewhere earlier



'pc' is the 'effect size', 'var' the variance, 'ci95m  ci95p' the CI,
'pub' if the paper has been published or not. the pub subset was the
first idea I had in order to split my sample that otherwise would have
been to big. The issue with this solution is that forest() displays
only the slap argument and the forest with the confidence interval,
completely ignoring the lab argument and the text I'm trying to add.
Moreover, the graph is showed correctly only within the zoom in
Rstudio but if I save it it is showed as enclosed.



Sorry, do not use Rstudio myself


What I'm doing wrong? I tried both to look at the package
documentation and online but I can't figure it out.

Moreover, how would you suggest to handle (graphically) the
multiple-cases-per-study thing? It's a 'good' way to average the cases
among different studies in the graphs?


Are you looking for rma.mv perhaps?


In my meta-analysis I'm using a multilevel model as shown in
Gelman-Hill but graphically (and in tables) I'm struggling.

Thanks for your help and patience

__
R-help@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

__
R-help@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.


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

2015-08-24 Thread Marco Colagrossi
I tried to upload the file once again. I tweaked it a bit, now my code is:

forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1, subset=(pub==1),
   xlim = c(-16, 6),
   ilab = cbind(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)

I managed to show both the Ilab argument and the text above. I still
have 3 issues:
- now the forest plot is too narrow - that is, pretty unreadable;
- I cannot still export it properly, as shown in the enclosed .png
- SIMdv, SIMiv are shown as number while on mine .csv are actually
text variable.

regarding the rma.mv package, I set it up this way (preliminarily)

multi - rma.mv(pc, var, random = ~ 1 | author, data=codebook)

I'm trying to compare the results with this equation, which is what -
I think, correct me if I'm wrong -  in econometrics we call
author-fixed effect, that is, model which are constant across
individuals (the random\fix notation is a bit tricky):

author_fix - rma(pc, var, mods = ~ I(author), data=codebook, method=ML)

What I was wondering if that the two equation above mentioned also
correct for heteroskedasticity which I need since my studies have
different sample and specifications.

Thanks for your help, your patience and your time, and many
compliments for the package, is guiding me through the use of R for
the first time - as you might have guessed.

Marco


On 24 August 2015 at 16:50, Viechtbauer Wolfgang (STAT)
wolfgang.viechtba...@maastrichtuniversity.nl wrote:
 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' to adjust the 
 limits to your taste. And then use appropriate values for 'ilab.xpos', so 
 they are inside those limits.

 Moreover, the graph is showed correctly only within the zoom in
 Rstudio but if I save it it is showed as enclosed.

 Nothing was enclosed (or it was stripped).

 Moreover, how would you suggest to handle (graphically) the
 multiple-cases-per-study thing? It's a 'good' way to average the cases
 among different studies in the graphs?

 Maybe add some space between groupings (i.e., studies). The example given 
 here can provide some clues how one could go about this: 
 http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups But 
 drawing a plot like this requires a lot of hand-tweaking.

 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: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Marco
 Colagrossi
 Sent: Monday, August 24, 2015 16:04
 To: r-help@r-project.org
 Subject: [R] Metafor and forest(); not showing 'ilab' and text

 Hello folks,

 I have a couple of issues with the metafor package, specifically with
 the forest graphs.
 I am currently conducting a Meta-Analysis in economics throughout the
 metafor package.

 My meta-analysis has the specific of having different cases from
 single studies, and this proven to be challenging especially when
 trying to plot graphically the results I'm obtaining.

 Here's the code:

 forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1,
 subset=(pub==1),
ilab = cbind(ys, f_dim, SIMdv, SIMiv),
ilab.xpos = c(-9.5, -8, -6, -4.5), cex = 0.75)
 par(font=2)
   text(c(-9.5,-8,-6,-4.5), 26, c(Years, Firm(s) Dimension, DV,
 IV))
   text(-16,26, Author(s) and Year, pos=4)
   text(6,  26, Observed Outcome [95% CI], pos=2)
 par(op)

 'pc' is the 'effect size', 'var' the variance, 'ci95m  ci95p' the CI,
 'pub' if the paper has been published or not. the pub subset was the
 first idea I had in order to split my sample that otherwise would have
 been to big. The issue with this solution is that forest() displays
 only the slap argument and the forest with the confidence interval,
 completely ignoring the lab argument and the text I'm trying to add.
 Moreover, the graph is showed correctly only within the zoom in
 Rstudio but if I save it it is showed as enclosed.

 What I'm doing wrong? I tried both to look at the package
 documentation and online but I can't figure it out.

 Moreover, how would you suggest to handle (graphically) the
 multiple-cases-per-study thing? It's a 'good' way to average the cases
 among different studies in the graphs?
 In my meta-analysis I'm using a multilevel model as shown in
 Gelman-Hill but graphically (and in tables) I'm struggling.

 Thanks for your help and patience