[R] panel.curve

Gabor Grothendieck ggrothendieck at gmail.com
Wed Sep 27 18:51:32 CEST 2006


Look at the arguments to panel.curve

   ?panel.curve

and try RSiteSearch("panel.curve") for some examples.


On 9/27/06, jessica.gervais at tudor.lu <jessica.gervais at tudor.lu> wrote:
> Hi,
>
> I am trying to fit experimental points by exponemtial curve
>
> 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
>
>
> xyplot(log(data[,3])~data[,2]|data[,1],panel=function(x,y){panel.xyplot(x,y)+panel.abline(coef(lm(y~x)))})
> and I get perfect linear regression of my points
>
> ...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))[1])})
>
> 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 ?
>
>
> Thanks by advance
>
> Jessica Gervais
>
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list