[R] linear model: Test difference between coefficients and given values (t.test?)
Achim.Zeileis at wu-wien.ac.at
Sun Aug 9 09:37:32 CEST 2009
On Sat, 8 Aug 2009, Katharina May wrote:
> Thanks to somebody I got the hint to use offset for the purpose of
> validating if there's
> a difference between the intercept and slope of a model and some
> provided values for
> the coefficients intercept and slope.
You could also use a Wald test for a linear hypothesis which does not
require refitting of the data under the null hypothesis. Suppose you've
got the regression
fm <- lm(dist ~ speed, data = cars)
and then want to test the null hypothesis that
(Intercept) = -10
speed = 4
Then you can do
linear.hypothesis(fm, c("(Intercept) = -10", "speed = 4"))
which will give you an ANOVA-like output.
Conceptually, this approach should also be possible for models with random
effects but I don't think that linear.hypothesis() works out of the box
> I read ?model.offset and I'm still struggling to use it for my
> purpose. If I understood
> the concepts correctly, offset can be used to define a known
> coefficient of a model,
> so therefore I could create two models based on the same data like my
> original one
> with an additional offset term (one model with intercept specified
> and one with the
> slope specified)?
> Sorry for troubling you: I struggling with the data analysis of my
> bachelor thesis and
> just want to compare the coefficients of my linear regression to
> published ones...
> a method often used I guess, but still I cannot find any appropriate
>> On Aug 8, 2009, Katharina May <may.katharina at googlemail.com> wrote:
>> Hi there,
>> I've got a question which is really trivial for sure but still I have
>> to ask as I'm not
>> making any progress solving it by myself (please be patient with an
>> I've got a linear model (lm and lmer fitted with method="ML").
>> Now I want to compare the coefficients (slope, intercept, not the
>> random effects)
>> of both models with a given value (e.g. intercept=0.5, slope=2) to see
>> if the values
>> estimated with the models are significantly different from the given values.
>> I heard about t.test, but I'm sorry to say that I'm not quite
>> understanding what I have
>> to provide as arguments.
>> I would be more than happy if somebody can point out an example similar to
>> comparison I have to do...
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help