lindsay hanford
2015-Apr-13 16:17 UTC
[R] friedman.test error: not an unreplicated complete block design
Hello R Community, I am using the friedman.test() function to test differences in a non-normally distributed dataset, with a dependent variable that either a continuous variable or a ratio and has 2+ groups. I am using the friedman.test instead of a repeated measures ANOVA because my dataset violated the assumptions for using an ANOVA. I am looking to compare response means on an emotion-labelling task, between groups (HR, HC) and emotions (Happy, Sad, Angry, Fearful) where these variables are my group and block variables, respectively. When I use the following command:> friedman.test(Response~Group|Emotion, data=dataset)I get the following error: Error in friedman.test.default(c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 2L, 0L, 0L, : not an unreplicated complete block design I believe I have set up my dataset correctly.. where Subject ID is repeated for the four categories of emotion. The variable Error contains the number of incorrect response corresponding to each emotion. *Subj Group Emotion Response*94 HR Happy 2 119 HC Happy 0 .... 3 HR Sad 4 61 HC Sad 2 64 HC Sad 0 ....etc I think the error c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 2L, 0L, 0L,... ) corresponds to my Response variable and might not be happy about is the number of 0's that appear in that variable. However, this is the reason my dataset is not normally distributed and I cannot use rmANOVA. Any ideas how to deal with this error? Or whether I should be using a different statistical test? Thanks, Lindsay -- Lindsay Hanford, BSc, PhD Candidate McMaster Integrative Neuroscience Discovery & Study | *Department of Psychology, Neuroscience & Behaviour * McMaster University *|* lindsay.hanford at gmail.com [[alternative HTML version deleted]]
John Kane
2015-Apr-13 16:27 UTC
[R] friedman.test error: not an unreplicated complete block design
We really need " commented, minimal, self-contained, reproducible code' as asked for in the note at the end of each R-help message. Have a look at http://adv-r.had.co.nz/Reproducibility.html and/or http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for some hints. In particular, in your case we almost certainly need some data. Please use dput() to produce a useable data set. See Hakley's discussion at http://adv-r.had.co.nz/Reproducibility.html for an example of how to to this. John Kane Kingston ON Canada> -----Original Message----- > From: lindsay.hanford at gmail.com > Sent: Mon, 13 Apr 2015 12:17:32 -0400 > To: r-help at r-project.org > Subject: [R] friedman.test error: not an unreplicated complete block > design > > Hello R Community, > > I am using the friedman.test() function to test differences in a > non-normally > distributed dataset, with a dependent variable that either a > continuous variable or a ratio and has 2+ groups. > > I am using the friedman.test instead of a repeated measures ANOVA because > my dataset violated the assumptions for using an ANOVA. I am looking to > compare response means on an emotion-labelling task, between groups (HR, > HC) and emotions (Happy, Sad, Angry, Fearful) where these variables are > my > group and block variables, respectively. > > When I use the following command: >> friedman.test(Response~Group|Emotion, data=dataset) > I get the following error: > Error in friedman.test.default(c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 2L, 0L, 0L, > : > not an unreplicated complete block design > > I believe I have set up my dataset correctly.. where Subject ID is > repeated for > the four categories of emotion. The variable Error contains the number of > incorrect response corresponding to each emotion. > > > *Subj Group Emotion Response*94 HR Happy 2 > 119 HC Happy 0 > .... > 3 HR Sad 4 > 61 HC Sad 2 > 64 HC Sad 0 > ....etc > > I think the error c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 2L, 0L, 0L,... ) > corresponds > to my Response variable and might not be happy about is the number of 0's > that > appear in that variable. However, this is the reason my dataset is not > normally > distributed and I cannot use rmANOVA. > > Any ideas how to deal with this error? Or whether I should be using a > different statistical test? > Thanks, > > Lindsay > -- > Lindsay Hanford, BSc, PhD Candidate > McMaster Integrative Neuroscience Discovery & Study | *Department of > Psychology, Neuroscience & Behaviour * > McMaster University *|* lindsay.hanford at gmail.com > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account.
Michael Dewey
2015-Apr-13 16:44 UTC
[R] friedman.test error: not an unreplicated complete block design
Dear Lindsay If the problem is that you have an excess of zeroes you might look at the vignette for the package pscl which is called something like Regression models for count data. On 13/04/2015 17:17, lindsay hanford wrote:> Hello R Community, > > I am using the friedman.test() function to test differences in a non-normally > distributed dataset, with a dependent variable that either a > continuous variable or a ratio and has 2+ groups. > > I am using the friedman.test instead of a repeated measures ANOVA because > my dataset violated the assumptions for using an ANOVA. I am looking to > compare response means on an emotion-labelling task, between groups (HR, > HC) and emotions (Happy, Sad, Angry, Fearful) where these variables are my > group and block variables, respectively. > > When I use the following command: >> friedman.test(Response~Group|Emotion, data=dataset) > I get the following error: > Error in friedman.test.default(c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 2L, 0L, 0L, : > not an unreplicated complete block design > > I believe I have set up my dataset correctly.. where Subject ID is repeated for > the four categories of emotion. The variable Error contains the number of > incorrect response corresponding to each emotion. > > > *Subj Group Emotion Response*94 HR Happy 2 > 119 HC Happy 0 > .... > 3 HR Sad 4 > 61 HC Sad 2 > 64 HC Sad 0 > ....etc > > I think the error c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 2L, 0L, 0L,... ) corresponds > to my Response variable and might not be happy about is the number of 0's that > appear in that variable. However, this is the reason my dataset is not normally > distributed and I cannot use rmANOVA. > > Any ideas how to deal with this error? Or whether I should be using a > different statistical test? > Thanks, > > Lindsay >-- Michael http://www.dewey.myzen.co.uk/home.html
peter dalgaard
2015-Apr-13 17:13 UTC
[R] friedman.test error: not an unreplicated complete block design
By coincidence, there actually _is_ enough info to pinpoint the issue: *Subj Group Emotion Response*94 HR Happy 2 119 HC Happy 0 .... 3 HR Sad 4 61 HC Sad 2 64 HC Sad 0 ....etc An unreplicated complete block design has exactly 1 observation for each combination of the two grouping factors. The above clearly has 2 observations with "HC, Sad". So Friedman's test does not apply.> On 13 Apr 2015, at 18:27 , John Kane <jrkrideau at inbox.com> wrote: > > We really need " commented, minimal, self-contained, reproducible code' as asked for in the note at the end of each R-help message. > > Have a look at http://adv-r.had.co.nz/Reproducibility.html and/or http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for some hints. > > In particular, in your case we almost certainly need some data. Please use dput() to produce a useable data set. See Hakley's discussion at http://adv-r.had.co.nz/Reproducibility.html for an example of how to to this. > John Kane > Kingston ON Canada > > >> -----Original Message----- >> From: lindsay.hanford at gmail.com >> Sent: Mon, 13 Apr 2015 12:17:32 -0400 >> To: r-help at r-project.org >> Subject: [R] friedman.test error: not an unreplicated complete block >> design >> >> Hello R Community, >> >> I am using the friedman.test() function to test differences in a >> non-normally >> distributed dataset, with a dependent variable that either a >> continuous variable or a ratio and has 2+ groups. >> >> I am using the friedman.test instead of a repeated measures ANOVA because >> my dataset violated the assumptions for using an ANOVA. I am looking to >> compare response means on an emotion-labelling task, between groups (HR, >> HC) and emotions (Happy, Sad, Angry, Fearful) where these variables are >> my >> group and block variables, respectively. >> >> When I use the following command: >>> friedman.test(Response~Group|Emotion, data=dataset) >> I get the following error: >> Error in friedman.test.default(c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 2L, 0L, 0L, >> : >> not an unreplicated complete block design >> >> I believe I have set up my dataset correctly.. where Subject ID is >> repeated for >> the four categories of emotion. The variable Error contains the number of >> incorrect response corresponding to each emotion. >> >> >> *Subj Group Emotion Response*94 HR Happy 2 >> 119 HC Happy 0 >> .... >> 3 HR Sad 4 >> 61 HC Sad 2 >> 64 HC Sad 0 >> ....etc >> >> I think the error c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 2L, 0L, 0L,... ) >> corresponds >> to my Response variable and might not be happy about is the number of 0's >> that >> appear in that variable. However, this is the reason my dataset is not >> normally >> distributed and I cannot use rmANOVA. >> >> Any ideas how to deal with this error? Or whether I should be using a >> different statistical test? >> Thanks, >> >> Lindsay >> -- >> Lindsay Hanford, BSc, PhD Candidate >> McMaster Integrative Neuroscience Discovery & Study | *Department of >> Psychology, Neuroscience & Behaviour * >> McMaster University *|* lindsay.hanford at gmail.com >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > ____________________________________________________________ > Can't remember your password? Do you need a strong and secure password? > Use Password manager! It stores your passwords & protects your account. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com