R-alpha: lm ( formula ) : quadratic formula 'fails'

Martin Maechler (maechler@stat.math.ethz.ch)
Mon, 2 Dec 96 11:47:53 +0100


Date: Mon, 2 Dec 96 11:47:53 +0100
Message-Id: <9612021047.AA07079@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: lm ( formula ) : quadratic formula 'fails'


>From the students' exercises of  my class,
I ask them to do  a quadratic fit through the origin
(for a model:  W=distance V=speed  (traffic situation)):

This is how it works in  S :

	lm(W ~ V + V^2 -1)

Unfortunately, R  'simplifies the formula' by dropping the  V^2  term.

R works alright if I use

	lm(W ~ V + I(V^2) -1)
		   ==   =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-