Disabling covariance multinomial model in R2MLwiN

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
pimverbunt
Posts: 11
Joined: Wed May 06, 2015 9:22 am

Disabling covariance multinomial model in R2MLwiN

Post by pimverbunt »

Dear all,

I'm currently modelling a mulitnomial multilevel model in R2MLwiN. My code is the following:

model = logit(se_arop_md3, denom) ~ 1 + (1 | country)
multinomial_empty <- runMLwiN(model, D = "Unordered Multinomial", data = mydata)

When I run this basic model it works. However, when I try to disable the covariance estimation the model does not work, giving the following message:
"Error in read.dta(IGLSfile) :
unable to open file: 'No such file or directory'"

The code I use is the following:

covmatrix <- matrix(, nrow = 3, ncol = 1)
covmatrix[1, 1] <- 2
covmatrix[2, 1] <- "Intercept_1"
covmatrix[3, 1] <- "Intercept_2"

multinomial_empty <- runMLwiN(model, D = "Unordered Multinomial", estoptions = list(clre = covmatrix), data = mydata)

I have tried replacing level "covmatrix[1, 1] <- 2" with "covmatrix[1, 1] <- 3" and various other changes in the code but I still get no results.

Can anyone help me with this problem? What is the exact code to not estimate the covariance in the variance-covariance matrix in a multinomial model?

Thanks in advance,

Pim Verbunt
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Disabling covariance multinomial model in R2MLwiN

Post by ChrisCharlton »

The parameter names that you pass to the clre option must appear exactly as displayed in MLwiN (e.g. Intercept.<category1>, etc). Probably the best way to determine what they should be is to add the debugmode=TRUE option into your estoptions list and then check via the equations window. If you just want a diagonal covariance matrix another option is to use the smat option, as in the following example.

Code: Select all

smat <- matrix(, nrow=2, ncol=1)
smat[1, 1] <- 2 # Level of covariance matrix
smat[2, 1] <- 1 # Set matrix type to diagonal

multinomial_empty <- runMLwiN(model, D = "Unordered Multinomial", estoptions = list(smat=smat), data = mydata)
pimverbunt
Posts: 11
Joined: Wed May 06, 2015 9:22 am

Re: Disabling covariance multinomial model in R2MLwiN

Post by pimverbunt »

Thanks you for the suggestion Chris. Using the debugmode=TRUE option showed the correct parameter names.
Post Reply