[R] How to test a model with two unkown constants

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Aug 27 18:07:33 CEST 2003


That's the linear model lm(y ~ I(1/f1) + f2), so yes, yes and
fuller answers can be found in most of the books and guides mentioned in 
R's FAQ.

Note that how `good' the fit is will have to be relative, unless you
really can assume a uniform error with range 1, when you could do a 
maximum-likelihood fit (and watch out for the non-standard distribution 
theory).

On 27 Aug 2003, Sven Garbade wrote:

> Hi all,
> 
> suppose I've got a vector y with some data (from a repeated measure
> design) observed given the conditions in f1 and f2. I've got a model
> with two unknown fix constants a and b which tries to predict y with
> respect to the values in f1 and f2. Here is an exsample
> 
> # "data"
> y <- c(runif(10, -1,0), runif(10,0,1))
> # f1
> f1 <- rep(c(-1.4, 1.4), rep(10,2))
> # f2
> f2 <- rep(c(-.5, .5), rep(10,2))
> 
> Suppose my simple model looks like
> 
> y = a/f1 + b*f2

> Is there a function in R which can compute the estimates for a and b?
> And is it possible to test the model, eg how "good" the fits of the
> model are?

-- 
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




More information about the R-help mailing list