R Chi Squared Post Hoc Test









up vote
1
down vote

favorite












I'm new to R (and statistics in general) so apologies in advance for what's probably a very remedial question, but I'd appreciate any help!



I'm trying to assess if there's a statistical advantage to starting a motor race in a given lane over another.



The sample sizes I have are small and not necessarily normally distributed so I'm opting to use a chi sq test to check for a significant difference between the expected vs observed wins.



#create lanes var
lane_num <- c(1:10)

#num wins per lane
num_wins <- c(8, 7, 10, 7, 6, 3, 6, 4, 1, 0)

#create df
df <- as.data.frame(cbind(lane_num, num_wins))

#convert lanes_num factor
df$lane_num <- as.factor(df$lane_num)

#check str
str(df)

#run chisq
chi_res <- chisq.test(df$num_wins)

#check results
chi_res

#check for sig diff between lanes
chisq.post.hoc(df) #this is where i'm having issues


The result of the chisq.test gives the following results suggesting a significant difference between expected v observed;



 Chi-squared test for given probabilities

data: df$num_wins
X-squared = 17.231, df = 9, p-value = 0.04522


Where I'm struggling is when it comes to running a post-hoc test between lanes to see exactly which ones are significantly more advantageous to start from.



Simply running:



chisq.post.hoc(df)


returns the following error;



Error in test(tbl[prs[, i], ], ...) : 
all entries of 'x' must be nonnegative and finite


As I say, I'm new to R and stats so the documentation provided regarding chisq.post.hoc doesn't make a lot of sense to me - plus it seems the package is no longer supported so i had to download an archived version. I've tried various things but all produce errors. For example;



chisq.post.hoc(df$num_wins, control = "bonferroni")
> Error in 1:nrow(tbl) : argument of length 0


I'd really appreciate a steer on this or any advise regarding an alternative post-hoc test I could use along with how the data needs to be structured before running etc.



Thanks in advance!










share|improve this question







New contributor




eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    1
    down vote

    favorite












    I'm new to R (and statistics in general) so apologies in advance for what's probably a very remedial question, but I'd appreciate any help!



    I'm trying to assess if there's a statistical advantage to starting a motor race in a given lane over another.



    The sample sizes I have are small and not necessarily normally distributed so I'm opting to use a chi sq test to check for a significant difference between the expected vs observed wins.



    #create lanes var
    lane_num <- c(1:10)

    #num wins per lane
    num_wins <- c(8, 7, 10, 7, 6, 3, 6, 4, 1, 0)

    #create df
    df <- as.data.frame(cbind(lane_num, num_wins))

    #convert lanes_num factor
    df$lane_num <- as.factor(df$lane_num)

    #check str
    str(df)

    #run chisq
    chi_res <- chisq.test(df$num_wins)

    #check results
    chi_res

    #check for sig diff between lanes
    chisq.post.hoc(df) #this is where i'm having issues


    The result of the chisq.test gives the following results suggesting a significant difference between expected v observed;



     Chi-squared test for given probabilities

    data: df$num_wins
    X-squared = 17.231, df = 9, p-value = 0.04522


    Where I'm struggling is when it comes to running a post-hoc test between lanes to see exactly which ones are significantly more advantageous to start from.



    Simply running:



    chisq.post.hoc(df)


    returns the following error;



    Error in test(tbl[prs[, i], ], ...) : 
    all entries of 'x' must be nonnegative and finite


    As I say, I'm new to R and stats so the documentation provided regarding chisq.post.hoc doesn't make a lot of sense to me - plus it seems the package is no longer supported so i had to download an archived version. I've tried various things but all produce errors. For example;



    chisq.post.hoc(df$num_wins, control = "bonferroni")
    > Error in 1:nrow(tbl) : argument of length 0


    I'd really appreciate a steer on this or any advise regarding an alternative post-hoc test I could use along with how the data needs to be structured before running etc.



    Thanks in advance!










    share|improve this question







    New contributor




    eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I'm new to R (and statistics in general) so apologies in advance for what's probably a very remedial question, but I'd appreciate any help!



      I'm trying to assess if there's a statistical advantage to starting a motor race in a given lane over another.



      The sample sizes I have are small and not necessarily normally distributed so I'm opting to use a chi sq test to check for a significant difference between the expected vs observed wins.



      #create lanes var
      lane_num <- c(1:10)

      #num wins per lane
      num_wins <- c(8, 7, 10, 7, 6, 3, 6, 4, 1, 0)

      #create df
      df <- as.data.frame(cbind(lane_num, num_wins))

      #convert lanes_num factor
      df$lane_num <- as.factor(df$lane_num)

      #check str
      str(df)

      #run chisq
      chi_res <- chisq.test(df$num_wins)

      #check results
      chi_res

      #check for sig diff between lanes
      chisq.post.hoc(df) #this is where i'm having issues


      The result of the chisq.test gives the following results suggesting a significant difference between expected v observed;



       Chi-squared test for given probabilities

      data: df$num_wins
      X-squared = 17.231, df = 9, p-value = 0.04522


      Where I'm struggling is when it comes to running a post-hoc test between lanes to see exactly which ones are significantly more advantageous to start from.



      Simply running:



      chisq.post.hoc(df)


      returns the following error;



      Error in test(tbl[prs[, i], ], ...) : 
      all entries of 'x' must be nonnegative and finite


      As I say, I'm new to R and stats so the documentation provided regarding chisq.post.hoc doesn't make a lot of sense to me - plus it seems the package is no longer supported so i had to download an archived version. I've tried various things but all produce errors. For example;



      chisq.post.hoc(df$num_wins, control = "bonferroni")
      > Error in 1:nrow(tbl) : argument of length 0


      I'd really appreciate a steer on this or any advise regarding an alternative post-hoc test I could use along with how the data needs to be structured before running etc.



      Thanks in advance!










      share|improve this question







      New contributor




      eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I'm new to R (and statistics in general) so apologies in advance for what's probably a very remedial question, but I'd appreciate any help!



      I'm trying to assess if there's a statistical advantage to starting a motor race in a given lane over another.



      The sample sizes I have are small and not necessarily normally distributed so I'm opting to use a chi sq test to check for a significant difference between the expected vs observed wins.



      #create lanes var
      lane_num <- c(1:10)

      #num wins per lane
      num_wins <- c(8, 7, 10, 7, 6, 3, 6, 4, 1, 0)

      #create df
      df <- as.data.frame(cbind(lane_num, num_wins))

      #convert lanes_num factor
      df$lane_num <- as.factor(df$lane_num)

      #check str
      str(df)

      #run chisq
      chi_res <- chisq.test(df$num_wins)

      #check results
      chi_res

      #check for sig diff between lanes
      chisq.post.hoc(df) #this is where i'm having issues


      The result of the chisq.test gives the following results suggesting a significant difference between expected v observed;



       Chi-squared test for given probabilities

      data: df$num_wins
      X-squared = 17.231, df = 9, p-value = 0.04522


      Where I'm struggling is when it comes to running a post-hoc test between lanes to see exactly which ones are significantly more advantageous to start from.



      Simply running:



      chisq.post.hoc(df)


      returns the following error;



      Error in test(tbl[prs[, i], ], ...) : 
      all entries of 'x' must be nonnegative and finite


      As I say, I'm new to R and stats so the documentation provided regarding chisq.post.hoc doesn't make a lot of sense to me - plus it seems the package is no longer supported so i had to download an archived version. I've tried various things but all produce errors. For example;



      chisq.post.hoc(df$num_wins, control = "bonferroni")
      > Error in 1:nrow(tbl) : argument of length 0


      I'd really appreciate a steer on this or any advise regarding an alternative post-hoc test I could use along with how the data needs to be structured before running etc.



      Thanks in advance!







      r chi-squared posthoc






      share|improve this question







      New contributor




      eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 10 at 14:17









      eod1984

      61




      61




      New contributor




      eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      eod1984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          eod1984 is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239839%2fr-chi-squared-post-hoc-test%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          eod1984 is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          eod1984 is a new contributor. Be nice, and check out our Code of Conduct.












          eod1984 is a new contributor. Be nice, and check out our Code of Conduct.











          eod1984 is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239839%2fr-chi-squared-post-hoc-test%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          What does pagestruct do in Eviews?

          Dutch intervention in Lombok and Karangasem

          Channel Islands