[R] linear trend
Jonathan Baron
baron at cattell.psych.upenn.edu
Tue Feb 25 12:32:04 CET 2003
On 02/25/03 12:22, This Rutishauser wrote:
>can anyone help me with a hint how to find a function to fit a linear
>trend line into a scatter plot. as well as testing it for significance.
Look at the help page for abline(). That is what you use for
drawing lines in a plot. It turns out that you can specify the
line with lm(), and summary(lm()) gives you the significance
test. For example (all but the last line from ?abline):
data(cars)
z <- lm(dist ~ speed, data = cars)
plot(cars)
abline(z)
summary(z)
--
Jonathan Baron, Professor of Psychology, University of Pennsylvania
R page: http://finzi.psych.upenn.edu/
More information about the R-help
mailing list