[R] lm( ) for log10-transformed data

Kim Milferstedt milferst at uiuc.edu
Tue Aug 7 20:58:58 CEST 2007


Dear help-list,

I would like to perform a linear regression on the log10 of the two 
vectors ov.mag.min and res.600nm. The slope and intercept of the 
regression I use to plot a wider range of ov.mag.min in a double log plot.

For a linear regression on only tow points, wouldn't I expect the 
results for two.points.min to match pretty exactly res.600nm? It does 
not seem to be the case here. I manually calculated the slope and 
intercept and got values of -0.71 and 1.5 that seem to work alright. 
What is it that I am missing here?

Thanks already for your help,

Kim

ov.mag.min <- c(50, 1000)
res.600nm <- c(2.0, 0.231)


lm.line.min <- lm(      log(ov.mag.min,10)
                                 ~
                                 log(res.600nm,10)
                     )

intercept.min  <- lm.line.min$coefficients[1]
slope.min <- lm.line.min$coefficients[2]


two.points.min <- log(ov.mag.min,10)

round(res.600nm,2) == 
round(10^(two.points.min*slope.min+intercept.min),2)

round(res.600nm,2)
round(10^(two.points.min*-0.71+1.5),2)


__________________________________________

Kim Milferstedt
University of Illinois at Urbana-Champaign
Department of Civil and Environmental Engineering
4125 Newmark Civil Engineering Laboratory
205 North Mathews Avenue MC-250
Urbana, IL 61801
USA
phone: (001) 217 333-9663
fax: (001) 217 333-6968
email: milferst at uiuc.edu
http://cee.uiuc.edu/research/morgenroth



More information about the R-help mailing list