vcov {npreg} | R Documentation |
Calculate Variance-Covariance Matrix for a Fitted Smooth Model
Description
Returns the variance-covariance matrix for the basis function coefficients from a fit smoothing spline (fit by ss
), smooth model (fit by sm
), or generalized smooth model (fit by gsm
).
Usage
## S3 method for class 'ss'
vcov(object, ...)
## S3 method for class 'sm'
vcov(object, ...)
## S3 method for class 'gsm'
vcov(object, ...)
Arguments
object |
an object of class "gsm" output by the |
... |
other arugments (currently ignored) |
Details
The variance-covariance matrix is calculated using the Bayesian interpretation of a smoothing spline. Unlike the classic treatments (e.g., Wahba, 1983; Nychka, 1988), which interpret the smoothing spline as a Bayesian estimate of a Gaussian process, this treatment applies the Bayesian interpretation directly on the coefficient vector. More specifically, the smoothing spline basis function coefficients are interpreted as Bayesian estimates of the basis function coefficients (see Helwig, 2020).
Value
Returns the (symmetric) matrix such that cell (i,j
) contains the covariance between the i
-th and j
-th elements of the coefficient vector.
Author(s)
Nathaniel E. Helwig <helwig@umn.edu>
References
Helwig, N. E. (2020). Multiple and Generalized Nonparametric Regression. In P. Atkinson, S. Delamont, A. Cernat, J. W. Sakshaug, & R. A. Williams (Eds.), SAGE Research Methods Foundations. doi:10.4135/9781526421036885885
Nychka, D. (1988). Bayesian confience intervals for smoothing splines. Journal of the American Statistical Association, 83(404), 1134-1143. doi:10.2307/2290146
Wahba, G. (1983). Bayesian "confidence intervals" for the cross-validated smoothing spline. Journal of the Royal Statistical Society. Series B, 45(1), 133-150. doi:10.1111/j.2517-6161.1983.tb01239.x
See Also
boot.ss
, boot.sm
, boot.gsm
for bootstrapping
Examples
## for 'ss' objects this function is defined as
function(object, ...){
Sigma <- tcrossprod(object$fit$cov.sqrt)
rownames(Sigma) <- colnames(Sigma) <- names(object$fit$coef)
Sigma
}
## for 'sm' and 'gsm' objects this function is defined as
function(object, ...){
Sigma <- tcrossprod(object$cov.sqrt)
rownames(Sigma) <- colnames(Sigma) <- names(object$coefficients)
Sigma
}