楼主: tulipsliu
1909 12

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

11
tulipsliu 在职认证  发表于 2020-12-7 10:32:09
$$p_j = 2\Phi(\sin^{-1}((R-r)/x)) - 1 , \mbox{ for } j=1,\dots, J.$$

12
tulipsliu 在职认证  发表于 2020-12-7 10:42:44
> myinits <- list(
+   list(gplus=rep(1.2, 3), beta=rep(.5, 3), mug=1.2, sigmag=.1, mub=.8, sigmab=.8),
+   list(gplus=rep(1.2, 3), beta=rep(.5, 3), mug=1.5, sigmag=.2, mub=1, sigmab=1.2))
>
> # Parameters to be monitored:
> parameters <- c("beta", "gplus", "mub", "mug", "sigmab", "sigmag")  
>
> # The following command calls Stan with specific options.
> # For a detailed description type "?rstan".
> samples <- stan(model_code=model,   
+                 data=data,
+                 init=myinits,  # If not specified, gives random inits
+                 pars=parameters,
+                 iter=1500,
+                 chains=2,
+                 thin=1,
+                 warmup=500,  # Stands for burn-in; Default = iter/2
+                 seed=1234  # Setting seed; Default is random seed
+ )
DIAGNOSTIC(S) FROM PARSER:
Info: assignment operator <- deprecated in the Stan language; use = instead.
Info: assignment operator <- deprecated in the Stan language; use = instead.

When you compile models, you are also contributing to development of the NEXT
Stan compiler. In this version of rstan, we compile your model as usual, but
also test our new compiler on your syntactically correct model. In this case,
the new compiler did not work like we hoped. By filing an issue at
https://github.com/stan-dev/stanc3/issues with your model
or a minimal example that shows this warning you will be contributing
valuable information to Stan and ensuring your models continue working. Thank you!
This message can be avoided by wrapping your function call inside suppressMessages()
or by first calling rstan_options(javascript = FALSE).
Error in context_eval(join(src), private$context, serialize) :
  0,248,Failure,-3,

recompiling to avoid crashing R session

SAMPLING FOR MODEL 'a5aa05edd56cc33bf5bfd3c67c4720f7' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 0.001 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 10 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration:    1 / 1500 [  0%]  (Warmup)
Chain 1: Iteration:  150 / 1500 [ 10%]  (Warmup)
Chain 1: Iteration:  300 / 1500 [ 20%]  (Warmup)
Chain 1: Iteration:  450 / 1500 [ 30%]  (Warmup)
Chain 1: Iteration:  501 / 1500 [ 33%]  (Sampling)
Chain 1: Iteration:  650 / 1500 [ 43%]  (Sampling)
Chain 1: Iteration:  800 / 1500 [ 53%]  (Sampling)
Chain 1: Iteration:  950 / 1500 [ 63%]  (Sampling)
Chain 1: Iteration: 1100 / 1500 [ 73%]  (Sampling)
Chain 1: Iteration: 1250 / 1500 [ 83%]  (Sampling)
Chain 1: Iteration: 1400 / 1500 [ 93%]  (Sampling)
Chain 1: Iteration: 1500 / 1500 [100%]  (Sampling)
Chain 1:
Chain 1:  Elapsed Time: 3.067 seconds (Warm-up)
Chain 1:                3.797 seconds (Sampling)
Chain 1:                6.864 seconds (Total)
Chain 1:

SAMPLING FOR MODEL 'a5aa05edd56cc33bf5bfd3c67c4720f7' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 0 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration:    1 / 1500 [  0%]  (Warmup)
Chain 2: Iteration:  150 / 1500 [ 10%]  (Warmup)
Chain 2: Iteration:  300 / 1500 [ 20%]  (Warmup)
Chain 2: Iteration:  450 / 1500 [ 30%]  (Warmup)
Chain 2: Iteration:  501 / 1500 [ 33%]  (Sampling)
Chain 2: Iteration:  650 / 1500 [ 43%]  (Sampling)
Chain 2: Iteration:  800 / 1500 [ 53%]  (Sampling)
Chain 2: Iteration:  950 / 1500 [ 63%]  (Sampling)
Chain 2: Iteration: 1100 / 1500 [ 73%]  (Sampling)
Chain 2: Iteration: 1250 / 1500 [ 83%]  (Sampling)
Chain 2: Iteration: 1400 / 1500 [ 93%]  (Sampling)
Chain 2: Iteration: 1500 / 1500 [100%]  (Sampling)
Chain 2:
Chain 2:  Elapsed Time: 3.426 seconds (Warm-up)
Chain 2:                3.505 seconds (Sampling)
Chain 2:                6.931 seconds (Total)
Chain 2:
Warning messages:
1: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  'C:/rtools40/usr/mingw_/bin/g++' not found
2: There were 45 divergent transitions after warmup. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
to find out why this is a problem and how to eliminate them.
3: Examine the pairs() plot to diagnose sampling problems

13
tulipsliu 在职认证  发表于 2020-12-7 11:05:19
$$
\xi_{ij}=\prod_{k=1}^{K}\alpha_{jk}^{q_{ik}}
$$

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-16 15:45