Blog posts

2025

Ripley’s K and Besag’s L Function

15 minute read

Published:

Summary: This note introduces Ripley’s $K$ and Besag’s $L$ functions for analyzing spatial point patterns. It explains CSR as the null model, defines and estimates $K(r)$ with edge corrections, variance-stabilization via $L(r)$, and the need for Monte Carlo envelopes. Redwood data illustrate clustering versus intensity-driven inhomogeneity.

Understanding of Logistic Regression

1 minute read

Published:

Summary: This note explains why logistic regression is suited for classification. Unlike linear regression, probabilities must remain between 0 and 1. The logistic function enforces this constraint, mapping linear predictors into valid probabilities. Its log-odds formulation ensures interpretability, making logistic regression a well-defined, probabilistic approach for binary classification tasks.

Shell File Descriptor and Redirection Reference

6 minute read

Published:

Summary: This note explains shell file descriptors and redirection. It covers stdin, stdout, stderr, and how to redirect or merge them with operators like >, 2>, and 2>&1. It shows differences between & in redirection and background execution, common command flags, pitfalls, examples, and best practices for HPC logging.

Difference between Standard Deviation and Standard Error

1 minute read

Published:

Summary: This note clarifies the distinction between standard deviation and standard error. Standard deviation measures variability within a dataset, serving as a descriptive statistic, while standard error measures variability of sample means across repeated samples, serving as an inferential statistic. Derivations include Bessel’s correction for unbiased variance estimation and the SE formula.

Another way of understanding Stochastic Gradient Descending (SGD) Algorithm

1 minute read

Published:

Summary: This note reinterprets stochastic gradient descent by modeling sample gradients as random variables. It derives the sample covariance of gradients and shows that the mini-batch gradient is an unbiased estimator of the full gradient, with variance scaling as $\frac{1}{m}$. This variance reflects stochastic noise around the true gradient direction.

Variational Inference

10 minute read

Published:

Summary: This note explains variational inference (VI) as a scalable alternative to MCMC for approximate Bayesian inference. It introduces entropy, cross-entropy, and KL divergence, then contrasts forward (zero-avoiding) vs. reverse (zero-forcing) KL. The ELBO is derived as a tractable optimization target, enabling posterior approximation via Monte Carlo estimation, reparameterization, and mini-batching.

2024

Matrix-Structured Parameterization in MCMC for Accelerated Hypertension Prevalence Modeling

less than 1 minute read

Published:

Summary: This report presents a simpler way to format Bayesian hierarchical model for hypertension prevalence, using Singapore cohort data. It applies matrix-structured parameterization in MCMC to replace redundant intermediate variables from spline expansions, accelerating computation. This reduces runtime from 60 to 5 hours while maintaining convergence and accuracy, enabling efficient large-scale hypertension prevalence modeling.

2023

Understanding of Methodology for Fertility Rate Forecast Model

less than 1 minute read

Published:

Summary: This note records my understanding and supplementary proofs of Schmertmann et al. (2014)’s Bayesian fertility forecasting framework. It details notation, penalty structures for shape and time, covariance prior construction, and likelihood–prior integration. The write-up illustrates posterior fertility forecasts, using Singapore as an example, while emphasizing personal interpretation and derivations.