Skip to content

Commit bad44eb

Browse files
committed
Update more deprecated syntac
1 parent 80af4b6 commit bad44eb

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed

dev-notes/rstanarm_dev_notes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Because we center the covariates when there is an intercept, you have to separat
7070
```
7171
...
7272
generated quantities {
73-
real alpha[has_intercept];
73+
array[has_intercept] real alpha;
7474
if (has_intercept) {
7575
alpha[1] = gamma[1] - dot_product(beta, xbar)
7676
}

src/stan_files/functions/SSfunctions.stan

-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
vector SS_asymp(vector input, matrix Phi_);
2-
vector SS_asympOff(vector input, matrix Phi_);
3-
vector SS_asympOrig(vector input, matrix Phi_);
4-
vector SS_biexp(vector input, matrix Phi_);
5-
vector SS_fol(vector Dose, vector input, matrix Phi_);
6-
vector SS_fpl(vector input, matrix Phi_);
7-
vector SS_gompertz(vector x, matrix Phi_);
8-
vector SS_logis(vector input, matrix Phi_);
9-
vector SS_micmen(vector input, matrix Phi_);
10-
vector SS_weibull(vector x, matrix Phi_);
11-
121
/* These functions (without the underscores) are all documented in R
132
See also Appendix C of Pinheiro and Bates
143
https://books.google.com/books?id=3TVDAAAAQBAJ&lpg=PR3&dq=Pinheiro%20and%20Bates&pg=PA511#v=onepage&q&f=false

src/stan_files/functions/bernoulli_likelihoods.stan

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
* @param eta_j Vector of linear predictions in the j-th group
8383
* @return A scalar that normalizes the probabilities on the log-scale
8484
*/
85-
real log_clogit_denom(int N_j, int D_j, vector eta_j);
8685
real log_clogit_denom(int N_j, int D_j, vector eta_j) {
8786
if (D_j == 1 && N_j == rows(eta_j)) return log_sum_exp(eta_j);
8887
if (D_j == 0) return 0;

src/stan_files/lm.stan

+8-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,14 @@ model {
103103
if (prior_dist == 1) {
104104
if (K > 1)
105105
target += beta_lpdf(R2 | half_K, eta);
106-
else
107-
target += beta_lpdf(square(R2) | half_K, eta) + sum(log(fabs(R2)));
106+
else {
107+
// TODO(Andrew) remove once vectorised abs available in rstan
108+
array[J] real R2_abs;
109+
for (j in 1:J) {
110+
R2_abs[j] = abs(R2[j]);
111+
}
112+
target += beta_lpdf(square(R2) | half_K, eta) + sum(log(R2_abs));
113+
}
108114
}
109115
// implicit: log_omega is uniform over the real line for all j
110116
}

src/stan_files/polr.stan

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ functions {
1414
// links in MASS::polr() are in a different order than binomial()
1515
// logistic, probit, loglog, cloglog, cauchit
1616
if (link == 1)
17-
return (inv_logit(x));
17+
return exp(log_inv_logit(x));
1818
else if (link == 2)
19-
return (Phi(x));
19+
return exp(std_normal_lcdf(x|));
2020
else if (link == 3)
21-
return (gumbel_cdf(x, 0, 1));
21+
return exp(gumbel_lcdf(x | 0, 1));
2222
else if (link == 4)
23-
return (inv_cloglog(x));
23+
return inv_cloglog(x);
2424
else if (link == 5)
25-
return (cauchy_cdf(x, 0, 1));
25+
return exp(cauchy_lcdf(x | 0, 1));
2626
else
2727
reject("Invalid link");
2828
return x; // never reached

0 commit comments

Comments
 (0)