# R and Predictions

If I use linear model, generalized linear model, partial least squares etc packages in R, and train it where, given key response variable RSP, the formula argument is of the form:

formula <- as.formula("f(RSP)~A + B + C") # use A,B,C predictors only


or

formula <- as.formula("f(RSP)~.") # use ALL predictors


and f(RSP) is some transformation function, such that:

f <- function(x){...}


when I then predict after training, would the returned prediction set need to have the anti-function applied? If P <- predict(...) is P of the form RSP or f(RSP), such that the true prediction: Pt, - needs to have the antifunction g(P) applied?

If you want to do this for general f then I guess you'll want to write yourself a family object and hand that to glm.
There are examples in the help page for family. See in particular the parameterised logexp function, which makes a fancy parameterised link function which is added to a more traditional distribution assumption and then handed to glm. I'm guessing that's your case. This will, as you suspect, require both f and its inverse function, plus some other stuff.
Once that's in place, predict(model, newdata=blah, type='response') should (although I admit I have not checked) give you the expected response, and you'll get the linear predictor by leaving out type, as is R's odd default behaviour.