I have a question about fitting data set.
I have a set of data, I want to plot it and add a horizontal line which should be the best fit of it.(let's say it is Y=a and ignore the shape of data)
How can I find a? which method i need to use.
I prefer to use R, but also ok for MATLAB
The mean of Y
would be the best fit in this case.
Y=rnorm(100)
plot(Y)
abline(h=mean(Y))