楼主: tulipsliu
1926 12

[程序分享] 以后以发布PDF教学教材为主 [推广有奖]

经济学论述自由撰稿人!

已卖:2752份资源

学科带头人

45%

还不是VIP/贵宾

-

威望
0
论坛币
386045 个
通用积分
527.0498
学术水平
127 点
热心指数
140 点
信用等级
103 点
经验
46986 点
帖子
1773
精华
0
在线时间
2509 小时
注册时间
2007-11-5
最后登录
2026-2-7

初级热心勋章

楼主
tulipsliu 在职认证  发表于 2020-12-6 13:02:46 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
今天进行了新的测试,以后不论是 MATLAB还是R程序,都会做成PDF 文件的样子发布,作为课程发布;
今天没有对英文单词的拼写是否正确进行校正。

只是测试一下,这次的测试不收论坛币,以后发布的课程都会收论坛币。因为今天的测试使用了一个命令 echo ,这样的话大家看不到源代码。以后发布的 PDF 文件,会把源代码添加进去。让大家使用的时候更加的容易。


$$
{\varepsilon _t} = H_t^{1/2}{z_t},
$$



firstlession.pdf (439.09 KB)


图片一张:
一个贝叶斯估计的图片


后续上传带代码的PDF文件。

图片二,本帖明天添加一个带有源代码的 R 软件的PDF 文件后,不再修改本帖;
这个图片是 R 软件贝叶斯计量做的图片。 不过使用难度非常高,大概需要大学教授、博士学位水平,我群里会 WinBUGS贝叶斯估计的也是一个博士后弟弟;认识了十年了吧。
先上代码:
  1. ## 贝叶斯模型 WinBUGS 软件模型设定格式

  2. model <- "
  3. // Logistic Psychophysical Function
  4. data {
  5.   int nsubjs;
  6.   int nstim[nsubjs];
  7.   int n[nsubjs,28];
  8.   int r[nsubjs,28];
  9.   int x[nsubjs,28];
  10.   vector[nsubjs] xmean;
  11. }
  12. parameters {
  13.   real mua;
  14.   real mub;
  15.   real<lower=0,upper=1000> sigmaa;
  16.   real<lower=0,upper=1000> sigmab;
  17.   vector[nsubjs] alpha;
  18.   vector[nsubjs] beta;
  19. }
  20. model {
  21.   // Priors
  22.   mua ~ normal(0, inv_sqrt(.001));
  23.   mub ~ normal(0, inv_sqrt(.001));
  24.   
  25.   alpha ~ normal(mua, sigmaa);
  26.   beta ~ normal(mub, sigmab);
  27.   
  28.   for (i in 1:nsubjs) {
  29.     for (j in 1:nstim[i]) {   
  30.       real theta;
  31.       theta <- inv_logit(alpha[i] + beta[i] * (x[i,j] - xmean[i]));
  32.       r[i,j] ~ binomial(n[i,j], theta);
  33.     }
  34.   }
  35. }"
复制代码
插入的第二张图片, 这样看来本帖过于大,不再增加带有代码的 PDF 文件, 那么以后的帖子会采用带有彩色代码,重要的事情强调一遍。(彩色R代码的PDF文件,以后经常上传论坛。代码可以自己在自己的电脑上测试)。
图片二.png
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:PDF MATLAB matla atlab 英文单词

已有 1 人评分论坛币 收起 理由
cheetahfly + 30 精彩帖子

总评分: 论坛币 + 30   查看全部评分

劳动经济学

沙发
tulipsliu 在职认证  发表于 2020-12-6 16:39:22
$$
\begin{aligned}
y_t(\tau) ~ &= ~ \beta_{1t} ~ + \beta_{2t} \left( \frac{1 ~ - ~ e^{-\lambda\tau}}{\lambda\tau}  \right) ~ + ~ \beta_{3t} \left( \frac{1 ~ - ~ e^{-\lambda\tau}}{\lambda\tau} ~ - ~ e^{-\lambda\tau}  \right) ~ + ~ \varepsilon_t(\tau), &\varepsilon_t ~ &\sim ~ N(0, ~ \sigma^2I_p), \\
\beta_{t+1} ~ &= ~ \left( I ~ - ~ \Phi\right)\mu ~ + ~ \Phi\beta_t + \eta_t, &\eta_t ~ &\sim ~ N(0, ~ \Sigma_{\eta}), \\
  & &\beta_1 ~ &\sim ~ N(\mu, ~ P_{\beta}),
\end{aligned}
$$
where $y_t(\tau)$ is the interest rate at time $t$ for maturity $\tau$, $\lambda$ is a constant, $p$ is the number of maturities (dependent variables), $\beta_t$ is the unobserved vector containing the factors $\beta_{1t}$, $\beta_{2t}$, $\beta_{3t}$, $\mu$ is a vector containing the means of the factors, $\Phi$ is a vector autoregressive coefficient matrix corresponding to a stationary process, and $P_\beta$ is the initial uncertainty of $\beta_1$ that is chosen such that $P_\beta ~ - ~ \Phi P_\beta \Phi^{\top} ~ = ~ \Sigma_\eta$. The factors in $\beta$ have an interesting interpretation: $\beta_1$ can be seen as the level for all interest rates, $\beta_2$ identifies the slope of the yield curve, and $\beta_3$ represents the shape of the yield curve.

藤椅
tulipsliu 在职认证  发表于 2020-12-6 16:42:52
$$
\begin{aligned}
y_t ~ &= ~ \mu_t ~ + ~ \varepsilon_t, ~~~~~~ \varepsilon_t ~ \sim ~ N(0, ~ \sigma_\varepsilon^2), \\
\mu_{t+1} ~ &= ~ \mu_t ~ + ~ \eta_t, ~~~~~~ \eta_t ~ \sim ~ N(0, ~ \sigma_\eta^2),
\end{aligned}
$$


where $y_t$ is the dependent variable at time $t$, $\mu_t$ is the unobserved level at time $t$, and $\varepsilon_t$ and $\eta_t$ are disturbances. This model has two parameters, $\sigma_\varepsilon^2$ and $\sigma_\eta^2$ that will be estimated by maximising the loglikelihood. In addition, the level $\mu_t$ is a state parameter that will be estimated by employing the Kalman Filter.

板凳
tulipsliu 在职认证  发表于 2020-12-6 16:44:52
$$
\begin{aligned}
y_t ~ &= ~ Z_t\alpha_t ~ + ~ \varepsilon_t, &\varepsilon_t ~ &\sim ~ N(0, ~ H_t), \\
\alpha_{t+1} ~ &= ~ T_t\alpha_t ~ + ~ R_t\eta_t, &\eta_t ~ &\sim ~ N(0, ~ Q_t), \\
& &\alpha_1 ~ &\sim ~ N(a_1, ~ P_1),
\end{aligned}
$$

where $y_t$ is the *observation vector*, a $p ~ \times ~ 1$ vector of dependent variables at time $t$, $\alpha_t$ is the unobserved *state vector*, a $m ~ \times ~ 1$ vector of state variables at time $t$, and $\varepsilon_t$ and $\eta_t$ are disturbance vectors of respectively the observation equation, and the state equation. To initialise the model, $a_1$ is used as the initial guess of the state vector, and $P_1$ is the corresponding uncertainty of that guess. The matrices $Z_t$, $H_t$, $T_t$, $R_t$, and $Q_t$ are called the *system matrices* of the state space model. Different specifications of these system matrices, lead to different interpretations of the model at hand.

报纸
tulipsliu 在职认证  发表于 2020-12-7 07:18:29
## Definition of the GMVAR model
The Gaussian mixture vector autoregressive (GMVAR) model with $M$ mixture components and autoregressive order $p$, which we refer to as the GMVAR($p,M$) model, is a mixture of $M$ stationary Gaussian VAR($p$) models with time varying mixing weights. At each point of time $t$, a GMVAR process generates an observation from one of its mixture components (also called regimes) according to the probabilities pointed by the mixing weights.

Let $y_t=(y_{1t},...,y_{dt})$, $t=1,2,...$ be the $d$-dimensional vector valued time series of interest, and let $\mathcal{F}_{t-1}$ be the $\sigma$-algebra generated by the random variables $\lbrace y_{t-j},j>0 \rbrace$ (containing the information on the past of $y_t$). Let $M$ be the number of mixture components, and $\boldsymbol{s}_t=(s_{t,1},...,s_{t,M})$ a sequence of (non-observable) random vectors such that at each $t$ exactly one of its components takes the value one and others take the value zero. The component that takes the value one is selected according to the probabilities $Pr(s_{t,m}=1|\mathcal{F}_{t-1})\equiv\alpha_{m,t}$, $m=1,...,M$ with $\sum_{m=1}^M\alpha_{m,t}=1$ for all $t$.
Then, for a GMVAR($p,M$) model, we have
$$
y_t = \sum_{m=1}^M s_{t,m}(\mu_{m,t}+\Omega_{m}^{1/2}\varepsilon_t), \quad \varepsilon_t\sim\text{NID}(0,I_d),
$$

地板
tulipsliu 在职认证  发表于 2020-12-7 07:18:50
where $\Omega_{m}$ is a conditional positive definite covariance matrix, NID stands for "normally and independently distributed", and
$$
\mu_{m,t} = \varphi_{m,0} + \sum_{i=1}^p A_{m,i}y_{t-i}
$$

7
tulipsliu 在职认证  发表于 2020-12-7 07:19:08
For each $m=1,...,M$, the AR matrices $A_{m,i}$, $i=1,...,p$ are assumed to satisfy the usual stability condition of VAR models. Namely, denoting
$$
\boldsymbol{A}_m=
\begin{bmatrix}
A_{m,1} & A_{m,2} & \cdots & A_{m,p-1} & A_{m,p} \\
I_d & 0   & \cdots & 0       & 0   \\
0   & I_d & \cdots & 0       & 0   \\
\vdots &  & \ddots & 0       & 0   \\
0   & 0   & \cdots & I_d     & 0
\end{bmatrix}
\enspace (dp\times dp)
$$

8
tulipsliu 在职认证  发表于 2020-12-7 07:19:30
we assume that modulus of all eigenvalues of the matrix $\boldsymbol{A}_m$ are smaller than one, for each $m=1,...,M$.

Based on the above definition, the conditional density function of $y_t$ given $\mathcal{F}_{t-1}$, $f(\cdot|\mathcal{F}_{t-1})$, is given as
$$
f(y_t|\mathcal{F}_{t-1}) = \sum_{m=1}^M\alpha_{m,t}(2\pi)^{-d/2}\det(\Omega_m)^{-1/2}\exp\left\lbrace -\frac{1}{2}(y_t-\mu_{m,t})′\Omega_m^{-1}(y_t-\mu_{m,t}) \right\rbrace .
$$

9
tulipsliu 在职认证  发表于 2020-12-7 07:19:47
The distribution of $y_t$ given its past is thus a mixture of multivariate normal distributions with time varying mixing weights $\alpha_{m,t}$. The conditional mean and covariance matrix of $y_t$ given $\mathcal{F}_{t-1}$ are obtained as
$$
\text{E}[y_t|\mathcal{F}_{t-1}]=\sum_{m=1}^M\alpha_{m,t}\mu_{m,t}, \quad \text{Cov}[y_t|\mathcal{F}_{t-1}]=\sum_{m=1}^M\alpha_{m,t}\Omega_m + \sum_{m=1}^M\alpha_{m,t}\left(\mu_{m,t} - \sum_{n=1}^M\alpha_{n,t}\mu_{n,t} \right)\left(\mu_{m,t} - \sum_{n=1}^M\alpha_{n,t}\mu_{n,t} \right)'.
$$

10
tulipsliu 在职认证  发表于 2020-12-7 10:31:50
$$y_j \sim \mbox{binomial}(n_j, p_j)$$

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-2-7 23:55