[R] lm fitting with a specified slope

Warnes, Gregory R gregory_r_warnes at groton.pfizer.com
Thu Oct 3 22:33:05 CEST 2002


Assume the model:

  X1 <- rnorm(1000)
  X2 <- rnorm(1000)

  B1 = 1.75 # known a-priorori
  B2 = 0.5  # unknown a-priorori

  Y  <- 1.75 * X1 + 0.5 * X2  + rnorm(1000,sd=0.25)

Then wouldn't this do the trick? :

  reg <- lm( (Y - 1.75 * X1) ~ X2 ) 


-Greg

> -----Original Message-----
> From: Rob Lee [mailto:rlee at fpcc.net]
> Sent: Thursday, October 03, 2002 3:15 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] lm fitting with a specified slope 
> 
> 
> 
> Is there an easy way to do a linear model with an a priori 
> known slope?
> 
> In essence, I want to minimize the residuals around a line of 
> known slope.
> 
> -R
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> r-help mailing list -- Read 
> http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: 
> r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._._._._._
> 


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list