Skip to content
Back to formatted view

Raw Message

Message-ID: <20030225063036.A27568@cattell.psych.upenn.edu>
Date: 2003-02-25T12:32:04Z
From: Jonathan Baron
Subject: linear trend
In-Reply-To: <3E5B51DA.5ABF38F9@giub.unibe.ch>; from rutis@giub.unibe.ch on Tue, Feb 25, 2003 at 12:22:02PM +0100

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/