View source: R/rms_SandwichAddon.R
bread.ols | R Documentation |
vcovHC
The original bread.lm
uses the summary.lm
function
it seems like a quick fix and I've therefore created
the original bread definition: $(X'X)^-1$
## S3 method for class 'ols' bread(x, ...)
x |
The |
... |
arguments passed to methods. |
matrix The bread for the sandwich vcovHC
function
# Generate some data n <- 500 x1 <- runif(n) * 2 x2 <- runif(n) y <- x1^3 + x2 + rnorm(n) library(rms) library(sandwich) dd <- datadist(x1, x2, y) org.op <- options(datadist = "dd") # Main function f <- ols(y ~ rcs(x1, 3) + x2) # Check the bread bread(f) # Check the HC-matrix vcovHC(f, type = "HC4m") # Adjust the model so that it uses the HC4m variance f_rob <- robcov_alt(f, type = "HC4m") # Get the new HC4m-matrix # - this function just returns the f_rob$var matrix vcov(f_rob) # Now check the confidence interval for the function confint(f_rob) options(org.op)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.