Giter VIP home page Giter VIP logo

sig_and_plot_function's Introduction

sig_and_plot_function

significant levels and ggplot2 plot function (R)

Background

some available function such as stat_compare_means {ggpubr} can help to add P-value and significant levels on plots. However, it has to specify the comparisons pairs if you prefer to remain the significant pairs on plots.

sig_and_plot_function.R can help to filter significant pairs and their P-values. The significant pairs can be plot with stat_signif {ggsignif}.

Brief introduction

sig_and_plot_function.R contains 2 functions:

which_pair_to_use: which_pair_to_use (data, variable, group, cutoff = 0.1, p.adjust_method = "fdr", format_ = "sig_level")

input:

data: dataframe, with group variable (multiple classification)

variable: the variable you want to test group difference, colname in data, remember to add ""

group: the group(colname) in data, remember to add ""

cutoff: cutoff value for P value, result will remain if p < cutoff

p.adjust_method: choose from c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none")

format_: p value using round(5) or ***, **,* (<= 0.001: ***,0.001 ~ 0.01: **,0.01 ~ 0.05:*) , format_="sig_level" means formated with '*' and anything else is float format P value

output:

list(), list()[[1]]: pairs which p < cutoff , list()[[2]]: pairs(names) and its p-value

fun_to_routine_box: fun_to_routine_box(data,group,value, color = brewer.pal(7,"Set3"), add_sig = TRUE,format_='sig_level', xtitle = 'xtitle',ytitle ='ytitle',legendtitle = 'legend')

input:

data: dataframe, with group variable (multiple classification)

group: the group(colname) in data, remember to add ""

value: the variable you want to test group difference and plot, colname in data, remember to add ""

color: color vector

add_sig: add_sig=TURE will add significant levels using which_pair_to_use result

xtitle,ytitle,legendtitle: add it yourself

output:

ggplot2 plot

output demostration

plot with *

plot with P-value

required packages

library(mlbench) # data(Glass) for demostration 
# Glass Identification Data Set infromation: https://archive.ics.uci.edu/ml/datasets/Glass+Identification
library(ggsignif)
library(ggplot2)

sig_and_plot_function's People

Contributors

cs0000 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.