gertvv / gemtc

GeMTC R package: model generation for network meta-analysis
GNU General Public License v3.0
43 stars 25 forks source link

Understand error from mtc.model for meta-regression #37

Closed richardz99 closed 8 years ago

richardz99 commented 8 years ago

Hello,

I'm getting the error:

Error in studyData[[regressor[["variable"]]]] : subscript out of bounds

when I try and run mtc.model on a meta-regression. Any idea what could be causing the error?

My network looks something like this:

MTC dataset: Network
Arm-level data: 
   study    treatment  mean std.err
1   1683   A              -1.95   0.170
2   1683   B              -2.22   0.160
3   1683   C              -1.14   0.160
4   1683   D              -1.74   0.160
5   1711    A              -1.05   0.096
6   1711    D              -1.19   0.086
7   3636   C              -1.14   0.124
8   3636    D              -1.76   0.087

Study-level data: 
      study     base
 [1,]  1683 1.780000
 [2,]  1711 1.260000
 [3,]  3636 0.750000

But there are 22 studies, 13 treatments, and 69 data points

I'm trying to set a regressor with

regressor <- list(coefficient='shared', variable='base', control="A")

and then the model with

model.created <- mtc.model(network.created, type = "regression", likelihood = "normal", link = "identity", regressor = regressor, linearModel = modeltype, dic = TRUE)

Thank you, Richard

gertvv commented 8 years ago

Hello Richard,

I think the problem here is that your study-level data is a matrix, not a data frame. I should add a check or a conversion for that. For now, you can do the conversion yourself and it should work.

Gert

richardz99 commented 8 years ago

Hello Gert,

It worked. Thank you very much.

Richard

gertvv commented 8 years ago

This is now fixed and such problems will be detected by gemtc in the next release.