StoreyLab / lfa

logistic factor analysis
GNU General Public License v3.0
15 stars 8 forks source link

fix factors #4

Open jhmarcus opened 7 years ago

jhmarcus commented 7 years ago

Hello,

I hope is all is well! Is it possible in the lfa package to fix a few factors for all individuals and estimate the remaining factors?

Thanks,

Joe

whao89 commented 7 years ago

Hi Joe, do you mean that you want to include adjustment variables when computing logistic factors?

jhmarcus commented 7 years ago

Thanks for the quick reply! Using the notation in model 2 / equation 2 (Hao et al. 2016) where L = AH I mean fixing some of the rows of H to known values while still estimating the other rows as well as A? What do you mean by adjustment variables?

whao89 commented 7 years ago

Adjustment variables in this case are just additional information about individuals, like how you might control for things in a regression. As a concrete example, perhaps something like self-reported ancestry? I think this is the same as what you're suggesting. This is definitely doable, but the change has to enter the algorithm at multiple points. If you're not in a rush, I can work on and test this in a branch and get back to you.

jhmarcus commented 7 years ago

Yep that is what I mean. That would be great! Thank you for the help.

whao89 commented 7 years ago

I think the devel branch should do what you want. The lfa function now has a adjustments argument which takes a matrix. The number of factors d needs to include the number of adjustment variables.

I'm not merging into master yet since I reorganized a bunch of stuff and want to make sure it all works.

Let me know if anything behaves weirdly or if this doesn't work the way you expect!