saws | R Documentation |
This function takes an object from a regression function and gives confidence intervals and p-values using the sandwich estimator of variance corrected for small samples.
saws(x,test = diag(p), beta0 = matrix(0, p, 1), conf.level = 0.95, method = c("d3", "d5", "d1", "d2", "d4", "dm"),bound=.75)
x |
a list containing three elements: coefficients, u, omega (see details) |
test |
either a numeric vector giving elements of coefficient to test, or an r by p matrix of constants for testing (see details) |
beta0 |
null parameters for testing (see details) |
conf.level |
level for confidence intervals |
method |
one of "d3", "d5", "d1", "d2", "d4", or "dm" (see details) |
bound |
bound for bias correction, denoted b in Fay and Graubard, 2001 |
Typically, the x object is created in a specialized function. Currently there are three such functions,
link{lmfitSaws}
,geeUOmega
and clogistCalc
. The function lmfitSaws
is a simple linear model function that creates all the output needed. The function geeUOmega
takes output from the gee function of the gee package
and creates the 'u' matrix and the 'omega' array. The 'coefficients' is a vector with p parameter
estimates, and is a standard output from the regression. The matrix 'u' is K by p with u[i,] the ith
estimating equation, where there are K approximately independent estimating equations. The array 'omega' is K by p by p
where omega[i,,] is a p by p matrix estimating - du/dbeta (here beta=coefficients). See Fay and Graubard (2001) for details.
Suppose that the coefficient vector from the regression is beta. Then we test r hypotheses, based on the the matrix product, TEST (beta-beta0)=0, where TEST is an r by p matrix. If the argument 'test' is an r by p matrix (where r is arbitrary), then TEST=test. If 'test' is a vector, then each element of test corresponds to testing that row of beta is 0, i.e., TEST<-diag(p)[test,], where p is the length of the coefficient vector. For example, test<-c(2,5), tests that beta[2]-beta0[2]=0 and that beta[5]-beta0[5]=0. The alternatives are always two-sided.
There are several methods available. They are all discussed in Fay and Graubard (2001). The naming of the methods follows that paper (see for example Table 1, where deltam corresponds to dm, etc.):
the usual model based method which does not use the sandwich, uses a chi squared distribution
the standard sandwich method which makes no corrections for small samples
sandwich method, no bias correction, uses F distribution with df=dhat (see paper)
(default method:sandwich method, no bias correction, uses F distribution with df=dtilde (see paper)
sandwich method, with bias correction, uses F distribution with df=dhatH (see paper)
sandwich method, with bias correction, uses F distribution with df=dtildeH (see paper)
An object of class 'saws'. A list with elements:
originalCall |
call from the original object |
method |
method used (see details) |
test |
test matrix (see details) |
beta0 |
beta0 vector (see details) |
coefficients |
estimated coefficients |
df |
a vector of estimated degrees of freedom. This will have as many elements as there are coefficients |
V |
variance-covariance matrix |
se |
vector of standard errors of the coefficients |
t.value |
a vector of t-values: test (coef - beta0)/se |
p.value |
a vector of two-sided p-values |
conf.int |
p by 2 matrix of confidence intervals |
For versions prior to 0.9-7.0, when there was an offset in the formula, the results where incorrect. See the NEWS file.
M.P. Fay
Fay and Graubard (2001). Small-Sample Adjustments for Wald-Type Tests Using Sandwich Estimators. Biometrics 57: 1198-1206. (for copy see /inst/doc/ directory)
For examples, see geeUOmega
and clogistCalc
. See also print.saws
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.