How to calculate Power Regression in R (Step-by-Step Guide)

Power Regression in R, Power regression is a non-linear regression technique that looks like this:

y = ax^b


y: The response variable

x: The predictor variable

a, b: The coefficients of regression used to describe the relationship between x and y.

When the response variable is equal to the predictor variable raised to a power, this sort of regression is utilized to represent the scenario.

Power Regression in R

In R, the following example explains how to run power regression for a given dataset step by step.

Step 1: Collect data

Let’s start by making some fictitious data for two variables: x and y.

y<-c(10, 28, 15, 17, 65, 120, 115, 119, 123,100)

Step 2: Create a visual representation of the data

Then, to visualise the relationship between x and y, let’s make a scatterplot:

plot(x, y)

We can observe from the graph that the two variables have a strong power relationship. As a result, fitting a power regression equation to the data rather than a linear regression model appears to be a decent option.

Step 3: Fit the Power Regression Model

Next, we’ll use the lm() function to fit a regression model to the data, indicating that R should fit the model using the logs of the response and predictor variables:

model <- lm(log(y)~ log(x))

Now we view the output of the model

lm(formula = log(y) ~ log(x))
    Min      1Q  Median      3Q     Max
-0.9251 -0.1743  0.1661  0.2879  0.5404
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)   2.0869     0.3858   5.410 0.000639 ***
log(x)        1.2056     0.2320   5.197 0.000826 ***
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.5102 on 8 degrees of freedom
Multiple R-squared:  0.7715,       Adjusted R-squared:  0.7429
F-statistic:    27 on 1 and 8 DF,  p-value: 0.0008258

The overall F-value of the model is 27 and the corresponding p-value is extremely small (0.0008258), which indicates that the model as a whole is useful.

We can see that the fitted power regression equation is: Using the coefficients from the output table, we can see that the fitted power regression equation is:

ln(y) = 2.0869 + 1.2056*log(x)

Based on the value of the predictor variable, x, we can use this equation to predict the responder variable, y.

For example, if x = 5, then we would predict that y value.

ln(y) = 2.0869+1.2056log(5) = 9.669329

Subscribe to our newsletter!

[newsletter_form type=”minimal”]

You may also like...

Leave a Reply

Your email address will not be published.