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 h and 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 h1 and 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.

g1, nor is it entirely evident that ${b}$ really stands for an indicator that $g_1=b$ rather than for the numerical value of $b$! (Here, $b$ really means "b"--the letter--which may be sufficient warning, but when the categories are coded by numbers, such as $0$ and $1$, watch out...) – whuber Mar 07 '12 at 17:46cmight be confusing in this particular case, because I choose two letters to represent g1 levels, but usually it's quite intuitive--and that's pure tex so we can still edit the source file afterwards). Attached is another summary where I alteredg1so that it is now a four-level factor. Yet, with 0/1 labels that might be more confusing. – chl Mar 07 '12 at 19:35