making complicated Formulas for GLM, MixedModels

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

making complicated Formulas for GLM, MixedModels

Thomas Covert
Suppose I have a DataFrame with hundreds of columns.  How would I tell GLM.jl or MixedModels.jl to fit a model in which the right hand side includes many (but not all) of those columns?  Would it help if many of those columns have names that are "wildcard"-able?  For example, in STATA, if I wanted to run a regression with RHS variables V1-V100, I could type that exactly, and if there were many variables starting with V, I could just type V*.  Is there something equivalent for the modeling language used in GLM/MixedModels?

I have tried making a string containing the right hand side of the formula I'd like to run (say, s = "1 + V1 + V2 + V3"), but fit(lmm(y ~ s, df) does't work, and neither does an application of symbol() to s or Expr(symbol(s)). 

Any ideas?

Thanks.

-thom

--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: making complicated Formulas for GLM, MixedModels

Thomas Covert
Well, my model doesn't work yet, but I think I have have answered my own question:

1) construct the RHS as a string (call this rhs)
2) construct a Formula object as fm = Formula(parse("y"), parse(rhs))
3) now I can (theoretically) call lmm() or glm() on fm

Is this right?

On Thursday, August 20, 2015 at 3:09:54 PM UTC-6, Thomas Covert wrote:
Suppose I have a DataFrame with hundreds of columns.  How would I tell GLM.jl or MixedModels.jl to fit a model in which the right hand side includes many (but not all) of those columns?  Would it help if many of those columns have names that are "wildcard"-able?  For example, in STATA, if I wanted to run a regression with RHS variables V1-V100, I could type that exactly, and if there were many variables starting with V, I could just type V*.  Is there something equivalent for the modeling language used in GLM/MixedModels?

I have tried making a string containing the right hand side of the formula I'd like to run (say, s = "1 + V1 + V2 + V3"), but fit(lmm(y ~ s, df) does't work, and neither does an application of symbol() to s or Expr(symbol(s)). 

Any ideas?

Thanks.

-thom

--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.