Skip to content
Prev 336901 / 398513 Next

how to plot a logarithmic regression line

On Feb 22, 2014, at 1:06 PM, arun wrote:

            
The 'abline' function is not what you want. Use 'lines' to plot multiple points. 

Perhaps:

mod <- lm(log(Mean_percent_of_range) ~ log(No.ofPoints))
 plot(log(Mean_percent_of_range), log(No.ofPoints))
lines( log(No.ofPoints), predict(mod))
#------------
Call:
lm(formula = log(Mean_percent_of_range) ~ log(No.ofPoints))

Residuals:
     Min       1Q   Median       3Q      Max 
-0.32617 -0.04839  0.00962  0.05316  0.17316 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)       1.19840    0.08060   14.87   <2e-16 ***
log(No.ofPoints)  0.94228    0.02609   36.12   <2e-16 ***
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Residual standard error: 0.09455 on 37 degrees of freedom
Multiple R-squared:  0.9724,	Adjusted R-squared:  0.9717 
F-statistic:  1305 on 1 and 37 DF,  p-value: < 2.2e-16



David Winsemius
Alameda, CA, USA