Lewandowski-Kurowicka-Joe (**LKJ**) distribution is a very useful prior distribution for parameter estimation in correlation matrices, and is also tightly related to matrix factorizations such as Cholesky decomposition. For example, when you use Cholesky decomposition to decompose a variance-covariance matrix (**Sigma**) into the multiplication of 3 matrices, you can set **LKJCorr** prior for the correlation matrix **R**.

1. Form

Its probability density function is defined as:

With the development of **dplyr** or its umbrella package **tidyverse**, it becomes quite straightforward to perform operations over columns or rows in R. These column- or row-wise methods can also be directly integrated with other dplyr verbs like `select`

, `mutate`

, `filter`

and `summarise`

, making them more comparable with other functions in `apply`

or `map`

families. In this blog, I will briefly cover some useful manipulations over rows or columns.

1. Column-wise operation

**Example 1:** select those string columns with less than 5 levels in the dataset of **starwars**.

*# anonymous function*

starwars %>%

select_if(~ is.character(.x) & length(unique(.x)) <= 5)

We…

I am looking for a general-purpose editor that can integrate and customize different features across all programming languages that I often use (e.g., R, Python, Julia and Javascript), and Visual Studio Code seems to be the best candidate for me. Here I will give a quick overview of the key features for deploying my R markdown notebook in VS code. These settings can be easily generalized to other languages by adjusting the engines/compilers or adding the language-specific extensions.

Before I get started, it is necessary to install some extensions.

…

This post provides an example of simulating data in a **Multivariate Normal distribution** with given parameters, and estimating the parameters based on the simulated data via **Cholesky decomposition** in `stan`

. **Multivariate Normal distribution** is a commonly used distribution in various regression models and machine learning tasks. It generalizes the Normal distribution into multidimensional space. Its PDF can be expressed as:

It takes a while for me to figure out how you can preview pictures and pdfs in **vifm** on **Kitty** terminal. I tried many different utilities, such as w3m and überzug, but the displayed pictures are not satisfying or it is really a pain to deploy the environments on my MacBook.

I recently find that **Kitty** can support image display in the terminal via `icat`

function. To make it work, you first need to install **ImageMagick**. See the Kitty webpage for details, and a tutorial for the configuration of **kitty** and **vifm** on your computer. …

A good terminal tool can speed up your workflow, and make your life much easier. Here I give a complete tutorial of installing the **kitty** terminal, and configuring the **fish shell** and **vifm** manager on mac.

**kitty**

(1) install kitty on mac

`>> curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin`

(2) set kitty as the default terminal tool

To set kitty as the default application, you need to install a plug-in called “**RCDefaultApp.prefPane**”. You can download it from my github repository.

`>> git clone https://github.com/JakeJing/kittyconfig.git`

>> sudo mv kittyconfig/RCDefaultApp.prefPane /Library/PreferencePanes/

This will add an icon of “default apps” in your system…

I am trying to deploy the environments for python markdown notebook in Atom, so that you can compile your python script (*.pmd) into a pdf file. This configuration is tailored for markdown lovers and R users, who are looking for a python IDE similar to Rstudio. It is also useful for researchers who want to attach their scripts as well-formed pdfs in the publications. I include the template files, scripts and other settings in my **github repository**.

**install****Pweave****via pip**

`>> pip3 install --upgrade Pweave`

**2. download and install ****Atom**

**3. install the necessary ****packages**** via Atom package manager**

`…`

PyTorch has gained great popularity among industrial and scientific projects, and it provides a backend for many other packages or modules. It is also accompanied with very good documentation, tutorials, and conferences. This blog attempts to use PyTorch to fit a simple linear regression via three optimisation algorithms:

*Stochastic Gradient Descent (SGD)**Adam**No-U-Turn Sampler (NUTS)*

We will start with some simulated data, given certain parameters, such as weights, bias and sigma. The linear regression can be expressed by the following equation: