R/boot.orlm.R

boot.orlm <- function (model, B = 1000, fixed = FALSE, ui, ci, index, meq) 
{
    ## check for admissible model
    if (!("lm" %in% class(model))) 
        stop("ERROR: model must be of class lm.")
    ## prepare data for bootstrap sampling
    resp <- attr(model$terms, "response")
    xcol <- which(rowSums(attr(model$terms, "factors")) > 0)
    DATA <- as.data.frame(model$model[, c(resp, xcol)])
    wt <- weights(model)
    if (is.null(wt)) 
        wt <- rep(1/nrow(DATA), nrow(DATA))
    if (!fixed) 
        booterg <- boot(cbind(wt = wt, DATA), orlm_forboot, B, 
            ui = ui, ci = ci, index = index, meq = meq)
    else {
        e <- model$residuals
        fit <- model$fitted.values
        booterg <- boot(data.frame(DATA, fit = fit, e = e), orlm_forboot.fixed, 
            B, ui = ui, ci = ci, index = index, meq = meq)
    }
    booterg
}

Try the ic.infer package in your browser

Any scripts or data that you put into this service are public.

ic.infer documentation built on Oct. 5, 2023, 5:09 p.m.