R/Wald.R

Defines functions Wald

Documented in Wald

Wald <-
function( obj, H0=0, ... )
{
rl <- ci.lin( obj, ..., vcov=TRUE )
beta <- rl$coef
vcov <- rl$vcov
if( missing( H0 ) ) H0 <- beta*0
if( length(H0) != length(beta) ) stop( "H0 has length ", length(H0),
          " but the set of selected parameters has length ",
          length(beta), ":\n",
          paste(round(beta,options()[["digits"]]),collapse=" ") )
chi <- t( beta-H0 ) %*% solve( vcov, beta-H0 )
 df <- length(beta)
  p <- 1 - pchisq( chi, df )
c( "Chisq"=chi, "d.f."=df, "P"=p )
}

Try the Epi package in your browser

Any scripts or data that you put into this service are public.

Epi documentation built on April 25, 2023, 9:09 a.m.