0

How can I fit a curve of the type $$Y = aX^b$$ using R?

I'm able to fit a linear model (Y = aX + b) using

fit <- lm(y~x)

but my data requires Y = aX^b

kobe1503
  • 3
  • 2

1 Answers1

0

nls(y ~ a*x^b, start = list(a = 1, b = 1), data = your_data), or lm(log(y) ~ log(x), data = your_data) (these are different models but either might serve you; the parameters of the second model are log(a) and b). You might need to adjust the starting values to work with your data.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453