print.escalc.Rd
Function to print objects of class "escalc"
(and to obtain inferences for the individual studies/rows in such an object).
an object of class "escalc"
obtained with escalc
.
an object of class "escalc"
obtained with escalc
.
integer to specify the number of decimal places to which the printed results should be rounded (the default is to take the value from the object).
character string with four elements to specify the variable names for the standard errors, test statistics, and lower/upper confidence interval bounds.
character string with two elements to specify the variable names for the observed effect sizes or outcomes and the sampling variances (the default is to take the value from the object if possible).
numeric value to specify the value of the effect size or outcome under the null hypothesis (the default is 0).
logical to specify whether the data frame specified via the object
argument should be returned together with the additional variables that are calculated by the summary
function (the default is TRUE
).
logical to specify whether existing values for sei
, zi
, ci.lb
, and ci.ub
in the data frame should be replaced. Only relevant when the data frame already contains these variables. If replace=TRUE
(the default), all of the existing values will be overwritten. If replace=FALSE
, only NA
values will be replaced.
numeric value between 0 and 100 to specify the confidence interval level (the default is 95; see here for details).
argument to specify observation/outcome limits. If unspecified, no limits are used.
argument to specify a function to transform the observed effect sizes or outcomes and interval bounds (e.g., transf=exp
; see also transf). If unspecified, no transformation is used. Any additional arguments needed for the function specified here can be passed via ...
.
other arguments.
The print.escalc
function formats and prints the data frame, so that the observed effect sizes or outcomes and sampling variances are rounded (to the number of digits specified).
The summary.escalc
function creates an object that is a data frame containing the original data (if append=TRUE
) and the following components:
observed effect sizes or outcomes (transformed if transf
is specified).
corresponding sampling variances.
corresponding standard errors.
test statistics for testing \(\text{H}_0{:}\; \theta_i = \text{H0}\) (i.e., (yi-H0)/sei
).
corresponding p-values.
lower confidence interval bounds (transformed if transf
is specified).
upper confidence interval bounds (transformed if transf
is specified).
When the transf
argument is specified, elements vi
, sei
, zi
, and pval
are not included (since these only apply to the untransformed effect sizes or outcomes).
Note that the actual variable names above depend on the out.names
(and var.names
) arguments. If the data frame already contains variables with names as specified by the out.names
argument, the values for these variables will be overwritten when replace=TRUE
(which is the default). By setting replace=FALSE
, only values that are NA
will be replaced.
The print.escalc
function again formats and prints the data frame, rounding the added variables to the number of digits specified.
If some transformation function has been specified for the transf
argument, then yi
, ci.lb
, and ci.ub
will be transformed accordingly. However, vi
and sei
then still reflect the sampling variances and standard errors of the untransformed values.
The summary.escalc
function computes level
% Wald-type confidence intervals, which may or may not be the most accurate method for computing confidence intervals for the chosen effect size or outcome measure.
If the outcome measure used is bounded (e.g., correlations are bounded between -1 and +1, proportions are bounded between 0 and 1), one can use the olim
argument to enforce those observation/outcome limits (the observed outcomes and confidence intervals cannot exceed those bounds then).
Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. https://doi.org/10.18637/jss.v036.i03
escalc
for the function to create escalc
objects.
### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
dat
#>
#> trial author year tpos tneg cpos cneg ablat alloc yi vi
#> 1 1 Aronson 1948 4 119 11 128 44 random -0.8893 0.3256
#> 2 2 Ferguson & Simes 1949 6 300 29 274 55 random -1.5854 0.1946
#> 3 3 Rosenthal et al 1960 3 228 11 209 42 random -1.3481 0.4154
#> 4 4 Hart & Sutherland 1977 62 13536 248 12619 52 random -1.4416 0.0200
#> 5 5 Frimodt-Moller et al 1973 33 5036 47 5761 13 alternate -0.2175 0.0512
#> 6 6 Stein & Aronson 1953 180 1361 372 1079 44 alternate -0.7861 0.0069
#> 7 7 Vandiviere et al 1973 8 2537 10 619 19 random -1.6209 0.2230
#> 8 8 TPT Madras 1980 505 87886 499 87892 13 random 0.0120 0.0040
#> 9 9 Coetzee & Berjak 1968 29 7470 45 7232 27 random -0.4694 0.0564
#> 10 10 Rosenthal et al 1961 17 1699 65 1600 42 systematic -1.3713 0.0730
#> 11 11 Comstock et al 1974 186 50448 141 27197 18 systematic -0.3394 0.0124
#> 12 12 Comstock & Webster 1969 5 2493 3 2338 33 systematic 0.4459 0.5325
#> 13 13 Comstock et al 1976 27 16886 29 17825 33 systematic -0.0173 0.0714
#>
### apply summary function
summary(dat)
#>
#> trial author year tpos tneg cpos cneg ablat alloc yi vi sei
#> 1 1 Aronson 1948 4 119 11 128 44 random -0.8893 0.3256 0.5706
#> 2 2 Ferguson & Simes 1949 6 300 29 274 55 random -1.5854 0.1946 0.4411
#> 3 3 Rosenthal et al 1960 3 228 11 209 42 random -1.3481 0.4154 0.6445
#> 4 4 Hart & Sutherland 1977 62 13536 248 12619 52 random -1.4416 0.0200 0.1415
#> 5 5 Frimodt-Moller et al 1973 33 5036 47 5761 13 alternate -0.2175 0.0512 0.2263
#> 6 6 Stein & Aronson 1953 180 1361 372 1079 44 alternate -0.7861 0.0069 0.0831
#> 7 7 Vandiviere et al 1973 8 2537 10 619 19 random -1.6209 0.2230 0.4722
#> 8 8 TPT Madras 1980 505 87886 499 87892 13 random 0.0120 0.0040 0.0629
#> 9 9 Coetzee & Berjak 1968 29 7470 45 7232 27 random -0.4694 0.0564 0.2376
#> 10 10 Rosenthal et al 1961 17 1699 65 1600 42 systematic -1.3713 0.0730 0.2702
#> 11 11 Comstock et al 1974 186 50448 141 27197 18 systematic -0.3394 0.0124 0.1114
#> 12 12 Comstock & Webster 1969 5 2493 3 2338 33 systematic 0.4459 0.5325 0.7297
#> 13 13 Comstock et al 1976 27 16886 29 17825 33 systematic -0.0173 0.0714 0.2672
#> zi pval ci.lb ci.ub
#> 1 -1.5586 0.1191 -2.0077 0.2290
#> 2 -3.5941 0.0003 -2.4500 -0.7208
#> 3 -2.0917 0.0365 -2.6113 -0.0849
#> 4 -10.1908 <.0001 -1.7188 -1.1643
#> 5 -0.9613 0.3364 -0.6611 0.2260
#> 6 -9.4599 <.0001 -0.9490 -0.6232
#> 7 -3.4323 0.0006 -2.5465 -0.6953
#> 8 0.1899 0.8494 -0.1114 0.1353
#> 9 -1.9760 0.0482 -0.9350 -0.0038
#> 10 -5.0747 <.0001 -1.9010 -0.8417
#> 11 -3.0460 0.0023 -0.5577 -0.1210
#> 12 0.6111 0.5412 -0.9843 1.8762
#> 13 -0.0648 0.9483 -0.5410 0.5064
#>
summary(dat, transf=exp)
#>
#> trial author year tpos tneg cpos cneg ablat alloc yi ci.lb ci.ub
#> 1 1 Aronson 1948 4 119 11 128 44 random 0.4109 0.1343 1.2574
#> 2 2 Ferguson & Simes 1949 6 300 29 274 55 random 0.2049 0.0863 0.4864
#> 3 3 Rosenthal et al 1960 3 228 11 209 42 random 0.2597 0.0734 0.9186
#> 4 4 Hart & Sutherland 1977 62 13536 248 12619 52 random 0.2366 0.1793 0.3121
#> 5 5 Frimodt-Moller et al 1973 33 5036 47 5761 13 alternate 0.8045 0.5163 1.2536
#> 6 6 Stein & Aronson 1953 180 1361 372 1079 44 alternate 0.4556 0.3871 0.5362
#> 7 7 Vandiviere et al 1973 8 2537 10 619 19 random 0.1977 0.0784 0.4989
#> 8 8 TPT Madras 1980 505 87886 499 87892 13 random 1.0120 0.8946 1.1449
#> 9 9 Coetzee & Berjak 1968 29 7470 45 7232 27 random 0.6254 0.3926 0.9962
#> 10 10 Rosenthal et al 1961 17 1699 65 1600 42 systematic 0.2538 0.1494 0.4310
#> 11 11 Comstock et al 1974 186 50448 141 27197 18 systematic 0.7122 0.5725 0.8860
#> 12 12 Comstock & Webster 1969 5 2493 3 2338 33 systematic 1.5619 0.3737 6.5284
#> 13 13 Comstock et al 1976 27 16886 29 17825 33 systematic 0.9828 0.5821 1.6593
#>