Using R, I have fitted a linear model for a single response variable from a mix of continuous and discrete predictors. This is uber-basic, but I'm having trouble grasping how a coefficient for a discrete factor works.
Concept: Obviously, the coefficient of the continuous variable 'x' is applied in the form
y = coefx(varx) + intercept but how does that work for a factor z if the factor is non-numeric?
y = coefx(varx) + coefz(factorz???) + intercept
Specific: I have fitted a model in R as
lm(log(c) ~ log(d) + h + a + f + h:a) where
f are discrete, non-numeric factors. The coefficients are:
Coefficients: Estimate (Intercept) -0.679695 log(d) 1.791294 h1 0.870735 h2 -0.447570 h3 0.542033 a 0.037362 f1 -0.588362 f2 0.816825 f3 0.534440 h1:a -0.085658 h2:a -0.034970 h3:a -0.040637
How do I use these to create the predictive equation:
log(c) = 1.791294(log(d)) + 0.037362(a) + h??? + f???? + h:a???? + -0.679695
Or am I doing it wrong?
I THINK that that concept is if the subject falls in category
f2, the equation becomes:
log(c) = 1.791294(log(d)) + 0.037362(a) + 0.870735 + 0.816825 + h:a???? + -0.679695
But I'm really not clear on how the
h:a interactive term gets parsed. Thanks for going easy on me.