I would like to know how can I be able to interpret the results from fitting splines with the scam package.

My data points are taken from the chileancredit dataset available in the package smbinning.

Here are my x and y data points:

data(chileancredit, package = "smbinning")
chilean_clean <- na.omit(chileancredit)
x <- unique(sort(chilean_clean$TOB[1000:length(chilean_clean$TOB)]))
y_mav <- rollmean(chilean_clean$FlagGB, k = 1000)
y <- y_mav[(length(y_mav)-length(x)+1):length(y_mav)]

y is the moving average of a binary target variable.

With the scam function I could fit a convex spline to my datapoints (I specified 5 parameters in total):

spline_fit <- scam(y~ s(x,k=5,bs="cx",m=2),

However, the five coefficients I could get from scam, I'm having trouble interpreting them:

(Intercept)      s(x).1      s(x).2      s(x).3      s(x).4 
   0.9275358  -4.3564887  -4.8378830  -4.8522646  -4.8950387 

The first term is the intercept, however I've lookup up in the results of scam for knots or cuts - seems like there is none. I don't know how I could interpret the smoothing parameters without the knots. Anyone has any idea? Thanks.

  • 1
    $\begingroup$ The s(x).i terms are the penalised regression coefficients for the 4 basis functions in the model, they're not smoothness parameters. You code isn't working for me; I get an error that the x and y lengths differ. Can you run your code in a clean session and update as needed? Then I'll take a closer look. $\endgroup$ Apr 28, 2017 at 15:46
  • $\begingroup$ @GavinSimpson thank you I fixed the code and now it should be reproducible. $\endgroup$
    – user95902
    Apr 29, 2017 at 7:45

1 Answer 1


Well after reading this Wood S.N. (2006) Generalized Additive Models: An Introduction with R, the coefficients from the output are difficult in giving a valid interpretation. But with predict.gam from package mgcv they can be directly applied in prediction.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.