0

I have two continuous variables in a scatterplot, which do not behaviour linearly, but rather in a potenz/allometric fashion (y=a*x^b). In my case, I look at size and weight data (typical biological dataset).

The data look like this: Length(mm): 26...156 {81} Dry weight(mg): 11...254 {81}

Two questions:

  1. How do I add a power equation regression line using stat_smooth to my dataset?
  2. How can I test my dataset for significance of size on weight?

Thanks!

F

OceanSun3
  • 31
  • 4
  • Please see [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and [Help me Help you](https://speakerdeck.com/jennybc/reprex-help-me-help-you). If possible, ensure your question/problem is reproducible by sharing a sample of your data. You can use the [datapasta](https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html) package and/or the [dput](https://stackoverflow.com/questions/49994249/example-of-using-dput) function to assist you. – jared_mamrot Jun 28 '20 at 23:23

1 Answers1

1

The relationship you are describing is called a "quadratic" relationship (y corresponds to x to the power of some constant value b). Therefore, you can use a quadratic model. The easiest way is to add a column to your data which has the value of y to the power of b (let's call it y_b) and use that in the lm() function. This tutorial can show you how.

As for testing the significance of the relationship between the two variables, you can look at the p-value of the coefficient assigned to the y_b variable.

Merik
  • 2,767
  • 6
  • 25
  • 41