# [R] panel.curve

From: <jessica.gervais_at_tudor.lu>
Date: Wed 27 Sep 2006 - 16:34:33 GMT

Hi,

my data are stored into a matrix data

the first column is the geographical point (a number = data[,1] ) ( I would like to plot several graphes at the same time) the second column is the time of measurement (x in the plot) the third column is a speed (y in the plot)

if we assume the point are folowing this exponential behaviour y=exp(a+bx) then log y = a+ bx
we then can determine the coefficient a and b by a linear regression with the lm function and get them as following : coef ( lm (log(y)~x)) then I can use those coefficient

if I plot ln y = ax+b , everything goes fine

...But I would prefer to plot the exponential curves (y=exp ( a*x + b )).. I tried the following formula :

>

xyplot(data[,3]~data[,2]|data[,1],panel=function(x,y){panel.xyplot(x,y)+panel.curve(coef(lm(log(y)~x)))})

and I get :
Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :

variable lengths differ (found for 'x')

... I don't really now what goes wrong and how to correct that Maybe I am wrong in the use of the pannel.curve function ....

Do anyone know something about that ?

Jessica Gervais

[[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Sep 28 02:47:41 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 27 Sep 2006 - 17:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.