How can i extract the best lambda for boxcox transformation of data?
For the moment, i am using the below code:
best.lamb_1 <-bc.model.lantana_1$x(which(bc.model.lantana_1=max(bc.model.lantana_1$y)))
Error: attempt to apply non-function
You haven't provided any details, but almost surely bc.model.lantana_1$x is a variable, and is not callable. With a variable u, you cannot do u(...), that's possible with functions only. Since your objective is to index it, use [...] instead of (...). That's what giving you this specific error.
Also, note that there's a function which.max. It'll give you only one index, but most probably you're not looking for more than one in this situation.