armVars: Vector of per-arm variables. The name of each component will be the column name in the resulting dataset. The column name in the source dataset is derived from the value of each component.
nArmsVar: Variable holding the number of arms for each study.
studyVars: Vector of per-study variables. The name of each component will be the column name in the resulting dataset. The column name in the source dataset is derived from the value of each component.
studyNames: Vector of study names.
treatmentNames: Vector of treatment names.
patterns: Patterns to generate column names in the source dataset. The first is for per-study variables, the second for per-arm variables.
Returns
A data table with the requested columns.
Details
Maps the one-study-per-row format that is widely used and convenient for BUGS models to the one-arm-per-row format used by GeMTC. As the primary purpose is to input datasets from BUGS models, the defaults work for the standard BUGS data table format. In most cases, it should be possible to just copy/paste the BUGS data table (without the final 'END') and read.table it into R, then apply mtc.data.studyrow. In many cases, the resulting table can be processed directly by mtc.network.
Author(s)
Gert van Valkenhoef
See Also
mtc.network
Examples
## Example taken from the NICE DSU TSD series in Evidence Synthesis, #2## Dopamine agonists for the treatment of Parkinson's# Read the bugs-formatted datadata.src <- read.table(textConnection('
t[,1] t[,2] t[,3] y[,1] y[,2] y[,3] se[,1] se[,2] se[,3] na[]13NA-1.22-1.53NA0.5040.439NA212NA-0.7-2.4NA0.2820.258NA2124-0.3-2.6-1.20.5050.5100.478334NA-0.24-0.59NA0.2650.354NA234NA-0.73-0.18NA0.3350.442NA245NA-2.2-2.5NA0.1970.190NA245NA-1.8-2.1NA0.2000.250NA2'), header=TRUE)# Convert the data, setting treatment namesdata <- mtc.data.studyrow(data.src, armVars=c('treatment'='t','mean'='y','std.err'='se'), treatmentNames=c('Placebo','DA1','DA2','DA3','DA4'))# Check that the data are correctprint(data)# Create a networknetwork <- mtc.network(data)