So I have this plot that looks like this:
Both the x and y axis are log, how do I fit a least squares regression line to this? This is what I used to plot the graph: plot(log(counts),log="x",type="p")
counts contains the number of observations of each x...
The least squares regression for log(counts) on log(x) is simply:
lm(log(counts) ~ log(x))
If you want to plot it:
plot(log(counts) ~ log(x))
abline(reg=lm(log(counts) ~ log(x)))
This may not be the most statistically appropriate model for your data, but that's a question for another site....
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.