BumSeok Jeong
2010-Oct-19 10:16 UTC
[R] ANOVA stuffs_How to save each result from FOR command?
Dear R experts, I'm new in R and a beginner in terms of statistics. It should be simple question, but definitely difficult to solve it by myself. I'd like to see main effect of group(gender: sample size is different(M:F=23:18) and one of condition(cond) and the interaction at each subset from 90 datasets So I perform anova 90 times using a command like below; for(i in 1:90) {results_ezANOVA = ezANOVA(data=subset(ast.ast_coef, ast.ast_coef$coef_thr==i), dv=.(ast.values), between=.(gender), wid=.(subj), within=.(cond))} But I got the last(90th) result, not all. Here are my questions. 1) Is my command correct? 2) If correct, please let me know if I can get all 90 results. 3) What kind of postHoc would be appropriate? Thank you, Jeong [[alternative HTML version deleted]]
jim holtman
2010-Oct-19 10:34 UTC
[R] ANOVA stuffs_How to save each result from FOR command?
Here is how you can get the results back in a list that you can then analyze: results_ezANOVA <- list() for(i in 1:90) { results_ezANOVA[[i]] <- ezANOVA(data=subset(ast.ast_coef, ast.ast_coef$coef_thr==i), dv=.(ast.values), between=.(gender), wid=.(subj), within=.(cond)) } On Tue, Oct 19, 2010 at 6:16 AM, BumSeok Jeong <bumseok.jeong at gmail.com> wrote:> Dear R experts, > > I'm new in R and a beginner in terms of statistics. > It should be simple question, but definitely difficult to solve it by > myself. > > I'd like to see main effect of group(gender: sample size is > different(M:F=23:18) and one of condition(cond) and the interaction at each > subset from 90 datasets > So I perform anova 90 times using a command like below; > > for(i in 1:90) {results_ezANOVA = ezANOVA(data=subset(ast.ast_coef, > ast.ast_coef$coef_thr==i), dv=.(ast.values), between=.(gender), wid=.(subj), > within=.(cond))} > > But I got the last(90th) result, not all. > Here are my questions. > > 1) Is my command correct? > 2) If correct, please let me know if I can get all 90 results. > 3) What kind of postHoc would be appropriate? > > Thank you, > > Jeong > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Liviu Andronic
2010-Oct-19 11:53 UTC
[R] ANOVA stuffs_How to save each result from FOR command?
Hello On Tue, Oct 19, 2010 at 12:16 PM, BumSeok Jeong <bumseok.jeong at gmail.com> wrote:> Dear R experts, > > I'm new in R and a beginner in terms of statistics. > It should be simple question, but definitely difficult to solve it by > myself. > > I'd like to see main effect of group(gender: sample size is > different(M:F=23:18) and one of condition(cond) and the interaction at each > subset from 90 datasets > So I perform anova 90 times using a command like below; > > for(i in 1:90) {results_ezANOVA = ezANOVA(data=subset(ast.ast_coef, > ast.ast_coef$coef_thr==i), dv=.(ast.values), between=.(gender), wid=.(subj), > within=.(cond))} > > But I got the last(90th) result, not all. > Here are my questions. > > 1) Is my command correct? > 2) If correct, please let me know if I can get all 90 results. >You may want to investigate the apply family of functions [1]. These can do what loops do, but they can automatically store the results in a list for you. Regards Liviu [1] http://cran.r-project.org/doc/Rnews/Rnews_2008-1.pdf> 3) What kind of postHoc would be appropriate? > > Thank you, > > Jeong > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
Seemingly Similar Threads
- Please help: ANOVA with SS Type III for unequal sample sized data
- [PATCH net] vhost: synchronize IOTLB message with dev cleanup
- KASAN: use-after-free Read in vhost_chr_write_iter
- KASAN: use-after-free Read in vhost_chr_write_iter
- KASAN: use-after-free Read in vhost_chr_write_iter