Issue with formula specification

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
kaiserdominici
Posts: 18
Joined: Thu Feb 06, 2014 9:37 am

Issue with formula specification

Post by kaiserdominici »

Hi all,

I am having some troubles passing a formula to MLwiN. I have a 3-level repeated measures model with random intercept and slopes at levels 3 (Group) and 2 (ID) and a fixed quadratic time component. I have tried both:

Code: Select all

> runMLwiN(Median.yr ~ 1 + poly(Time,2) + (1 + Time |Group) + (1 + Time |ID) + (1 |Time), data = dataset)
Returning:
Error in eval(expr, envir, enclos) : object 'Median' not found

And:

Code: Select all

> runMLwiN(Formula = "Median.yr ~ 1 + poly(Time,2) + (1 + Time |Group) + (1 + Time |ID) + (1 |Time)", data = dataset)
Returning:
Error in parse(text = x, keep.source = FALSE) :
<text>:2:0: unexpected end of input
1: ~
...^


What am I doing incorrectly?

Thank you and all the best,

k.
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Issue with formula specification

Post by ChrisCharlton »

There appears to be a bug in R2MLwiN where formulae are not parsed correctly if the variables contain a "." character. We will investigate what the cause for this might be, but in the mean time you should be able to work around it by renaming your response so that it does not include this character.
kaiserdominici
Posts: 18
Joined: Thu Feb 06, 2014 9:37 am

Re: Issue with formula specification

Post by kaiserdominici »

Hi Chris,

Thank you for your prompt reply, will do.

All the best,

k.
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Issue with formula specification

Post by ChrisCharlton »

I have now tracked down the cause of this error, and it should be fixed in the development version of R2MLwiN.
Post Reply