Discussion:
plot with power law line function
anvar sour
2018-02-02 20:51:01 UTC
Permalink
Hi there,

I do appreciate if someone kindly help me that enables me to perform
fitting power-law line between two variable. I have two variable (LnB and
LnC), I want to plot this two variables and then I want to fit regression
line with power-law function across this two variable. Is it possible to
use geom-smooth to adjust a power-law curve?

Thanks for the help in advance.
Best Regards,
Anvar,
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Bin Wang
2018-02-03 05:46:17 UTC
Permalink
just use the nls() function, in which specify the model (power law
function) u use. And below is a link to a post talking about non-linear
fitting.

https://www.r-bloggers.com/first-steps-with-non-linear-regression-in-r/

-Bin
Post by anvar sour
Hi there,
I do appreciate if someone kindly help me that enables me to perform
fitting power-law line between two variable. I have two variable (LnB and
LnC), I want to plot this two variables and then I want to fit regression
line with power-law function across this two variable. Is it possible to
use geom-smooth to adjust a power-law curve?
Thanks for the help in advance.
Best Regards,
Anvar,
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
anvar sour
2018-02-08 08:16:16 UTC
Permalink
Dear Bin Wang,

thanks for your attention, but how I can calculate "a", and "b" for my data
in the following code?
nlm <- nls(Biomass ~ a * I(Coverage^b), start = list(a = ......, b = ......),
data=data)
plot(Biomass ~ Coverage, data=data)
lines(data$Coverage, fitted(nlm), col = "red", lwd = 2)

Best Regards,
Anvar,
Post by anvar sour
Hi there,
I do appreciate if someone kindly help me that enables me to perform
fitting power-law line between two variable. I have two variable (LnB and
LnC), I want to plot this two variables and then I want to fit regression
line with power-law function across this two variable. Is it possible to
use geom-smooth to adjust a power-law curve?
Thanks for the help in advance.
Best Regards,
Anvar,
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...