I've tried others initial solutions and the adjustement was done to power model in ggplot - geom_smooth. But, with "nls" I can't do the confidence interval with ggplot - geom_smooth? I read that with "nls" we have to force "se=FALSE". Is this true? How can I draw confidence interval in the plot?
I've done this: > ggplot(data,aes(x = idade,y = v_mt)) + + geom_point(alpha=2/10, shape=21,fill="darkgray", colour="black", size=3) + + geom_smooth(method = 'nls', formula = y ~ a * x^b, start = list(a=1,b=2),se=FALSE) > And then I don't have the confidence interval. If I do: > ggplot(data,aes(x = idade,y = v_mt)) + + geom_point(alpha=2/10, shape=21,fill="darkgray", colour="black", size=3) + + geom_smooth(method = 'nls', formula = y ~ a * x^b, start = list(a=1,b=2)) Error in pred$fit : $ operator is invalid for atomic vectors > Return error... Ty, Catarina Silva -----Original Message----- From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent: sábado, 7 de Novembro de 2015 01:09 To: bolseiro.raiz.csi...@portucelsoporcel.com; R mailling list Subject: Re: [R] [GGplot] Geom_smooth with formula "power"? Does [1] help? [1] http://stackoverflow.com/questions/10528631/add-exp-power-trend-line-to-a-ggplot --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On November 6, 2015 2:41:18 AM PST, Catarina Silva <bolseiro.raiz.csi...@portucelsoporcel.com> wrote: >Hi, > >It's possible to use ggplot and geom_smooth to adjust a power curve to >the data? > >Initially i have done the adjustement with nls and the formula 'a*x^b', >but resulted the singular matrix error for start solution. >Alternatively I used the log transformation and i had correct results, >but I can't draw a power curve on the graphic. > >Someone know how to solve this problem? > > > >Ty, > > > >Catarina Silva > > >Imprima no nosso papel - Cuide do ambiente >-------------------------- >Print on our paper - Care for the environment. >-------------------------- >http://backoffice.portucelsoporcel.net/dynamic-media/files/utilizar_papel_e_promover_o_desenvolvimento_da_floresta.pdf > >______________________________________________ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >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. Imprima no nosso papel - Cuide do ambiente -------------------------- Print on our paper - Care for the environment. -------------------------- http://backoffice.portucelsoporcel.net/dynamic-media/files/utilizar_papel_e_promover_o_desenvolvimento_da_floresta.pdf ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.