Dear list,


I fitted the same GAM model using directly the function gam(mgcv) ... then
as a parameter of another function that capture the warnings messages (see
below).
In the first case, there is no warning message printed, but in the last
one, the function find two warning messages stating "matrix not positive
definite"

So my question is: Do I have to worry about those warnings and then why are
they not printed in the simple use of the gam function.

#####################################################

Here is some further description:

## Simple use of gam

gam(USE ~ X1 + s(X2) + s(X3), family = binomial, data = data,
method="REML") # print no warning message.

## Using a function that capture warnings

Model_n_Warnings <- function(expr) {
            localWarnings <- list()
            outModel <- withCallingHandlers(expr,
            warning = function(w) {
            localWarnings[[length(localWarnings)+1]] <<- w$message  # store
warning message
            invokeRestart("muffleWarning") # avoid printing warning message
to console
            })
            list(outModel=outModel, warnings=localWarnings)
  }

out <- Model_n_Warnings (gam(USE ~ X1 + s(X2) + s(X3), family = binomial,
data = data, method="REML"))

out$warnings

[[1]]
[1] "matrix not positive definite"

[[2]]
[1] "matrix not positive definite"


Thanks,

Arnaud

	[[alternative HTML version deleted]]

