[R-meta] escalc() function and weights
Prof. Mario Petretta
petrett@ @end|ng |rom un|n@@|t
Fri Jun 26 17:17:00 CEST 2020
Dear All,
in a previous post (see below) it was pointed out by Wolfgang Viechtbauer
that the use of weight in the escalc () function is deprecated.
Please, it is possible to clarify:
1) Why is the use of weight in the escalc () function is now deprecated?
2) What is the correct code to use for the example of the tutorial on the
"Metafor" package and the "escalc" function using the "long" bcg data
obtained with the reshape2 function, as shown in the previous post ?
Thank you for your time
Mario Petretta
Mario Petretta
Professor of Internal Medicine
Department of Translational Medical Science
University of Naples Federico II
Naples - Italy
<https://www.mail-archive.com/search?l=r-help@r-project.org&q=subject:%22Re%
5C%3A+%5C%5BR%5C%5D+Error+message+in+meta%5C-analysis+package+Metafor%5C-wei
ghts+%3D%5C%22%5C%22%22&o=newest> Re: [R] Error message in meta-analysis
package Metafor-weights =""
<https://www.mail-archive.com/search?l=r-help@r-project.org&q=from:%22Viecht
bauer%2C+Wolfgang+%5C%28SP%5C%29%22> Viechtbauer, Wolfgang (SP)
<https://www.mail-archive.com/search?l=r-help@r-project.org&q=date:20200616>
Tue, 16 Jun 2020 09:51:21 -0700
Dear Amoatwi,
This way of using the escalc() function has been deprecated. It might be
added
back once there is actually any benefit from having this functionality, but
for
years it just meant that I had to maintain two different ways of doing the
exact same thing without any additional benefits.
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/>
http://www.wvbauer.com
>-----Original Message-----
>From: R-help [ <mailto:r-help-boun... using r-project.org>
mailto:r-help-boun... using r-project.org] On Behalf Of K Amoatwi
>Sent: Tuesday, 16 June, 2020 4:50
>To: r-help using r-project.org
>Subject: [R] Error message in meta-analysis package Metafor-weights =""
>
>Dear All,
>I am using the example from one of the tutorial about "Metafor" package and
>"escalc" function, to learn how this package can be applied to do
>meta-analysi; the code and the data is directly from the tutorials but
>"weights=freq" option in the escalc function is given me error message
>This is the code below:
>
>library(metafor) # Load package
>#####DATASET 1: BCG Vaccine Trials
>data(dat.bcg) # BCG meta-analytic dataset
>
>##Formula based Specification
>##That is, what if I have multiple rows per study, corresponding to
>difference treatment groups?
>
>library(reshape2) # Load package for data reshaping
>
>bcg.long <- melt(dat.bcg[, c("trial", "tpos", "tneg", "cpos", "cneg")], id
>= "trial")
>bcg.long$pos <- ifelse(bcg.long$var == "tpos" | bcg.long$var == "cpos", 1,
>0)
>bcg.long$group <- ifelse(bcg.long$var == "tpos" | bcg.long$var == "tneg",
>1, 0)
>
>##sample of the data, the first 6 rows
>head(bcg.long)
> trial variable value pos group
>1 1 tpos 4 1 1
>2 2 tpos 6 1 1
>3 3 tpos 3 1 1
>4 4 tpos 62 1 1
>5 5 tpos 33 1 1
>6 6 tpos 180 1 1
>
>##Now applying the " escalc " function
>
>escalc(factor(pos)~factor(group)| factor(trial),weights = value,data =
>bcg.long, measure = "OR")
>
>##Then I got this error message
>Error in escalc(factor(pos) ~ factor(group) | factor(trial), weights =
>value, :
> object 'value' not found
>
>I used the same data with different example from another author and got a
>similar error message
>Second code with the same data but different coding
>Sample data
>
>with the first 6 rows of the rearranged data shown below. (T=treatment,
>C=Control group, Out=outcome whether positive or negative, and then
>frequency)
> study grp out freq
>1 1 T + 4
>2 1 T - 119
>3 1 C + 11
>4 1 C - 128
>5 2 T + 6
>6 2 T - 300
>
>>escalc(out ~ grp | study, weights = freq, data = dat.fm, measure = "OR")
>
>Error in escalc(out ~ grp | study, weights = freq, data = dat.fm, measure =
>"OR") :
> object 'freq' not found
>
>I am not sure what I am doing wrong since both authors were able to get
>their results while I am getting error messages.
>
>Any help will be very much appreciated
>
>Amoatwi
______________________________________________
[[alternative HTML version deleted]]
More information about the R-sig-meta-analysis
mailing list