(i know it must be incredibely easy, but i'm strugling with it in R:)
i have dataset of x and y values saved in X and Y vectors. I know that plot of the data should follow exactly -45 degree line (see image below)
How do i find such -45 degree line that best fits the data (+ all these statistics available from summary(lm(...))? I've tried lm, but i can't force it to abandon fitting the slope parameter
Thank you
After trying: lm(y~1,offset=-x)
and applying abline(coefficient, -1)
i obtain following plot (see below)
black line is abline plot, yellow one is mine guess of fit -- what's wrong with lm
or do i miss totally something?
Since you state that:
y = -1*x + b
then
y+x = b
So calculate the mean of (y+x) and you get the average value of b
mean(y+x)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.