This is a little rudimentary, I know. Basically, I want to use the save data from the coef function to a shared data frame for models that all pull limited possible variables from a larger shared data set.
I have 3 sets of 14 models. Each set uses 15-25 variables from a 100 variable data-set, and each of the models uses a mix of about 12 variables, which change from model to model. What I would like to do is save the coefficients for each of the 14 models into one data-frame.
Coefs=data.frame(col.names = names(EST))
The coefficients look something like this:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
RT_SCORE_USER 0.2427506 0.0310486 7.818 0.0000000000000836 ***
VOD.Window..weeks. 0.0092641 0.0009985 9.278 < 2e-16 ***
PX_WK3 0.0300395 0.0098943 3.036 0.002600 **
For a good 10-15 variables. For instance, PX has 14 weeks (WK1, 2, etc). I want to save the Estimate values into this grid, where for each row, there are 100 columns listing all possible variables. The majority of which will be 0. This table will be imported into excel where I can simply cross multiply for each week's model.
My struggle is figuring out how to record all the varying coefficients from the various weeks into ONE data.frame, where each model has a separate row:
PX_WK1 PXWK_2 RT_SCORE_USER IMAVARIABLE etc.
ESTWK1 .030 0 .24 0
ESTWK2 0 .023 .44 etc
ESTWK3 0 0 etc etc etc
I understand how to use coef(ESTWK1), but when I try to paste that into a row, I naturally get an error confusing the lengths of the two vectors, say 15 in this model out of a potential 100.
I want to automate this process so when new data is processed and the regressions are run, I can run my code saving the new coefficients' data, and then I can output that to a CSV (that part I've got). Thoughts?