equatiomatic icon indicating copy to clipboard operation
equatiomatic copied to clipboard

Indices to variables

Open ChristophHanck opened this issue 4 years ago • 6 comments

Great initiative!

Often, regression equations are reported so as to indicate the dimensions over which variables vary, like in (LaTeX) $$ y_i=\beta_0+\beta_1x_i+u_i, $$ typically for cross-sectional data, $$ y_t=\beta_0+\beta_1x_t+u_t, $$ for time series models and something like $$ y_{it}=\beta_{0,i}+\beta_1x_{it}+u_{it} $$ for panel data models. Could that be incorporated as an option?

ChristophHanck avatar Sep 24 '20 06:09 ChristophHanck

Hi, thanks for your interest! Yes, I think that could be incorporated pretty easily. I have a few other things I'm working on that are a little higher priority for me, but I will circle back to this when I have the time. I'd also welcome a PR if you feel up for that.

datalorax avatar Sep 24 '20 15:09 datalorax

Hi - circling back to this (about a year later). Can you possibly expand on this a bit? Apparently it made sense to me when you opened this issue but now that I'm revisiting it I'm not actually sure what's being requested. We now support mixed effects models, which vary randomly. But I'm thinking this is something different?

datalorax avatar Aug 10 '21 22:08 datalorax

Yes, something like this, so data varying over more than one dimension and the two (possibly more, although that is more rare in practice) indices to the variables reflecting that. Personally, I though of the plm package (https://cran.r-project.org/web/packages/plm/vignettes/A_plmPackage.html), but there are others around that have similar functionality.

ChristophHanck avatar Aug 11 '21 07:08 ChristophHanck

Could you possibly provide an example model along with what you would expect the output to look like?

datalorax avatar Aug 11 '21 15:08 datalorax

library(plm)
library(equatiomatic)

data("Grunfeld", package="plm")
grun.fe <- plm(inv~value+capital, data = Grunfeld, model = "within")

might yield something like

$$ inv_{it}=\hat{\alpha}_i+\hat{\beta}1value{it}+\hat{\beta}2capital{it} $$ (not sure why the subindices do not work in the output next to the betas and value and capital)

ChristophHanck avatar Aug 12 '21 06:08 ChristophHanck

Thanks, so it sounds like this is really about supporting a new model type.

datalorax avatar Aug 12 '21 16:08 datalorax