Re: [R] anova error
On Wed, Dec 1, 2010 at 9:02 AM, Ben Bolker wrote: > > > Peter Ehlers ucalgary.ca> writes: > >> >> It might be a good idea not to use an outdated version of R. >> I don't see your "problem" in R 2.12.0. >> >> Peter Ehlers >> >> On 2010-12-01 05:44, Jean.Coursol math.u-psud.fr wrote: >> > Just for fun >> > >> > This small program gives negative Sum of Sq in anova (with R versions >> > 2.9.2 and 2.10.0) (linux 32 kernel 2.6.29.6-smp slackware 13.0) : >> > > > These are essentially just round-off error in a problem with zero > noise: there is absolutely no practical difference between 2e-16 and > 2e16. Well, actually there is a big difference between 2e-16 and 2e16. I think you meant to write 2e-16 and -2e-16 > If you really need to do something with these values that will > break if they are negative, see ?zapsmall ... > > __ > R-help@r-project.org mailing list > 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. > __ R-help@r-project.org mailing list 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.
Re: [R] anova error
On Dec 1, 2010, at 9:18 AM, Peter Ehlers wrote: It might be a good idea not to use an outdated version of R. I don't see your "problem" in R 2.12.0. Furthermore isn't it a bit to be asking why the sign on a number that is effectively zero happens to be negative? I would think that FAQ 7.31 applied even back in the 2.9 and 2.10 era. (I still get a negative number in R 2.12.0 that is effectively zero, -4.4409e-16, and rounded is exactly the same as the difference between sqrt(2)^2 and 2 in the FAQ entry, so if it were supposed to be "fixed" (which I'm not saying it should be) then it didn't occur until very recently.) -- David. Peter Ehlers On 2010-12-01 05:44, jean.cour...@math.u-psud.fr wrote: Just for fun This small program gives negative Sum of Sq in anova (with R versions 2.9.2 and 2.10.0) (linux 32 kernel 2.6.29.6-smp slackware 13.0) : y = c(3.6, 5.0, 5.0, 4.6, 4.5, 4.3, 4.5, 5.1, 4.5, 4.3) trans = as.factor(c("NT","NT","NT","NT","NT","T","T","T","T","T")) lc = lm(y ~ trans) l1 = lm(y ~ 1) anova(l1,lc) # Analysis of Variance Table # # Model 1: y ~ 1 # Model 2: y ~ trans # Res.Df RSS Df Sum of Sq F Pr(>F) # 1 9 1.744 # 2 8 1.744 1 -2.220e-16 # negative Sum of Sq anova(lc) # is OK # 2.9.2 version # Analysis of Variance Table # # Response: y # DfSum Sq Mean Sq F value Pr(>F) # trans 1 8.214e-32 8.214e-32 3.768e-31 1 # Residuals 8 1.744 0.218 # 2.10.0 version # Analysis of Variance Table # # Response: y # Df Sum Sq Mean Sq F value Pr(>F) # trans 1 0.000 0.000 0 1 # Residuals 8 1.744 0.218 __ R-help@r-project.org mailing list 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. __ R-help@r-project.org mailing list 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. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list 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.
Re: [R] anova error
Peter Ehlers ucalgary.ca> writes: > > It might be a good idea not to use an outdated version of R. > I don't see your "problem" in R 2.12.0. > > Peter Ehlers > > On 2010-12-01 05:44, Jean.Coursol math.u-psud.fr wrote: > > Just for fun > > > > This small program gives negative Sum of Sq in anova (with R versions > > 2.9.2 and 2.10.0) (linux 32 kernel 2.6.29.6-smp slackware 13.0) : > > These are essentially just round-off error in a problem with zero noise: there is absolutely no practical difference between 2e-16 and 2e16. If you really need to do something with these values that will break if they are negative, see ?zapsmall ... __ R-help@r-project.org mailing list 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.
Re: [R] anova error
It might be a good idea not to use an outdated version of R. I don't see your "problem" in R 2.12.0. Peter Ehlers On 2010-12-01 05:44, jean.cour...@math.u-psud.fr wrote: Just for fun This small program gives negative Sum of Sq in anova (with R versions 2.9.2 and 2.10.0) (linux 32 kernel 2.6.29.6-smp slackware 13.0) : y = c(3.6, 5.0, 5.0, 4.6, 4.5, 4.3, 4.5, 5.1, 4.5, 4.3) trans = as.factor(c("NT","NT","NT","NT","NT","T","T","T","T","T")) lc = lm(y ~ trans) l1 = lm(y ~ 1) anova(l1,lc) # Analysis of Variance Table # # Model 1: y ~ 1 # Model 2: y ~ trans # Res.Df RSS Df Sum of Sq F Pr(>F) # 1 9 1.744 # 2 8 1.744 1 -2.220e-16 # negative Sum of Sq anova(lc) # is OK # 2.9.2 version # Analysis of Variance Table # # Response: y # DfSum Sq Mean Sq F value Pr(>F) # trans 1 8.214e-32 8.214e-32 3.768e-31 1 # Residuals 8 1.744 0.218 # 2.10.0 version # Analysis of Variance Table # # Response: y # Df Sum Sq Mean Sq F value Pr(>F) # trans 1 0.000 0.000 0 1 # Residuals 8 1.744 0.218 __ R-help@r-project.org mailing list 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. __ R-help@r-project.org mailing list 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.
[R] anova error
Just for fun This small program gives negative Sum of Sq in anova (with R versions 2.9.2 and 2.10.0) (linux 32 kernel 2.6.29.6-smp slackware 13.0) : y = c(3.6, 5.0, 5.0, 4.6, 4.5, 4.3, 4.5, 5.1, 4.5, 4.3) trans = as.factor(c("NT","NT","NT","NT","NT","T","T","T","T","T")) lc = lm(y ~ trans) l1 = lm(y ~ 1) anova(l1,lc) # Analysis of Variance Table # # Model 1: y ~ 1 # Model 2: y ~ trans # Res.Df RSS Df Sum of Sq F Pr(>F) # 1 9 1.744 # 2 8 1.744 1 -2.220e-16 # negative Sum of Sq anova(lc) # is OK # 2.9.2 version # Analysis of Variance Table # # Response: y # DfSum Sq Mean Sq F value Pr(>F) # trans 1 8.214e-32 8.214e-32 3.768e-31 1 # Residuals 8 1.744 0.218 # 2.10.0 version # Analysis of Variance Table # # Response: y # Df Sum Sq Mean Sq F value Pr(>F) # trans 1 0.000 0.000 0 1 # Residuals 8 1.744 0.218 __ R-help@r-project.org mailing list 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.
Re: [R] ANOVA error
Dani > I have a dataframe named myMatrix with the structure If it really is a dataframe, why is it called myMatrix :-) I guess you actually have a factor matrix. From the message below, Cr would appear to be a factor. There are some fundamental distinctions in R (such as between a matrix and a dataframe, or between factor and numeric) which can seem 'subtle' as first. It is worth investing a bit of effort into understanding these. [My apologies if this is stating something which is obvious to you.] HTH Peter Alspach > TreatmentTimeCrmIb ... > > Being the treatment and time the predictors and Cr, mIb and > so on the response variables. When I call > > Cr.aov <- aov(Cr~Treatment, data=myMatrix) > > I got this error: > > Error in storage.mode(y) <- "double" : > invalid to change the storage mode of a factor In addition: > Warning message: > In model.response(mf, "numeric") : > using type="numeric" with a factor response will be ignored > > Can anyone help me? I take the chance to ask another > question. I would like to perform an ANOVA on different > variables. Is the call aov(Cr+mIb+...~Treatment, > data=myMatrix) o correct way of doing it? What I would like > to have is a p value for the variance for each response variable. > Best, > > Dani > > -- > Daniel Valverde Saubí > > Grup de Biologia Molecular de Llevats > Facultat de Veterinària de la Universitat Autònoma de > Barcelona Edifici V, Campus UAB > 08193 Cerdanyola del Vallès- SPAIN > > Centro de Investigación Biomédica en Red en Bioingeniería, > Biomateriales y Nanomedicina (CIBER-BBN) > > Grup d'Aplicacions Biomèdiques de la RMN Facultat de > Biociències Universitat Autònoma de Barcelona Edifici Cs, Campus UAB > 08193 Cerdanyola del Vallès- SPAIN > +34 93 5814126 > > __ > R-help@r-project.org mailing list > 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. > The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. __ R-help@r-project.org mailing list 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.
[R] ANOVA error
Hello, I have a dataframe named myMatrix with the structure TreatmentTimeCrmIb ... Being the treatment and time the predictors and Cr, mIb and so on the response variables. When I call Cr.aov <- aov(Cr~Treatment, data=myMatrix) I got this error: Error in storage.mode(y) <- "double" : invalid to change the storage mode of a factor In addition: Warning message: In model.response(mf, "numeric") : using type="numeric" with a factor response will be ignored Can anyone help me? I take the chance to ask another question. I would like to perform an ANOVA on different variables. Is the call aov(Cr+mIb+...~Treatment, data=myMatrix) o correct way of doing it? What I would like to have is a p value for the variance for each response variable. Best, Dani -- Daniel Valverde Saubí Grup de Biologia Molecular de Llevats Facultat de Veterinària de la Universitat Autònoma de Barcelona Edifici V, Campus UAB 08193 Cerdanyola del Vallès- SPAIN Centro de Investigación Biomédica en Red en Bioingeniería, Biomateriales y Nanomedicina (CIBER-BBN) Grup d'Aplicacions Biomèdiques de la RMN Facultat de Biociències Universitat Autònoma de Barcelona Edifici Cs, Campus UAB 08193 Cerdanyola del Vallès- SPAIN +34 93 5814126 __ R-help@r-project.org mailing list 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.