Multivariate Models: mixture y1: Normal and y2: Poisson

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
Post Reply
amoretti
Posts: 1
Joined: Wed Jul 08, 2020 1:44 pm

Multivariate Models: mixture y1: Normal and y2: Poisson

Post by amoretti »

Hello everyone,

I want to estimate a multilevel mixed type model: y1 is Normal and y2 is Poisson.

I’m using the following code:

model= c(y1, log(y2)) ~ 1 + x1 + (1 | group) + (1[1] | idn )
mymodel3 <- runMLwiN( model, D = c("Mixed", "Normal", "Poisson"),
estoptions = list(EstM = 0, resi.store=TRUE),
data = sample).

I obtain the following error:
"error while obeying batch file wrong number of output columns
.
Execution completed

Error in foreign::read.dta(resifile) :
unable to open file: 'No such file or directory' "

Do you know what's going on?
Thanks.

Angelo
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: Multivariate Models: mixture y1: Normal and y2: Poisson

Post by ChrisCharlton »

This appears to be a bug in R2MLwiN. If you remove or comment out lines 1469-1475 in https://github.com/rforge/r2mlwin/blob/ ... ite.IGLS.R, i.e.:

Code: Select all

    if (level == 2 & D[[1]][1] == "Mixed") {
      for (i in 2:length(D)) {
        if (D[[i]][1] == "Binomial" | D[[i]][1] == "Poisson") {
          len.rpx <- len.rpx + 1
        }
      }
    }
then it appears to work correctly.

I have attached a source version of the R2MLwiN package where I have made this change.
Attachments
R2MLwiN_0.8-7.tar.gz
(340.41 KiB) Downloaded 506 times
Post Reply