Resource

I believe in open and reproducible science. This page shares the R code and data behind my published research, along with slides from talks and presentations I have given over the years.

R codes and Data

Analysis 1: Temporal analysis of alien flora accumulation (based on the minimum residence time (MRT) of the alien plant species)

  • Fitting nonlinear functions (fitting, compare, plot)
  • Segmented regression (breakpoint estimation, plot, linear regression model to identify temporal trend)
  • Bootstrap procedure (prediction of temporal trend in the future)​

Analysis 2: Comparative analysis (compare the MRT values across categories of biotic and abiotic variables)

  • Descriptive statistics
  • Check for normality (Shapiro-Wilk test) and homogeneity of variance (Levene test)
  • Compare (Kruskal-Wallis H test, post hoc Dunn test, ART ANOVA: non-parametric alternative of 2-way ANOVA)

​Analysis 3: Identify the variables’ influence on MRT

  • Testing for phylogenetic signals (Blomberg’s K and Pagel’s λ)
  • Univariate regression: logistic regression for variables having no phylogenetic signals, phylogenetic generalised least squares (PGLS) for variables with phylogenetic signals
  • Multivariate regression: Phylogenetic path analysis (PPA)
  • LASSO regression: Identification of variables’ categories that can influence the MRT

Access the script and data from here​

Analysis 1: Comparison of variables between categories (between the alien species offered for sale and not offered for sale in Chinese online marketplaces)

  • Descriptive statistics (summarySE)
  • Check for normality (Shapiro-Wilk test) and homogeneity of variance (Levene test)
  • Compare and effect size estimation (Wilcox test and t-test, post hoc Dunn test)
  • Subset data based on criteria

​Analysis 2: Regression analysis (identify variables’ influence on the sale availability of alien plant species of three invasion categories)

  • Fitting a generalised linear model (glm: binomial logistic regression)
  • Plot regression results using the sjPlot package​

Analysis 3: Structural equation modelling (identify variables’ direct and indirect influence on the sale availability of alien plant species of three invasion categories)

  • Using the lavaan package
  • Plot result using the semPlot package

Access the script and data from here

Analysis 1: Testing spatial niche conservatism (COUE framework) and the environmental analogy between native and non-native ranges

  • Using the ecospat package
  • Calculating niche overlap, niche similarity, and niche equivalency
  • Quantify niche dynamics and plot centroid shift
  • MESS analysis

Analysis 2: Estimate and compare the rate of spread between the three regions of the species’ introduced range

  • Custom script
  • Fitting the exponential growth model
  • Estimating slope and confidence intervals

Access the script and data from here

Analysis 1: Comparison of minimum residence time (MRT) between invasion categories

  • Descriptive statistics (summarise function)
  • Check for normality (Shapiro-Wilk test) and homogeneity of variance (Levene test)
  • Compare (ANOVA, Tukey’s HSD, Shapiro-Wilk test, Dunn test)

​Analysis 2: Imputation of missing data

  • Visualisation of missing data
  • Imputation using the missForest package
  • Standardisation of variables

Analysis 3: Logistic regression

  • Testing the effects of the biotic and abiotic variables on invasion success (invasive aliens-1, casual aliens-0)​

Analysis 4: Phylogenetic analysis

  • Making a phylogenetic tree (V.PHYLOMAKER package), and pruning the tree to genus level
  • Testing for phylogenetic signals (Blomberg’s K and Pagel’s λ), PHYTOOLS package

Access the script and data from here

Analysis 1: Likelihood ratio test for equality of Poisson means

  • To compare native species richness between sites invaded by two invasive species, either alone or in combination. The number of native species in a site was assumed to follow a Poisson distribution with mean depending on the presence or absence of the two focal species and their joint occurrence.

​Access the script and data from here

Analysis 1: Determine the relationship of genetic differentiation with geographic (IBD), environmental (IBE), and resistance (IBR) distances

  • Partial Mantel test
  • Multiple Regression on Distance Matrices (MRM)
  • VIF analysis using the usdm package
  • Compute Euclidean distances between points

​Access the script and data from here

Analysis 1: Identify genetic clusters and describe the relationships between them

  • Discriminant analysis of principal components

​Access the script and data from here

Analysis 1: To estimate population differentiation based on cpDNA sequence data

  • Hedrick’s G/ST estimation

​Access the script and data from here

Analysis 1: To investigate the genetic structure (by integrating the spatial information in the clustering algorithm)

  • Assess clustering pattern and plotting (GENELAND package)

​Access the script and data from here

Analysis 1: To assess the relationship of genetic differentiation with isolation by distance, environment and resistance surfaces

  • Generalized Dissimilarity Modeling analysis in R to model how genetic differentiation changes with environmental conditions and geographic distance (GDM package)

​Access the script and data from here

Presentations

2025

2024

2022

2018

2015

2025

2016

2015

2014

2013

2012

2011

Coming up

  • Introduction to R: course materials
  • Species Distribution Modelling in R: step-by-step workflow