achetverikov / apastats Goto Github PK
View Code? Open in Web Editor NEWR functions for formatting results in APA style and other stuff
R functions for formatting results in APA style and other stuff
Hi,
I was wondering if you think it could be feasible to implement a function that summarizes multiple ANOVA results using symbols ( >, <, ≥, ≤ )
. This could be convenient when describing multiple results (i.e. when multiple main or interaction effects are not significant) and we want to keep it as short and precise as possible.
For instance, from the following ANOVA example:
require(ez)
data(ANT)
rt_anova = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt
, wid = subnum
, within = .(cue,flank)
, between = group
)
rt_anova
> rt_anova
$ANOVA
Effect DFn DFd F p p<.05 ges
2 group 1 18 18.430592 4.377562e-04 * 0.07633358
3 cue 3 54 516.605213 1.005518e-39 * 0.89662286
5 flank 2 36 1350.598810 1.386546e-34 * 0.92710583
4 group:cue 3 54 2.553236 6.497492e-02 0.04110445
6 group:flank 2 36 8.768499 7.900829e-04 * 0.07627434
7 cue:flank 6 108 5.193357 9.938494e-05 * 0.11436699
8 group:cue:flank 6 108 6.377225 9.012515e-06 * 0.13686958
$`Mauchly's Test for Sphericity`
Effect W p p<.05
3 cue 0.7828347 0.5366835
4 group:cue 0.7828347 0.5366835
5 flank 0.8812738 0.3415406
6 group:flank 0.8812738 0.3415406
7 cue:flank 0.1737053 0.1254796
8 group:cue:flank 0.1737053 0.1254796
$`Sphericity Corrections`
Effect GGe p[GG] p[GG]<.05 HFe p[HF] p[HF]<.05
3 cue 0.8652559 1.115029e-34 * 1.0239520 1.005518e-39 *
4 group:cue 0.8652559 7.472046e-02 1.0239520 6.497492e-02
5 flank 0.8938738 3.763312e-31 * 0.9858964 3.964046e-34 *
6 group:flank 0.8938738 1.297752e-03 * 0.9858964 8.438369e-04 *
7 cue:flank 0.6022111 1.546166e-03 * 0.7721473 4.745714e-04 *
8 group:cue:flank 0.6022111 3.424499e-04 * 0.7721473 7.170939e-05 *
We could describe results in a .Rmd document as follows:
There were main effects of group (
r describe.ezanova(rt_anova, 'group')
), cue (r describe.ezanova(rt_anova, 'cue')
) and flank (r describe.ezanova(rt_anova, 'flank')
)...
or it could sometimes be preferred to say:
Main effects of group, cue and flank were observed (
r here we would have summarised ANOVA F, P and ES statistics from all three
)
The emmeans
package is replacing lsmeans, so it would be nice to support this too.
Quick and silly question but does anyone have access to the datasets that were used in the examples.md file. I'm trying to troubleshoot how some of the code works.
Thanks
Model without error term :)
describe.aov(aov(yield ~ N*P*K, npk))
[1] "_F_(1, 16) = 6.16, _p_ = .025" "_F_(1, 16) = 0.27, _p_ = .608"
[3] "_F_(1, 16) = 3.10, _p_ = .097" "_F_(1, 16) = 0.69, _p_ = .418"
[5] "_F_(1, 16) = 1.08, _p_ = .314" "_F_(1, 16) = 0.02, _p_ = .902"
[7] "_F_(1, 16) = 1.20, _p_ = .289" "_F_(16, 16) = NA, _p_ = NA"
Model with error term :(
describe.aov(aov(yield ~ N*P*K + Error(block), npk))
Error in vcov.default(mod, complete = FALSE) :
there is no vcov() method for models of class aovlist, listof
If I run:
m <- lm(mpg~factor(cyl), data=mtcars)
m.lsm <- lsmeans::lsmeans(m, ~cyl)
m.contrasts <- lsmeans::contrast(m.lsm, "eff")
describe.lsmeans(m.contrasts, 1)
I get an error I don't understand:
Error in x@linfct[i, , drop = FALSE] : subscript out of bounds
If it's any use, my current workaround is, but you may not want the dplyr and broom deps:
m.contrasts %>%
broom::tidy() %>%
transmute(markdownd=sprintf("difference = %.2f, _t_(%s) = %.2f, _p_ %s",
.$estimate,
apastats::f.round(.$statistic),
.$df,
apastats::round.p(.$p.value)))
Hello,
I was wondering whether including a describe.ezstats
function would be interesting. I normally use ez
package to perform ANOVAs and it would be really helpful to automatize mean ± SD values of the different main and interaction effects from ezANOVA
provided by ezStats
.
Many thanks and congratulations for such a helpful package.
Antonio
add_h_line is missing from plot.pointrange
When you run
devtools::install_github('achetverikov/apastats',subdir='apastats')
Does anyone else get the error
Downloading GitHub repo achetverikov/apastats@master
from URL https://api.github.com/repos/achetverikov/apastats/zipball/master
Installing apastats
"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \
"C:/Users/USER/AppData/Local/Temp/RtmpM3Kiv3/devtools2fb83d224ab2/achetverikov-APAstats-6259cfd/apastats" \
--library="C:/Users/USER/Documents/R/win-library/3.3" --install-tests
* installing *source* package 'apastats' ...
Error : Invalid DESCRIPTION file
Malformed maintainer field.
See section 'The DESCRIPTION file' in the 'Writing R Extensions'
manual.
ERROR: installing package DESCRIPTION failed for package 'apastats'
* removing 'C:/Users/USER/Documents/R/win-library/3.3/apastats'
Installation failed: Command failed (1)
When I call the methods in my markdown script, I always get MD output.
How do I change it to Latex, e.g. in describe.ttest ()?
Do you have a view on getting apastats onto CRAN? Would you be open to pull requests to achieve it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.