The following R codes implement the Example 5.13 in Statistical Computing with R, and compare the estimate \(\hat{\theta}\) and \(\hat{\sigma}\) from stratified importance sampling to the results from importance sampling. The example illustrates that stratification can reduce the varinace of importance sampling estimator.
M <- 100000 # number of replicates g <- function(x) { exp(-x - log(1 + x^2)) * (x > 0) * (x < 1) } # importance sampling u <- runif(M) # f3, inverse transform method x <- -log(1 - u * (1 - exp(-1))) fg <- g(x) / (exp(-x) / (1 - exp(-1))) (theta.

1 SIRS Model The SIRS model is simply an extension of the SIR model as it allows members of the recovered class to rejoin the susceptible class at a defined rate, which integrates the impact of waning immunity following antigenic drift. Similar to the SIR model, a fixed population without births and deaths is considered in the SIRS model. The standard form of SIRS model is described as \[ \begin{equation} \begin{aligned} & \frac{dS}{dt} = fR - \frac{\beta SI}{N} \\ & \frac{dI}{dt} = \frac{\beta SI}{N} - \gamma I \\ & \frac{dR}{dt} = \gamma I - fR \end{aligned} \label{eq1} \end{equation} \] where \(f\) is the average loss of immunity rate of recovered indiviuals, and the other notations are the same as the SIR model.

因探究流感传染能力、存活能力与湿度的关系，今天自己将两年前读过的一篇论文（Shaman.Kohn-PNAS-2009）又翻出来重新读了一遍，

ode45 solvers from both R and MATLAB are used to run simulations of the spread of Hong Kong flu in New York city with different initial susceptible individuals \(S\_0 =\) 790, 7900, 79000, 790000, and 7900000. The maximum infected people \(I_{max}\) under each condition is recorded for comparison. The following codes draw a figure showing the precision difference of ode45 solvers between R and MATLAB.
Imax <- data.frame(S0 = 79 * 10 ^ (1:5), R = c(57.

My object is to rewrite the 4th order Runge-Kutta (abbreviated for RK4) method for solving the absolute humidity-driven SIRS model developed by Yang et al. (2014) in R language. The details of the SIRS model are provided in the paper.
1 RK4 1.1 Preliminary RK4 is one of the classic methods for numerical integration of ODE models. A brief introduction of RK4 refers to Wikipedia.
Consider the following initial value problem of ODE \[ \begin{equation} \begin{aligned} & \frac{dy}{dt} = f(t, y) \\ & y(t_0) = y_0 \end{aligned} \label{eq1-rk4} \end{equation} \] where \(y(t)\) is the unknown function (scalar or vector) which I would like to approximate.

最近想为Ubuntu服务器增加一个用户，然后ssh远程登录使用。折腾了好久总算搞定，现将过程中遇到的问题记录下来，以便将来参考。 1. 创建新用户