ols_BP_test_calc: ols_BP_test_calc

View source: R/ols_BP_test_calc.R

ols_BP_test_calcR Documentation

ols_BP_test_calc

Description

Function computes the Breusch-Pagan Test for heteroskedasticity involving OLS models

Performs the BP-test from submitted lm formula and data frame.

Background for creating this function was from "Using R for Introductory Econometrics" by Florian Heiss, page 147.

Usage

ols_BP_test_calc(df = NULL, formula_obj = NULL)

Arguments

df

A data frame with columns for observed response and predictors

formula_obj

A formula object following the rules of stats::lm() construction. For example: y ~ log(a) + b + I(b^2).

Value

Returning a list with the BP statistic and its p-value.

Examples

library(wooldridge)
library(RregressPkg)

price_formula_obj = stats::as.formula("price~lotsize+sqrft+bdrms")
bp_lst <- RregressPkg::ols_BP_test_calc(
  df = wooldridge::hprice1,
  formula_obj = price_formula_obj
)


deandevl/RregressPkg documentation built on Feb. 5, 2025, 12:11 p.m.