My research focuses on extreme value theory, spatial-temporal modeling, and causal inference, especially application in climate change. I also have an interest in R programming.

Currently, my research topic is to derive and study probabilities of necessary and sufficient causation of extreme events using sub-asymptotic models under the framework of the counterfactual theory. The models are usually more realistic in capturing extreme dependence on environmental processes and they will be used to assess human influence over heat waves and extreme precipitation at different places around the globe.

I will share some knowledge and technology here. But I will often leave articles unfinished (and won’t complete, perhaps). Also, I will regard it as a notebook.

My resume is available in html and PDF form.

Recent

If you have written many functions, it would be more convenient to build up a package. It is also wonderful to share the tools you created by developing a R package. I will introduce some easy steps to achieve this goal. Create a new project File > New project > New Dictionary > R package
2022-01-18
1 min read
R
If you have written many functions, it would be more convenient to build up a package. It is also wonderful to share the tools you created by developing a R package. I will introduce some easy steps to achieve this goal. Preparation We need to creat a project for the new package. Creat a new project Click these butthons in your Rstudio. File > New project > New Dictionary > R package
2022-01-18
1 min read
R
There is a package Parallel detectCores(): return how many cores exist on your PC. cl <- makeCluster(np): initialize a cluster mc with np processes. Apply Operations using Clusters: clusterCall, clusterEvalQ, clusterApply, clusterExport, clusterMap, parLapply, parSapply, parApply, parRapply, parCapply stopCluster(cl): release the occupied cores. An example Check how many cores exist on my PC. library(parallel) detectCores() ## [1] 12 Define a function. sim <- function(x){ rnorm(1, mean = x) } Use parallel to speed up the calculation.
2022-01-08
1 min read
Steps for \(i=1,2,\dots,n\) Sample candidate value \(x^i\) from a proposal distribution \(q(x^i|x^{i-1})\) Compute acceptance probability: \[\alpha=\frac{p(x^i)q(x^{i-1}|x^i)}{p(x^{i-1})q(x^i|x^{i-1})}\] 3. Compute \(r=min(1,\alpha)\) Sample \(U\sim Unif(0,1)\) \[ x^i=\begin{cases} x^{i-1}, &u<r \\x^i, &u\geq r\end{cases} \] An example
2022-01-07
1 min read
Many fantastic things can be done in R. A beautiful resume or CV can leave a good impression of you to others. People usually make their resume or CV in word. HTML is also an extraordinary typesetting tool, which is one of the motivations Yihui created a series packages about html. Don’t worry if you don’t know much about HTML or CSS. You are able to write a beautiful resume or CV in R easily.
2021-07-10
2 min read
In practice, we always find the function in a published R package can not meet our needs very well. However, it’s not necessary to write a new function all over. It would be more convenient if we can modify the function directly. Let’s look at an example. We check the source code of sd() function in the stats package. The source code is as following: library(stats) sd function (x, na.rm = FALSE) sqrt(var(if (is.
2021-05-10
1 min read
R
R code for bootstrap and permutation test.
2021-04-17
1 min read
There are many packages to draw maps in R. Personally, I prefer to use leaflet and ggplot2. leaflet is a web application so that we can explore data interactively, and ggplot2 can merge data conveniently.
2021-04-01
2 min read
R
Basic concepts of EVT
2021-01-30
1 min read
Last time, we introduced the topic of Matrix Derivation. But we only discussed the situation when $f$ is a scalar. How about matrix $f$? The vectorization method is used in the derivation of matrix. Let’s start.
2020-12-29
1 min read