Page 1 of 1

Predict function with gamlj LM

Posted: Wed Mar 11, 2020 12:10 pm
by Whirly123
I am running the predict function on some linear models but it doesn't seem to work with models generated by gamlj (although I am probably doing something wrong).

I can generate a model with lmer and run:
predict(LmerModel1, data) and it works fine.

If I generate the same model in gamlj and run predict:
predict(GamljModel$model, data) I get this error:

Error in eval(predvars, data, env) : object 'XQWdlbnRUeXBl' not found

That weird string is because inside the GamljModel the in lm equation everything has been renamed to random strings:
"XUmF0aW5n ~ 1 + XQWdlbnRUeXBl+( 1 + XQWdlbnRUeXBl | XUmVzcG9uc2VJZA )"

Obviously this is not the way I should be going about it.

What should I be doing?

Re: Predict function with gamlj LM

Posted: Wed Mar 11, 2020 10:57 pm
by Whirly123
Nevermind, I was being dumb not realising Gamlj has its own predict function.

Anyone coming across this post making the same mistake just see here:
https://rdrr.io/github/gamlj/gamlj/man/ ... edict.html

Re: Predict function with gamlj LM

Posted: Wed Mar 11, 2020 11:49 pm
by jonathon
ah, marcello might want to think about using S3 dispatch for this!

jonathon

Re: Predict function with gamlj LM

Posted: Thu Mar 12, 2020 11:39 am
by mcfanda@gmail.com
Whirly123, yes at the moment you need to use the gamlj method, but in the next version I will implement the S3 dispatch method, so one can use predict() also for gamlj results