I am trying to perform regression analysis of plotted points with the generalized additive model gam () using R, which is statistical software.

I applied it to my dataset using gam (), a function that can reproduce the generalized additive model in R, but the result of the execution is only linear (y = ax + b) no matter how many times it is executed. , I can't approximate the curve I want to do.
The name of the text data of the dataset to be used is dataset1, and the data is plotted with ΔZ on the vertical axis and I on the horizontal axis.

In my dataset, the horizontal axis (I) is discrete data, and each value of the data takes an integer value from 1 to 14. On the other hand, it is possible that taking continuous values ​​on the vertical axis (ΔZ) may not match the algorithm of the generalized additive model well, but I have no knowledge about that and my powerlessness. I am keenly aware ... If i know anything, please let me know.

Corresponding source code
library (mgcv)
gam.model<-gam (ΔZ ~ s (I), data = dataset1)
plot (gam.model, residuals = T, se = T, pch = ".", "main = result of leveling spline", cex.main = 2)
What I tried

I have made a plot, but I haven't tried anything else because I don't understand why the curve approximation is not done (it becomes a linear approximation).

Supplementary information (FW/tool version, etc.)

The PC used is a Macbook Pro.
The version of R is 4.0.3.

  • Answer # 1

    The gam model will be considered even if it is linear. So, in this case, it's not that something is wrong, it seems that it is not wrong in the interpretation that the alignment was suitable for the regression analysis result. Thank you very much.