Re: [S] 3 s+ regression questions

Bill Venables (wvenable@attunga.stats.adelaide.edu.au)
Sat, 7 Mar 1998 10:26:29 +1030


fro11@lycosmail.com writes:
> 1. Is there a difference between "nonlinear" and "polynomial"
> regression?

Yes. A polynomial regression is a linear regression, that is,
linear in the parameters; a non-linear regression contains at
least one non-linear parameter.

> 2. When I do a quadratic regression in s+ (a linear expression
> with a quadratic term), then plot it with a bestfit line, I
> get a straight line . . . how do I plot it so it looks like
> it should - a curved line?

(Here is my reason for answering this in public.) If you ask a
question in such vague terms nobody can be sure of helping you.
It requires someone to second-guess what you really did and try
to correct that. If you want help you MUST be specific, (even if
you fear it reveals rather more than you would like to do).

Here is a detailed way of fitting and plotting a quadratic
regression that seems to be what you want, but I don't really
know if it will help. (It uses traditional graphics; if you want
Trellis graphics that will be extra...) I take it you would like
to plot the points and include the fitted model on the same
graph. Suppose the x- and y-values are in the data frame dat.

> fm <- lm(y ~ x + I(x^2), data = dat)
> attach(dat)
> plot(x, y, type = "n")
> xlims <- par("usr")[1:2]
> xs <- seq(xlims[1], xlims[2], length=200)
> ys <- predict(fm, newdata = data.frame(x = xs))
>
> plot(x, y, ylim = range(y, ys), pch = 1)
> lines(xs, ys)
>
> detach()

This goes to some trouble to make sure that the fitted quadratic
regression covers the full plot (like abline() does) and that the
limits are adequate to include both points and curve. This makes
a dummy initial plot necessary. (Of course you will have to open
a device to take it first, but I guess you know about that.)

> 3. When I do the local regression models, wher are the estimated
> parameters for the model. Can I write a prediction equation
> from the s+ output for a loess model for example?

May I suggest you re-consider the question carefully. Just what
are you looking for? Your question would be reasonable for a
simple parametric regression function, but local regression
models are really non-parametric regression models. So you want
the parameters of a non-parametric regression?

There are quite standard tools for predicting from such
regression models, but expressing the model itself in a
parametric form is likely to be rather tedious, I expect.

> Frank O'Hare
> -----------------------------------------------------
> Get free personalized email at http://email.lycos.com
> -----------------------------------------------------

It would be a small courtesy to include your real name in your
email address and to give your affiliation somewhere in the
message. As it stands your email address looks very like a junk
mail dummy which more and more people are starting to delete
automatically. If it were not for the [S] in the subject, I
would have done so this time. (Perhaps you had rather I did!)

Bill Venables.

-- 
Bill Venables, Head, Dept of Statistics,    Tel.: +61 8 8303 5418
University of Adelaide,                     Fax.: +61 8 8303 3696
South AUSTRALIA.     5005.   Email: Bill.Venables@adelaide.edu.au

----------------------------------------------------------------------- This message was distributed by s-news@wubios.wustl.edu. To unsubscribe send e-mail to s-news-request@wubios.wustl.edu with the BODY of the message: unsubscribe s-news