I have a dataframe, with
### create sample data
set.seed(1)
x = runif(n = 100, 0, 20)
beta1 = 2
beta2 = 1
beta3 = (1/2)
### Create sample data frame and vector
y = beta1 + beta2*x^(beta3) + rnorm(n = 100, 0, 0.01)
data = as.data.frame(cbind(y,x))
### Fitting the data with nls()-function;
fit1 = nls(
y~vb1(x,beta1,beta2,beta3),
data=data,start=list(beta1 = 0, beta2 = 1, beta3 = 1)
)
where
vb1 = function(x,beta1,beta2,beta3){
beta1 + beta2*x^(beta3)
}
In the end I want to plot the output:
plot(y~x, col = 3)
nlsTracePlot(fit1,vb1(x,beta1,beta2,beta3),legend="bottomright")
However, it gives the following error,
3. stop(gettextf("'%s' is not a function, character or symbol", deparse(FUN)), domain = NA) 2. match.fun(fun) 1. nlsTracePlot(fit1, vb1(x, beta1, beta2, beta3), legend = "bottomright")
Everything works just fine, until I try to plot it with the above function.