[R] simple fit
rolf.turner at xtra.co.nz
Thu Dec 8 20:22:12 CET 2011
If one knows y, x, and a, and wishes to estimate b in
y = a*x + b (+ random error presumably)
then surely the simplest procedure is
b.hat <- mean(y-a*x)
Is it not so?
On 09/12/11 08:09, Ben Bolker wrote:
> R. Michael Weylandt<michael.weylandt<at> gmail.com> writes:
>> Fit y-b without an intercept? (which you do by adding "+ 0" or "- 1"
>> to the model formula) Not sure if this is the optimal result, but it
>> will give you a pretty reasonable answer.
> This seems backward. The OP has the slope and wants the intercept.
>> On Thu, Dec 8, 2011 at 10:52 AM, Alaios<alaios<at> yahoo.com> wrote:
>>> I have a formula of the form
>>> I know everything except b.
>>> How I can ask R to do fitting to find only the value of b?
>>> I already know the lm() but it always return both an intercept point
>>> (b) and the a.
> lm (y~1,offset=a*x,data= ...)
> lm(y-a*x~1,data=...) [not sure this will evaluate the full
> expresson on the LHS but it might]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help