Comments (3)
Thanks, I am happy to hear that you like the package.
Right now it is not possible to display the magnitude of an effect without custom labels.
And because I have never encountered any examples, where that was done, I would be wary adding it, to not overload the interface with too many options. Or is this a very common visualization in economics?
from ggsignif.
I wouldn't say this is a common visualisation in economics.
For my specific visualisation I would like to label the magnitude difference somehow to draw specific attention a trend.
from ggsignif.
One option is that you write your own method, which returns a string just the way you want it:
magnitude_test <- function(x,y, ...){
change <- mean(y)/mean(x)
p <- t.test(x,y)$p.value
stars <- if(p < 0.001)
"***"
else if(p < 0.01)
"**"
else if(p < 0.05)
"*"
else
""
list(p.value=paste0(signif(change, digits=2),stars))
}
ggplot(mpg, aes(x=manufacturer, y=displ)) +
geom_boxplot() +
stat_signif(comparisons=list(c("audi", "ford"), c("hyundai", "nissan")),
test=magnitude_test,
margin_top=0.02, step_increase=0, tip_length=0.01) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
facet_wrap(~ as.factor(year), scale="free")
You can do whatever kind of calculations you want in the function, the only requirement is that the test returns a list with an entry called p.value
.
If you want to try this yourself, you will have to install the latest version of ggsignif from github
devtools::install_github("const-ae/ggsignif")
because only that one supports test methods that return text.
from ggsignif.
Related Issues (20)
- Customizing geom_signif with facet grid HOT 3
- Significance brackets HOT 1
- Figure out where the `WARNING`s and `NOTE`s in `R CMD check` are coming from HOT 1
- Manual vertical brackets do not work: "arguments imply differing number of rows" HOT 1
- Warning message: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position HOT 3
- adding scale_y_log10 changes y-axis to a weird range
- geom_signif does not plot comparison on the facetted plot with free x scale HOT 2
- Where can we find the significance level in the ggplot object slots? HOT 1
- Rename default branch from `master` to `main` HOT 3
- CRAN release 0.6.4 HOT 3
- Correcting for multiple testing when using geom_signif HOT 5
- Feature request - add more distance between comparisons and data HOT 4
- geom_signif - all comparisons dissappear when one comparison has missings HOT 2
- Significance stars are misaligned when using "NS" as well
- ggsignif results don't match with anova significance HOT 1
- Use cross symbol when p <.10?
- what are * , ** , *** correspond if specific values by user is not given? HOT 1
- How do I hide the no significant (NS) comparisons?
- Adding significance bar on coupled boxplots
- FDR warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggsignif.