Learn R Programming

desk (version 1.1.2)

par.f.test: F-test on Multiple Linear Combinations of Estimated Parameters in a Linear Model

Description

Performs an F-test (non-directional) on multiple (L) linear combinations of parameters in a linear model.

Usage

par.f.test(
  mod,
  data = list(),
  nh,
  q = rep(0, dim(nh)[1]),
  sig.level = 0.05,
  details = FALSE,
  hyp = TRUE
)

Value

A list object including:

hypcharacter matrix of hypotheses (if hyp = TRUE).
nhlinear combinations tested in the null hypothesis (in matrix form).
qvector of values the linear combinations are tested on.
modthe model passed to par.f.test.
resultsa data frame of basic test results.
SSR.H0sum of squared residuals in H0-model.
SSR.H1sum of squared residuals in regular model.
nulldisttype of the null distribution with its parameters.

Arguments

mod

model object estimated by ols() or lm().

data

name of the data frame to be used if mod is only a formula.

nh

matrix of the coefficients of the linear combination of parameters. Each of the L rows of that matrix represents a linear combination.

q

L-dimensional vector of values on which the parameter (combination) is to be tested against. Default value is the null-vector.

sig.level

significance level. Default value: sig.level = 0.05.

details

logical value indicating whether specific details about the test should be returned.

hyp

logical value indicating whether the hypotheses should be part of the output. To be disabled if output is too large.

Details

Objects x generated by par.f.test can be plotted using plot(x, plot.what = ...). Argument plot.what can have the following values:

"dist"plot the null distribution, test statistics and p-values.
"ellipse"plot acceptance ellipse.

If plot.what = "ellipse" is specified, further arguments can be passed to plot():

type = "acceptance"plot acceptance ellipse ("acceptance") or confidence ellipse ("confidence").
which.coef = c(2,3)for which two coefficients should the ellipse be plotted?
center = TRUEplot center of ellipse.
intervals = TRUEplot interval borders.
test.point = TRUEplot the point (q-values or coefficients) used in F-Test.
q = c(0,0)the q-value used in acceptance ellipse.
sig.level = 0.05significance level used.

Examples

Run this code
## H0: beta1 = 0.33 and beta2 = 0
x <- par.f.test(barley ~ phos + nit, data = log(data.fertilizer),
                 nh = rbind(c(0,1,0), c(0,0,1)),
                 q = c(0.33,0.33),
                 details = TRUE)
x # Show the test results

plot(x) # Visualize the test result
plot(x, plot.what = "ellipse", q = c(0.33, 0.33))

Run the code above in your browser using DataLab