-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmetaplot_examples.R
More file actions
86 lines (68 loc) · 2.68 KB
/
metaplot_examples.R
File metadata and controls
86 lines (68 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
library(metaplotr)
help("metaplotr")
help("crosshairs")
#crosshairs(x, y, xse, yse, x_lab = NULL, y_lab = NULL, main_lab = NULL,
# confint = 0.95, mdrtr = NULL, mdrtr_lab = NULL, mdrtr_lab_pos = NULL,
# lab_size = 14, pnt_size = 3, whis_on = TRUE, annotate = FALSE,
# grid_dense = FALSE, bxplts = TRUE)
# Remove all variables in the .GlobalEnv, effectively clearing .GlobalEvn
rm(list = ls())
# help("FergusonBrannick2012")
# attach data frame to working environment.
attach(FergusonBrannick2012)
crosshairs(pub_z, dis_z, pub_z_se, dis_z_se)
#
# confint option can control whiskers length.
# crosshairs(pub_z, dis_z, pub_z_se, dis_z_se, confint = .95)
crosshairs(pub_z, dis_z, pub_z_se, dis_z_se, confint = .7)
#crosshairs(pub_z, dis_z, pub_z_se, dis_z_se, confint = .3)
# whis_on option opens and closes whiskers.
crosshairs(pub_z, dis_z, pub_z_se, dis_z_se, whis_on = FALSE)
#
# Main and axes labels can be changed.
crosshairs(pub_z, dis_z, pub_z_se, dis_z_se,
main_lab = 'Published vs. Dissertation Effect Sizes',
x_lab = 'Published Studides',
y_lab = 'Dissertations')
# Annotated correlation and mean values can be added to the graph.
attach(Sweeney2015)
# help("Sweeney2015")
# add descriptive statistics to graph
crosshairs(inten_d, beh_d, inten_se, beh_se,
main_lab = 'Sweeney (2015) Data', x_lab = 'Intentions',
y_lab = 'Behaviors',annotate = TRUE)
# Boxplots can be hidden.
crosshairs(inten_d, beh_d, inten_se, beh_se,
main_lab = 'Sweeney (2015) Data', x_lab = 'Intentions',
y_lab = 'Behaviors',annotate = TRUE,
bxplts = FALSE)
# Add moderator and label
attach(GenderDiff02)
#help("GenderDiff02")
crosshairs(men_z, women_z, men_se, women_se,
main_lab = 'Ali et al. Psychopathology and Parental Acceptance',
x_lab='Men', y_lab='Women', mdrtr = region, mdrtr_lab = 'Region',
mdrtr_lab_pos = c(.1,.5))
#
attach(McLeod2007) #McLeod2007
library(metafor)
res1 <- rma(yi=z, vi=var, method = "DL", data = McLeod2007)
res2 <- blup(res1)
res2
# Assign data to x, standard error of x, y, standard error of y,
# variable name of a moderator (if any) here. Note how the names
# and values of the x variables came from the McLead2007 dataset.
# The names and values of the shrunken estimates came from
# the output of the metafor program.
#
x1 <- McLeod2007$z
se.x1 <- sqrt(McLeod2007$var)
y1 <- res2$pred
se.y1 <- res2$se
#
crosshairs(x1, y1, se.x1, se.y1,
main_lab = 'Effects of Empirical Bayes Estimation',
x_lab = 'Parenting and Depression Correlations',
y_lab = 'Shrunken Estimates',annotate = TRUE,
whis_on = FALSE)
## End(Not run)