I have some data that I would like to model in a hierarchical function (it's a toy problem). In this case its production rates on two production lines, their associated products and how much they make in a run. Some products I have lots of data for (they run weekly) and others less so (run monthly). In theory the production rates should be the same for the products of each machine however in practice some achieve greater production rates than others. You also find efficiency gains for long production runs (generally you have inefficiencies at start up). Therefore the levels would be:
1) Machine (Machine 1, Machine 2)
2) Run Length (0 - 10,000)
3) Product (Prod 1, Prod 2, Prod N)
I have been looking at multi-level regression and when I look at the formulas I start to wonder is it equivalent to performing regression on the error of each level like this:
Fit data to y1_pred = a1 mach1 + b1 mach2 where mach1=1 and mach2=0 when data is from machine 1 and visa versa
Calculate y1_pred for each sample based on the above formula (with derived a,b) and subtract it from each data point, y_act. Let's call the difference y1_diff
Train y2_pred = a2 mach1 runlength + b2 mach2 runlength + c2 against the derived datapoints y1_diff where mach1=1 and mach2=0 when data is from machine 1 and visa versa
Calculate y2_pred for each data point and subtract it from the data points y1_diff and call the result y2_diff
Train y3_pred = a3 mach1 runrate prod1 + b3 mach2 runrate prod2 .. + against the derived data points y2_diff
Step 6: The final model is y1_pred + y2_pred + y3_pred
The reason why it interests me is that I could use different model types for each level - for example - linear regression on level 1, decision tree on level 2 and random forest on level 3. I could also iteratively tune regularization parameters at each level.
So is the above equivalent to multilevel regression?