1### methods for extracting standard errors from the models 2 3stdEr <- function(x, ...) 4 ## Extract standard deviations from models (as coefficients) 5 UseMethod("stdEr") 6 7stdEr.default <- function(x, ...) { 8 if( !isS4( x ) ) { 9 if( !is.null( x$std ) ) { 10 return(x$std) 11 } 12 } 13 if(!is.null(vc <- vcov(x))) { 14 s <- sqrt(diag(vc)) 15 names(s) <- names(coef(x)) 16 return(s) 17 } 18 return(NULL) 19 # if neither std nor vcov is defined, we return NULL... 20} 21 22stdEr.lm <- function(x, ...) 23 sqrt(diag(vcov(x))) 24 25