my data frame:
library(usl)
dput(df)
structure(list(load = c(1L, 18L, 36L, 72L, 108L, 144L, 216L),
throughput = c(64.9, 995.9, 1652.4, 1853.2, 1828.9, 1775,
1702.2)), .Names = c("load", "throughput"), class = "data.frame", row.names = c(NA,
-7L))
xv=c("load")
yv=c("throughput")
capacity<-c(30)
I create the model using nls:
usl.model <- usl(as.formula(paste(yv, '~', xv)), data = df)
given this model, I need to do some prediction given the growth in load:
growth<-c(20)
pred<-predict(usl.model, data.frame(xv = tail(df[,xv],1)*(1+capacity/100)))
I keep getting this error:
Error in `[.data.frame`(newdata, , object@regr, drop = TRUE) :
undefined columns selected
how do I refer to xv in the predict function? Since xv is variable?