Wald Test in MCMC estimation

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
Post Reply
vivian1234
Posts: 30
Joined: Tue Apr 12, 2016 10:54 am

Wald Test in MCMC estimation

Post by vivian1234 »

Hello,

I understand that I can use linearHypothesis function from the car library to calculate Wald Test for categorical variable if I use IGLS estimation. However, when I applied the same function on my result generated by MCMC estimation, it gave the following error:

Code: Select all

Error: $ operator not defined for this S4 class
In this case, can you kindly advice how can I conduct Wald Test if MCMC estimation is used?
Thank you very much.

Regards,
Vivian
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Wald Test in MCMC estimation

Post by ChrisCharlton »

Wald tests are normally associated with frequentist estimation methods and make assumptions such as normality, which is why we haven't implemented the mechanisms needed to support this for MCMC. If you are only wanting to use it for approximate tests then running the following code prior to calling linearHypothesis will allow the function to succeed for models fitted with MCMC:

Code: Select all

df.residual.mlwinfitMCMC <- function(object, ...) {
    nobs(object) - length(coef(object))
}
GerineLodder
Posts: 42
Joined: Thu Jul 28, 2016 11:33 am

Re: Wald Test in MCMC estimation

Post by GerineLodder »

I currently have a model wich I ran in MCMC, for which I want to compare the effects of 2 interventions with a control condotion.
So I have 2 dummies, Intervention1, and Intervention2 (both compared to those with no intervention).

My hypothesis is that there is actually no difference between these 2 interventions. Could I simply look at the quantiles of both, and see if their confidence intervalls overlap?
Is there a way to formally test whether there is a difference between the 2 conditions using MCMC?
billb
Posts: 157
Joined: Fri May 21, 2010 1:21 pm

Re: Wald Test in MCMC estimation

Post by billb »

Hi Gerine,
A better approach would be to extract the chains for the 2 dummies and subtract their values as this would then give you a chain for the differences. You could then look to see if the quantiles of this chain contain 0. This is better as it will deal with any correlation between the parameters.
Best wishes,
Bill.
Post Reply