I would like to get the inverse function of my GAM. Here is my modeling code:
y <- c(0.0000943615,0.0074918919,0.0157332851,0.0783308615, 0.1546375803,0.5558444681,0.8583806898,0.9617216854, 0.9848004112,0.9964662546) x <- log(c(0.05, 0.1, 0.15, 0.2, 0.4, 0.8, 1.6, 3.2, 4.5, 6.4)) fit.gam <- gam(y~s(x,k=-1, bs="cr"),family=betar(link="logit"))
I used the natural cubic regression spline with
I would like to know the
x and its confidence interval that leads to
The most straightforward solution is to find the corresponding knots (
x_j+1) and the formula when
x_j < x < x_j+1, then
x=f(beta|y,x_j,x_j+1). However, when I check the formula in the book written by Dr. Wood, it is not easy to write the formula down.
On Pg.145, the book indicates the formula for cubic regression splines (after formula (4.3)) to include a matrix of
F, which is consist of other two matrices
I can write the other parts down, but I am not sure about
D matrix. For
B, I think it is a 2x2 matrix, but for
D, the illustration looks like it is a 1x3 matrix?
Could you give me an insight on whether it is a good way to find the inverse function? If yes, how should I construct the D matrix?
Edits based on comments:
B and D matrices are used to construct the F matrix. My goal is to write the
f(x) formula (the one under equation (4.3)) out so that I can manually do the inverse function.
I hope this helps.
Yes. I would like to do inverse prediction with the coefficients fitted by GAM.
Here, I assume my regression model is monotone. It comes with some outliers, so I use GAM to help me penalize the parameter estimates.