-
Notifications
You must be signed in to change notification settings - Fork 0
/
coefCTmeta_test-input-output.Rmd
142 lines (108 loc) · 3.03 KB
/
coefCTmeta_test-input-output.Rmd
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
title: "Testing the input and output of coef.CTmeta"
author: "Judith Neve"
date: "04/12/2021"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(CTmeta)
```
This document tests what can be used as input and output for the function CTmeta. Each argument is examined in turn, and at the end some additional checks are done to verify plots can be made for different configurations of the model.
Where the function runs, the output is compared to the expected output.
After every attempt to "break" the function, a diagnostic is written as a comment in the code chunk, and the code chunk is followed by a "to do" list to indicate what needs to be specified/improved/changed in the function documentation or the function itself.
Setting up models that work well.
```{r example setup}
# q=2 variables and S=3 primary studies
N <- matrix(c(643, 651, 473))
DeltaT <- matrix(c(2, 3, 1))
DeltaTStar <- 1
Phi <- myPhi
SigmaVAR <- mySigmaVAR
Gamma <- myGamma
Moderators <- 0
Mod <- matrix(c(64,65,47))
BetweenLevel <- c(1, 1, 2)
```
FE model with moderator
```{r}
CTma.FE.mod <- CTmeta(N,
DeltaT,
DeltaTStar,
Phi,
SigmaVAR,
Moderators = 1,
Mod = Mod)
```
FE model without moderator
```{r}
CTma.FE.nomod <- CTmeta(N,
DeltaT,
DeltaTStar,
Phi,
SigmaVAR)
```
RE model with moderator and no BetweenLevel
```{r}
CTma.RE.mod <- CTmeta(N,
DeltaT,
DeltaTStar,
Phi,
SigmaVAR,
FEorRE = 2,
Moderators = 1,
Mod = Mod)
```
RE model without moderator and no BetweenLevel
```{r}
CTma.RE.nomod <- CTmeta(N,
DeltaT,
DeltaTStar,
Phi,
SigmaVAR,
FEorRE = 2)
```
RE model with moderator and BetweenLevel
```{r}
CTma.RE.mod.BL <- CTmeta(N,
DeltaT,
DeltaTStar,
Phi,
SigmaVAR,
FEorRE = 2,
Moderators = 1,
Mod = Mod,
BetweenLevel = BetweenLevel)
```
RE model with no moderator and BetweenLevel
```{r}
CTma.RE.nomod.BL <- CTmeta(N,
DeltaT,
DeltaTStar,
Phi,
SigmaVAR,
Mod = Mod,
BetweenLevel = BetweenLevel)
```
# Checking coef.CTmeta on each of these
```{r}
coef.CTmeta(CTma.FE.mod)
coef(CTma.FE.mod)
coef.CTmeta(CTma.FE.nomod)
coef(CTma.FE.nomod)
coef.CTmeta(CTma.RE.mod)
coef(CTma.RE.mod)
coef.CTmeta(CTma.RE.mod.BL)
coef(CTma.RE.mod.BL)
coef.CTmeta(CTma.RE.nomod)
coef(CTma.RE.nomod)
coef.CTmeta(CTma.RE.nomod.BL)
coef(CTma.RE.nomod.BL)
```
The output is always the same output that coef() gives.
To do:
- why is there no documentation for coef.CTmeta?
- how does coef.CTmeta differ from coef?
Answer:
This is exactly what is expected: coef.CTmeta is a background function so that coef works.
Nothing more to do.