[R] notation question

Rolf Turner rolf.turner at xtra.co.nz
Wed Jul 20 02:50:10 CEST 2011


On 20/07/11 07:24, Carson Farmer wrote:
> Dear list, I am currently writing up some of my R models in a more
> formal sense for a paper, and I am having trouble with the notation.
> Although this isn't really an 'R' question, it should help me to
> understand a bit better what I am actually doing when fitting my
> models!
>
> Using the analysis of co-variance example from MASS (fourth edition, p
> 142), what is the correct notation for the formula "Gas, ~ Insul/Temp

     There shouldn't be a comma after ``Gas'' in that formula.
> - 1"? Obviously, if we fit it as two separate models (as in the
> example above it), we would have something like y_i = \beta x_i for
> each of the two models.

     No.  y_i = alpha + beta x_i  .  Clearly you need an intercept.
     Do you really expect gas consumption to be nil when the average
     external temperature is 0 degrees C ?
> So my question is, when we have a single model
> with a k-level factor interaction term as in the equation above, what
> is the correct/standard statistical (LaTeX style) notation?

The model is simply

     y_ij = alpha_i + beta_i x_ij

where i = 1 (before) or 2 (after).  I.e. you are allowing a different 
slope and intercept
for each of the scenarios (before and after).

But this is the ``deterministic'' part of the model.  You should really 
include the random
part:

     y_ij = alpha_i + beta_i x_ij + E_ij

where the E_ij are independent random variables with mean 0 and common
variance sigma^2.  (Often the E_ij are assumed to be Gaussian, mainly 
because
if all you have is a hammer, then everything looks like a nail).

     cheers,

         Rolf Turner



More information about the R-help mailing list