basicTrendline (version 2.0.3)

SSpower2P: Self-Starting Nls 'power2P' Regression Model

Description

This selfStart model evaluates the power regression function (formula as: y=a*x^b). It has an initial attribute that will evaluate initial estimates of the parameters 'a' and 'b' for a given set of data.

Usage

SSpower2P(predictor, a, b)

Arguments

predictor

a numeric vector of values at which to evaluate the model.

a, b

The numeric parameters responsing to the exp2P model.

See Also

trendline, SSexp3P, SSpower3P, nls, selfStart

Examples

Run this code
# NOT RUN {
library(basicTrendline)
x<-1:5
y<-c(2,4,8,20,25)
xy<-data.frame(x,y)
getInitial(y ~ SSpower2P(x,a,b), data = xy)
## Initial values are in fact the converged values

fitpower2P <- nls(y~SSpower2P(x,a,b), data=xy)
summary(fitpower2P)

# }

Run the code above in your browser using DataLab