Hi All I am running a linear regression using the lm object.
In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept) x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete This e-mail may contain confidential or proprietary information belonging to the BP group and is intended only for the use of the recipients named above. If you are not the intended recipient, please immediately notify the sender and either delete this email or return to the sender immediately. You may not review, copy or distribute this email. Within the bounds of law, this part of BP retains all emails and IMs and may monitor them to ensure compliance with BP's internal policies and for other legitimate business purposes. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.