Skip to content

: Model formula question

1 message · David Firth

#
On Wednesday 01 February 2006 02:37, maneesh deshpande 
wrote:
Yes, that's right: the / symbol has a special 
(non-arithmetic) meaning when used like this in a model 
formula.  See for example p151 onwards in the reference 
that is given by ?formula.
The gnm (generalized nonlinear models) package has 
facilities for this.  The model above could be specified 
there as
    Y ~ -1 + Mult(X, -1 + A)
(where the first "-1" removes the intercept, and the second 
one says to estimate a separate multiplier for each level 
of A rather than using contrasts in A).  Or, if you want to 
constrain all of your multipliers to have the same sign, 
you can use
    Y ~ -1 + Mult(X, Exp(-1 + A))
(note the capital E there!).

It is unclear to me that using the *same* set of multipliers 
for both intercept and slope will typically be the right 
thing to do, though.  It would not, for example, be 
invariant to transformation of X to X-c, with c constant. 
That is to say, your X variable needs to be on a scale for 
which the zero value has a special meaning, in order to 
allow the above model to make sense.  But presumably you 
have thought about this already.

Hoping that helps,
David