Learn R Programming

desk (version 1.1.2)

par.t.test: t-Test on Estimated Parameters of a Linear Model

Description

Performs a t-test on a single parameter hypothesis or a hypothesis containing a linear combination of parameters of a linear model. The object of test results returned by this command can be plotted using the plot() function.

Usage

par.t.test(
  mod,
  data = list(),
  nh,
  q = 0,
  dir = c("both", "left", "right"),
  sig.level = 0.05,
  details = FALSE,
  hyp = TRUE
)

Value

A list object including:

hypcharacter matrix of hypotheses (if hyp = TRUE).
nhnull hypothesis as parameters of a linear combination (for internal purposes).
lcombthe linear combination of parameters tested.
resultsa data frame of basic test results.
std.errstandard error of the linear estimator.
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 a formula and the variables are not present in the environment.

nh

vector of the coefficients of the linear combination of parameters.

q

value on which parameter (combination) is to be tested against. Default value: q = 0.

dir

direction of the hypothesis: "both", "left", "right", Default value: "both".

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 returned.

Examples

Run this code
## Test H1: "phos + nit <> 1"
fert.est <- ols(barley ~ phos + nit, data = log(data.fertilizer))
x = par.t.test(fert.est, nh = c(0,1,1), q = 1, details = TRUE)
x # Show the test results

plot(x) # Visualize the test result

## Test H1: "phos > 0.5"
x = par.t.test(fert.est, nh = c(0,1,0), q = 0.5, dir = "right")
plot(x)

Run the code above in your browser using DataLab