+ Reply to Thread
Results 1 to 4 of 4

Thread: Help on Bhapkar's Test using SAS/R/SPSS?

  1. #1
    Points: 62, Level: 1
    Level completed: 24%, Points required for next Level: 38

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help on Bhapkar's Test using SAS/R/SPSS?




    Hi All,

    I am currently wandering in the unfamiliar territory of the Bhapkar's test, and hopefully someone can provide some guidance... Please see bottom for my SAS code.

    I am working on an intervention study with two time points T0 and T1. The study included the same questionnaire (categorical data) to be administered at both time points. I would like to see if there is a significant difference between the questionnaire responses at T0 and at T1.

    So I started research on McNemar's test (2x2) and other extensions (Stuart-Maxell, Bhapkar). At the moment I am trying to analyse my data with Bhapkar's test. I have found some useful information here: http://www2.sas.com/proceedings/forum2008/382-2008.pdf.

    However, some of the datasets/questions can be analysed using the SAS code at the bottom. There is an error message " The number of response functions per population, 7, is not a multiple of the product of the number of levels of the factors, 2. You may need the PROFILE option if the design is not a complete factorial."

    Can someone please tell me how to overcome this problem? Or if there is another way to analyze the data using SAS, R or SPSS?


    data test;
    input r c count @@;
    DATALINES;
    1 1 1
    1 2 0
    1 3 0
    1 4 2
    1 5 7
    2 1 0
    2 2 0
    2 3 0
    2 4 1
    2 5 3
    3 1 0
    3 2 0
    3 3 1
    3 4 7
    3 5 6
    4 1 2
    4 2 0
    4 3 2
    4 4 29
    4 5 51
    5 1 3
    5 2 0
    5 3 1
    5 4 27
    5 5 134
    ; run;

    proc catmod data=test;
    weight count;
    response marginals;
    model R * C= _response_ /oneway;
    repeated Change 2/ _response_= Change;
    run;

  2. #2
    Omega Contributor
    Points: 38,289, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,992
    Thanks
    397
    Thanked 1,185 Times in 1,146 Posts

    Re: Help on Bhapkar's Test using SAS/R/SPSS?

    So it is a McNemar generalized to more than a 2 X 2 framework, correct?


    I believe your issue is that you have null values for counts. If you look at their examples, they never have null values. Also your log shows missing values, perhaps you end up with a zero in a denominators at some point in the calculation making a function undefined.


    I went back and added a value in lieu of "0" in your dataset and the program runs fine. I am unsure how biased the results may be, but you could perhaps add a "0.5" to each count in the dataset to get the procedure to run. I am not theoretical enough to know how this may bias the results. It would definitely get you in the general ball park.


    I ran their symptom example with and without the 0.05 correction and the results were similar. I think as long as the test-statistic is very large, you could have reasonable confidence the marginal distributions are different.
    Stop cowardice, ban guns!

  3. #3
    Points: 62, Level: 1
    Level completed: 24%, Points required for next Level: 38

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help on Bhapkar's Test using SAS/R/SPSS?

    Yes. It is a McNamar generalized to more than a 2 x 2 framework. Thank you for your reply. I will have a go on SAS with your suggesed method.

    As an interesting note, I have tried using R and it did not have the same problem. I wonder how the programmes are different between SAS and R. The pacakges used for R were lpSolve and irr. While I am curious, I am probably not theoretical to understand the difference quickly. :P

  4. #4
    Omega Contributor
    Points: 38,289, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,992
    Thanks
    397
    Thanked 1,185 Times in 1,146 Posts

    Re: Help on Bhapkar's Test using SAS/R/SPSS?


    Will check out those packages as well if I get a chance. Do you have a link to a good R example?

    Perhaps run the provided SAS example using R and see if you get the same results as SAS.

    Also, try the correction in SAS and without the correction in R given your dataset and see if there is much of a difference.
    Stop cowardice, ban guns!

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats