waldt | R Documentation |
This is the one the students call the "fancy t test". It is just
the simplest, most easy to use version of the t test to decide if
2 coefficients are equal. It is not as general as other functions
in other packages. This is simpler to use for beginners. The
car
package's function linearHypothesis
is more
general, but its documentation is much more difficult to understand.
It gives statistically identical results, albeit phrased as an F
test.
waldt(parm1, parm2, model, model.cov = NULL, digits = getOption("digits"))
parm1 |
A parameter name, in quotes! |
parm2 |
Another parameter name, in quotes! |
model |
A fitted regression model |
model.cov |
Optional, another covariance matrix to use while calculating the test. Primarily used for robust (or otherwise adjusted) standard errors |
digits |
How many digits to print? This affects only the on-screen printout. The return object is numeric, full precision. |
I did this because we have trouble understanding terminology in documentation for more abstract functions in other R packages.
It has an additional feature, it can import robust standard errors to conduct the test.
A vector with the difference, std. err., t-stat, and p value. Prints a formatted output statement.
Paul Johnson pauljohn@ku.edu
mdat <- data.frame(x1 = rnorm(100), x2 = rnorm(100)) stde <- 2 mdat$y <- 0.2 * mdat$x1 + 0.24 * mdat$x2 + stde * rnorm(100) m1 <- lm(y ~ x1 + x2, data = mdat) waldt("x1", "x2", m1) waldt("x1", "x2", m1, digits = 2) ## Returned object is not "rounded characters". It is still numbers stillnumeric <- waldt("x1", "x2", m1, digits = 2) stillnumeric ## Equivalent to car package linearHypothesis: if(require(car)){ linearHypothesis(m1, "x1 = x2") } ## recall t = sqrt(F) for a 1 degree of freedom test. ## If we could understand instructions for car, we probably ## would not need this function, actually.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.