View source: R/BIFIE.waldtest.R
BIFIE.waldtest | R Documentation |
This function performs a Wald test for objects of classes
BIFIE.by
,
BIFIE.correl
, BIFIE.crosstab
, BIFIE.freq
,
BIFIE.linreg
, BIFIE.logistreg
and BIFIE.univar
.
BIFIE.waldtest(BIFIE.method, Cdes, rdes, type=NULL) ## S3 method for class 'BIFIE.waldtest' summary(object,digits=4,...)
BIFIE.method |
Object of classes |
Cdes |
Design matrix C (see Details) |
rdes |
Design vector r (see Details) |
type |
Only applies to |
object |
Object of class |
digits |
Number of digits for rounding output |
... |
Further arguments to be passed |
The Wald test is conducted for a parameter vector \bold{θ}, specifying the hypothesis C \bold{θ}=r. Statistical inference is performed by using the D_1 and the D_2 statistic (Enders, 2010, Ch. 8).
For objects of class bifie.univar
, only hypotheses with respect
to means are implemented.
A list with following entries
stat.D |
Data frame with D_1 and D_2 statistic, degrees of freedom and p value |
... |
More values |
Enders, C. K. (2010). Applied missing data analysis. Guilford Press.
survey::regTermTest
,
survey::anova.svyglm
,
car::linearHypothesis
############################################################################# # EXAMPLE 1: Imputed TIMSS dataset ############################################################################# data(data.timss1) data(data.timssrep) # create BIFIE.dat object bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT, wgtrep=data.timssrep[, -1 ] ) #****************** #*** Model 1: Linear regression res1 <- BIFIEsurvey::BIFIE.linreg( bdat, dep="ASMMAT", pre=c("one","books","migrant"), group="female" ) summary(res1) #*** Wald test which tests whether sigma and R^2 values are the same res1$parnames # parameter names pn <- res1$parnames ; PN <- length(pn) Cdes <- matrix(0,nrow=2, ncol=PN) colnames(Cdes) <- pn # equality of R^2 ( R^2(female0) - R^2(female1)=0 ) Cdes[ 1, c("R^2_NA_female_0", "R^2_NA_female_1" ) ] <- c(1,-1) # equality of sigma ( sigma(female0) - sigma(female1)=0) Cdes[ 2, c("sigma_NA_female_0", "sigma_NA_female_1" ) ] <- c(1,-1) # design vector rdes <- rep(0,2) # perform Wald test wmod1 <- BIFIEsurvey::BIFIE.waldtest( BIFIE.method=res1, Cdes=Cdes, rdes=rdes ) summary(wmod1) ## Not run: #****************** #*** Model 2: Correlations # compute some correlations res2a <- BIFIEsurvey::BIFIE.correl( bdat, vars=c("ASMMAT","ASSSCI","migrant","books")) summary(res2a) # test whether r(MAT,migr)=r(SCI,migr) and r(MAT,books)=r(SCI,books) pn <- res2a$parnames; PN <- length(pn) Cdes <- matrix( 0, nrow=2, ncol=PN ) colnames(Cdes) <- pn Cdes[ 1, c("ASMMAT_migrant", "ASSSCI_migrant") ] <- c(1,-1) Cdes[ 2, c("ASMMAT_books", "ASSSCI_books") ] <- c(1,-1) rdes <- rep(0,2) # perform Wald test wres2a <- BIFIEsurvey::BIFIE.waldtest( res2a, Cdes, rdes ) summary(wres2a) #****************** #*** Model 3: Frequencies # Number of books splitted by gender res3a <- BIFIEsurvey::BIFIE.freq( bdat, vars=c("books"), group="female" ) summary(res3a) # test whether book(cat4,female0)+book(cat5,female0)=book(cat4,female1)+book(cat5,female5) pn <- res3a$parnames PN <- length(pn) Cdes <- matrix( 0, nrow=1, ncol=PN ) colnames(Cdes) <- pn Cdes[ 1, c("books_4_female_0", "books_5_female_0", "books_4_female_1", "books_5_female_1" ) ] <- c(1,1,-1,-1) rdes <- c(0) # Wald test wres3a <- BIFIEsurvey::BIFIE.waldtest( res3a, Cdes, rdes ) summary(wres3a) #****************** #*** Model 4: Means # math and science score splitted by gender res4a <- BIFIEsurvey::BIFIE.univar( bdat, vars=c("ASMMAT","ASSSCI"), group="female") summary(res4a) # test whether there are significant gender differences in math and science #=> multivariate ANOVA pn <- res4a$parnames PN <- length(pn) Cdes <- matrix( 0, nrow=2, ncol=PN ) colnames(Cdes) <- pn Cdes[ 1, c("ASMMAT_female_0", "ASMMAT_female_1" ) ] <- c(1,-1) Cdes[ 2, c("ASSSCI_female_0", "ASSSCI_female_1" ) ] <- c(1,-1) rdes <- rep(0,2) # Wald test wres4a <- BIFIEsurvey::BIFIE.waldtest( res4a, Cdes, rdes ) summary(wres4a) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.