bc.test | R Documentation |
Box-Cox test for functional form. Compares a base model with non transformed endogenous variable to a model with logarithmic endogenous variable. Exogenous variables can be transformed or non-transformed. The object of test results returned by this command can be plotted using the plot()
function.
bc.test(
basemod,
data = list(),
exo = "same",
sig.level = 0.05,
details = TRUE,
hyp = TRUE
)
basemod |
estimated linear model object or formula taken as the base model for comparison. Has to have a non-transformed endogenous variable. |
data |
if |
exo |
vector or matrix of transformed exogenous variables to be used in the comparison model. If not specified the same variables from the base model are used ("same"). |
sig.level |
significance level. Default value: |
details |
logical value indicating whether specific details about the test should be returned. |
hyp |
logical value indicating whether the Hypotheses should be returned. |
A list object including:
hyp | character matrix of hypotheses (if hyp = TRUE ). |
results | a data frame of basic test results. |
stats | additional statistic of aux. regression. |
nulldist | type of the Null distribution with its parameters. |
Box, G.E.P. & Cox, D.R. (1964): An Analysis of Transformations. Journal of the Royal Statistical Society, Series B. 26, 211-243.
boxcox
.
## Box-Cox test between a semi-logarithmic model and a logarithmic model
semilogmilk.est <- ols(milk ~ log(feed), data = data.milk)
results <- bc.test(semilogmilk.est, details = TRUE)
## Plot the test results
plot(results)
## Example with transformed exogenous variables
lin.est <- ols(rent ~ mult + mem + access, data = data.comp)
A <- lin.est$data
bc.test(lin.est, exo = log(cbind(A$mult, A$mem, A$access)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.