[R] regression coefficients
Pfaff, Bernhard
Bernhard.Pfaff at drkw.com
Tue May 20 18:08:36 CEST 2003
beside ?anova(), you might also be interested in considering the j-test, a
quick google retrieved:
http://support.sas.com/rnd/app/examples/ets/spec/
for an elucidation of the test problem.
HTH,
Bernhard
-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sent: 20 May 2003 17:51
To: Spencer Graves
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] regression coefficients
Why is s assumed known and common to the k groups? I doubt if that is
what was meant (although it was too imprecise to be at all sure).
If `common' is a viable assumption, you can just fit a model with by-group
regressions vs one with a common regression (which seems to be what you
are testing) and use anova().
If not, the case k=2 encompasses the Welch t-test so exact distribution
theory is not going to be possible, but by fitting a common model and
three separate models and summing the -2log-lik for the latter you can
easily get the LT test and refer it to its `standard' (asymptotic)
Chi-squared distribution.
On Tue, 20 May 2003, Spencer Graves wrote:
> I don't know of a simply function to do what you want, but I can
give
> you part of the standard log(likelihood ratio) theory:
>
> Suppose b[i]|s ~ N.r(b, s^2*W[i]), i = 1, ..., k. Then the
> log(likelihood) is a sum of k terms of the following form:
>
> l[i] = (-0.5)*(r*log(2*pi*s^2)+log|W[i]|
> +(s^-2)*t(b[i]-b)%*%solve(W[i]%*%(b[i]-b)
>
> By differentiating with respect to b and setting to 0, we get the
> maximum likelihood estimate for b as follows:
>
> b.hat = solve(sum(solve(W[i]))%*%sum(solve(W[i])%*%b[i])
>
> In words: b.hat = weighted average with weights inversely proportional
> to the variances. Then log(likelihood ratio) is as follows:
>
> log.LR = sum((s^-2)*t(b[i]-b.hat)%*%solve(W[i])%*%(b[i]-b.hat))
>
> This problem should be in most good books on multivariate analysis. I
> would guess that log.LR probably has an F distribution with numerator
> degrees of freedom = r*(k-1) and with denominator degrees of freedom =
> degrees of freedom in the estimate of s. However, I don't remember for
> sure. It's vaguely possible that this is an "unsolved" problem. In the
> latter case, you should have all the pieces here to generate a Monte
> Carlo.
You have assumed s is known, in which case it is a Chi-squared
distribution. If s is unknown, you need to maximize over it to get an LR
test (separately under the null and the alternative).
> lamack lamack wrote:
> > dear all, How can I compare regression coefficients across three (or
> > more) groups?
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail
disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.
More information about the R-help
mailing list