ezAnova for soil green house gas emissions

110 views
Skip to first unread message

rajen bajgain

unread,
Jul 5, 2019, 12:58:31 PM7/5/19
to ez4r
Hi All,

 I am using this package for the first time for my soil green house gas fluxes study.  I have attached my sample data here with. I want to see whether the daily fluxes from three different treatments (Cont, CF and CU) are significantly different. 
I tried to design the model and struggle what i should put for the "wid " arguments.
mod2 = ezANOVA(N2O_DF_Long,dv = .(N2O_flux), .wid(), within = .(Day),between = .(Group), detailed = TRUE)


I would really appreciate if some one can go over this and help me out to make a cut into it.

Best Regards,
Rajen


df_long_test.csv

John Vokey

unread,
Jul 6, 2019, 11:38:03 AM7/6/19
to ez4r
You need a variable (as.factor) that uniquely identifies each experimental unit over the within factor, Day.  I suspect that variable in your data-set is block, so set wid = .(block)

rajen bajgain

unread,
Jul 8, 2019, 3:26:20 PM7/8/19
to ez...@googlegroups.com
Thank you John for the suggestions . I did convert the both "plot" and "Day" as factors and tried this code. But I encountered another error. What went wrong now? Please suggest

mod2 = ezANOVA(N2O_DF_Long,dv = .(N2O_flux), .wid(block), within = .(Day), detailed = TRUE)

Warning: Collapsing data to cell means. *IF* the requested effects are a subset of the full design, you must use the "within_full" argument, else results may be inaccurate.
Error in lambda > 0 : invalid comparison with complex values
Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within,  :
  The car::Anova() function used to compute results and assumption tests seems to have failed. Most commonly this is because you have too few subjects relative to the number of cells in the within-Ss design. It is possible that trying the ANOVA again with "type=1" may yield results (but definitely no assumption tests).







--
You received this message because you are subscribed to the Google Groups "ez4r" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ez4r+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ez4r/1f20ce17-8cc2-4740-ad22-96e88c19e836%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Rajen Bajgain

University of Oklahoma
Graduate Research Assistant
Microbiology and Plant Biology
101 David L. Boren Blvd, Norman,OK
Phone:   405-714-4360
ra...@ou.edu

Mike Lawrence

unread,
Jul 8, 2019, 3:34:22 PM7/8/19
to ez...@googlegroups.com

I can't replicate your error using your dataset. I do notice that you have an error in the ezANOVA code you posted such that ".wid(block)" should be "wid = .(block)". You also refer to a "plot" variable in your message that is not in the data set nor your code.


Mike Lawrence

unread,
Jul 9, 2019, 3:53:36 PM7/9/19
to ez...@googlegroups.com
Forwarding to the mailing list for posterity:

---------- Forwarded message ---------
From: Mike Lawrence <mike....@gmail.com>
Date: Tue, Jul 9, 2019 at 4:51 PM
Subject: Re: [ez4r] Re: ezAnova for soil green house gas emissions
To: rajen bajgain <raje...@gmail.com>


When I run your code, I get the error:

Error: unexpected symbol in "mod2 = ezANOVA(data=N2O_DF_Long,dv =.(N2O_flux), wid= .(block), within = .(Day), between=.(group) detailed"

because you left out a comma before the final argument "detailed". Fixing that, I get the error:

Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within,  :
  "group" is not a variable in the data frame provided.

because the name of the variable in your data frame is "Group", not "group". Fixing that, I get the error:

Error in lambda > 0 : invalid comparison with complex values
Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within,  :
  The car::Anova() function used to compute results and assumption tests seems to have failed. Most commonly this is because you have too few subjects relative to the number of cells in the within-Ss design. It is possible that trying the ANOVA again with "type=1" may yield results (but definitely no assumption tests).

Which suggests we should try adding "type=1" as an argument to ezANOVA. Adding that, yields the output:

> mod2
$ANOVA
     Effect DFn DFd          SSn          SSd        F            p p<.05       ges
1     Group   2   6 0.0004768297 0.0001508108 9.485325 1.387280e-02     * 0.2629160
2       Day  53 318 0.0009611236 0.0011859794 4.862430 2.099637e-19     * 0.4182592
3 Group:Day 106 318 0.0013764275 0.0011859794 3.481749 7.632165e-18     * 0.5073045

But let's check why car::Anova() was complaining using ezDesign:

ezDesign(
     data = N2O_DF_Long
     , x = .(block)
     , y = .(Day)
     , col = .(Group)
)

Which shows a plot revealing that you only have 9 levels of your wid variable "block" and 54 levels of the within variable "Day", which means that the tools car::Anova() uses to do assumption checks don't work (they need the number of levels of the wid variable to be larger than the number of levels of the within variables).

I suggest you look at generalized additive models and/or gaussian process models to handle a variable like Day that is inherently continuous across which possibly-non-linear effects may manifest. ANOVA is a rather crude tool for this kind of data.

Mike


--
Mike Lawrence, PhD
Co-founder & Research Scientist
Axem Neurotechnology
axemneuro.com

~ Certainty is (possibly) folly ~


On Tue, Jul 9, 2019 at 4:40 PM rajen bajgain <raje...@gmail.com> wrote:
Hi Mike,
Thank you for looking into my issue. I did fix the issue as you suggested  but again come up with the same error. I am quite new to this and I tried to solve even I after read your publication but did not get success. I have attached sample of my data here and I am trying to do the following:
1) I wanted to see whether the N2O flux (dv) is significantly different between groups (treatment: control CF and CU) at daily mean , weekly sum and cumulative (whole period).
I have 3 treatments (group) and 3 replications in each group(block) and several observations in each day(day 1-55) for each block.

I tried with the following codes: 
N2O_DF_Long <- read.csv("C:/Users/eomf/Desktop/df_long_1.csv", header=TRUE)
N2O_DF_Long$Day=as.factor(N2O_DF_Long$Day)
N2O_DF_Long$Group=as.factor(N2O_DF_Long$Group)
N2O_DF_Long$block=as.factor(N2O_DF_Long$block)
N2O_DF_Long$N2O_flux=round(N2O_DF_Long$N2O_flux, digits=3)
attach(N2O_DF_Long)

mod2 = ezANOVA(data=N2O_DF_Long,dv =.(N2O_flux), wid= .(block), within = .(Day), between=.(group) detailed=TRUE)


I would appreciate if you can  help me to check on this. Thank you for your help in advance.

Best Regards,
Rajen




For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages