Takes a fitted scam
object produced by scam()
and produces various useful
summaries from it. The same code as in summary.gam
of the mgcv
package is used here with slight modifications
to accept the exponentiated parameters of the shape constrained smooth terms and the corresponding covariance matrix.
# S3 method for scam
summary(object, dispersion=NULL, freq=FALSE, ...)# S3 method for summary.scam
print(x,digits = max(3, getOption("digits") - 3),
signif.stars = getOption("show.signif.stars"),...)
summary.scam
produces the same list of summary information for a fitted scam
object as in the
unconstrained case summary.gam
except for the last element BFGS termination condition
.
is an array of estimates of the strictly parametric model coefficients.
is an array of the p.coeff
's divided by their standard errors.
is an array of p-values for the null hypothesis that the corresponding parameter is zero. Calculated with reference to the t distribution with the estimated residual degrees of freedom for the model fit if the dispersion parameter has been estimated, and the standard normal if not.
The number of smooth terms in the model.
An array of test statistics for assessing the significance of model smooth terms. See details.
An array of approximate p-values for the null hypotheses that each smooth term is zero. Be warned, these are only approximate.
array of standard error estimates for all parameter estimates.
The adjusted r-squared for the model. Defined as the proportion of variance explained, where original variance and residual variance are both estimated using unbiased estimators. This quantity can be negative if your model is worse than a one parameter constant model, and can be higher for the smaller of two nested models! Note that proportion null deviance explained is probably more appropriate for non-normal errors.
The proportion of the null deviance explained by the model.
array of estimated degrees of freedom for the model terms.
estimated residual degrees of freedom.
number of data.
minimized GCV score for the model, if GCV used.
minimized UBRE score for the model, if UBRE used.
estimated (or given) scale parameter.
the family used.
the original scam formula.
the scale parameter.
the degrees of freedom associated with each parameteric term (excluding the constant).
a Wald statistic for testing the null hypothesis that the each parametric term is zero.
p-values associated with the tests that each term is zero. For penalized fits these are approximate. The reference distribution is an appropriate chi-squared when the scale parameter is known, and is based on an F when it is not.
The estimated covariance matrix of the parameters (or
estimators if freq=TRUE
), divided
by scale parameter.
The estimated covariance matrix of the parameters
(estimators if freq=TRUE
).
significance table for parameters
significance table for smooths
significance table for parametric model terms
the value of the maximum component of the scaled GCV/UBRE gradient used as stopping
condition. This value is printed if
the termination code of the BFGS optimization process is not `1' (not full convergence)
(see bfgs_gcv.ubre
for details)
a fitted scam
object as produced by scam()
.
a summary.scam
object produced by summary.scam()
.
A known dispersion parameter. NULL
to use estimate or
default (e.g. 1 for Poisson).
By default p-values for individual terms are calculated using the Bayesian estimated covariance matrix of the parameter estimators. If this is set to TRUE then the frequentist covariance matrix of the parameters is used instead.
controls number of digits printed in output.
Should significance stars be printed alongside output.
other arguments.
Natalya Pya <nat.pya@gmail.com> based on mgcv
by Simon Wood
The p-values are approximate.
Wood S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press.
Pya, N. and Wood, S.N. (2015) Shape constrained additive models. Statistics and Computing, 25(3), 543-559
Pya, N. (2010) Additive models with shape constraints. PhD thesis. University of Bath. Department of Mathematical Sciences
scam
if (FALSE) {
## simulating data...
require(scam)
n <- 200
set.seed(1)
x1 <- runif(n)*6-3
f1 <- 3*exp(-x1^2) # unconstrained smooth term
x2 <- runif(n)*4-1;
f2 <- exp(4*x2)/(1+exp(4*x2)) # monotone increasing smooth
x3 <- runif(n)*5;
f3 <- -log(x3)/5 # monotone decreasing smooth
f <- f1+f2+f3
y <- f + rnorm(n)*.3
dat <- data.frame(x1=x1,x2=x2,x3=x3,y=y)
## fit model ...
b <- scam(y~s(x1,k=15,bs="cr",m=2)+s(x2,k=30,bs="mpi",m=2)+s(x3,k=30,bs="mpd",m=2),
data=dat)
summary(b)
plot(b,pages=1,shade=TRUE)
}
Run the code above in your browser using DataLab