Skip to content

Commit 27c8b2a

Browse files
committed
addressed review comments
1 parent 33f3b01 commit 27c8b2a

File tree

4 files changed

+150
-150
lines changed

4 files changed

+150
-150
lines changed

src/functions-reference/binary_distributions.Rmd

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ represents the value true and 0 the value false.
77
if (knitr::is_html_output()) {
88
cat(' * <a href="bernoulli-distribution.html">Bernoulli Distribution</a>\n')
99
cat(' * <a href="bernoulli-logit-distribution.html">Bernoulli Distribution, Logit Parameterization</a>\n')
10-
cat(' * <a href="bernoulli-logit-glm.html">Bernoulli-Logit Generalised Linear Model (Logistic Regression)</a>\n')
10+
cat(' * <a href="bernoulli-logit-glm.html">Bernoulli-Logit generalized Linear Model (Logistic Regression)</a>\n')
1111
}
1212
```
1313

@@ -110,11 +110,11 @@ $\text{logit}^{-1}(\alpha)$; may only be used in transformed data and generated
110110
quantities blocks. For a description of argument and return types, see section
111111
[vectorized PRNG functions](#prng-vectorization).
112112

113-
## Bernoulli-Logit Generalised Linear Model (Logistic Regression) {#bernoulli-logit-glm}
113+
## Bernoulli-Logit Generalized Linear Model (Logistic Regression) {#bernoulli-logit-glm}
114114

115-
Stan also supplies a single primitive for a Generalised Linear Model
116-
with Bernoulli likelihood and logit link function, i.e. a primitive
117-
for a logistic regression. This should provide a more efficient
115+
Stan also supplies a single function for a generalized linear model
116+
with Bernoulli likelihood and logit link function, i.e. a function
117+
for a logistic regression. This provides a more efficient
118118
implementation of logistic regression than a manually written
119119
regression in terms of a Bernoulli likelihood and matrix
120120
multiplication.
@@ -147,9 +147,9 @@ dropping constant additive terms.
147147

148148
`real` **`bernoulli_logit_glm_lpmf`**`(int y | matrix x, real alpha, vector beta)`<br>\newline
149149
The log Bernoulli probability mass of y given chance of success
150-
`inv_logit(alpha + x * beta)`, where a constant intercept `alpha` and dependant variable value `y` are used
151-
for all observations. The number of columns of `x` needs to match the length of the
152-
weight vector `beta`.
150+
`inv_logit(alpha + x * beta)`, where the same intercept `alpha` and dependant variable value `y` are used
151+
for all observations. The number of columns of `x` needs to match the size of the
152+
coefficient vector `beta`.
153153
If `x` and `y` are data (not parameters) this function can be executed on a GPU.
154154

155155
<!-- real; bernoulli_logit_glm_lpmf; (int y | matrix x, vector alpha, vector beta); -->
@@ -158,43 +158,43 @@ If `x` and `y` are data (not parameters) this function can be executed on a GPU.
158158
`real` **`bernoulli_logit_glm_lpmf`**`(int y | matrix x, vector alpha, vector beta)`<br>\newline
159159
The log Bernoulli probability mass of y given chance of success
160160
`inv_logit(alpha + x * beta)`, where an intercept `alpha` is used that is
161-
allowed to vary with the different observations. The dependant variable
161+
allowed to vary by observation. The dependant variable
162162
value `y` is used for all observations.
163-
The number of rows of `x` must match the length of `alpha` and
164-
the number of columns of `x` needs to match the length of the weight vector `beta`.
163+
The number of rows of `x` must match the size of `alpha` and
164+
the number of columns of `x` needs to match the size of the coefficient vector `beta`.
165165
If `x` and `y` are data (not parameters) this function can be executed on a GPU.
166166

167167
<!-- real; bernoulli_logit_glm_lpmf; (int[] y | row_vector x, real alpha, vector beta); -->
168168
\index{{\tt \bfseries bernoulli\_logit\_glm\_lpmf }!{\tt (int[] y \textbar\ row\_vector x, real alpha, vector beta): real}|hyperpage}
169169

170170
`real` **`bernoulli_logit_glm_lpmf`**`(int[] y | row_vector x, real alpha, vector beta)`<br>\newline
171171
The log Bernoulli probability mass of y given chance of success
172-
`inv_logit(alpha + x * beta)`, where a constant intercept `alpha` and
172+
`inv_logit(alpha + x * beta)`, where the same intercept `alpha` and
173173
same independent variables values `x` are used for all observations.
174-
The number of columns of `x` needs to match the length of the weight vector `beta`.
174+
The number of columns of `x` needs to match the size of the coefficient vector `beta`.
175175

176176
<!-- real; bernoulli_logit_glm_lpmf; (int[] y | row_vector x, vector alpha, vector beta); -->
177177
\index{{\tt \bfseries bernoulli\_logit\_glm\_lpmf }!{\tt (int[] y \textbar\ row\_vector x, vector alpha, vector beta): real}|hyperpage}
178178

179179
`real` **`bernoulli_logit_glm_lpmf`**`(int[] y | row_vector x, vector alpha, vector beta)`<br>\newline
180180
The log Bernoulli probability mass of y given chance of success
181181
`inv_logit(alpha + x * beta)`, where an intercept `alpha` is used that is
182-
allowed to vary with the different observations.
183-
Same independent variables values `x` are used for all observations.
184-
The length of `y` must match the length of `alpha` and
185-
the number of columns of `x` needs to match the length of the weight vector `beta`.
182+
allowed to vary by observation.
183+
The same independent variables values `x` are used for all observations.
184+
The size of `y` must match the size of `alpha` and
185+
the number of columns of `x` needs to match the size of the coefficient vector `beta`.
186186

187187

188188
<!-- real; bernoulli_logit_glm_lpmf; (int[] y | matrix x, real alpha, vector beta); -->
189189
\index{{\tt \bfseries bernoulli\_logit\_glm\_lpmf }!{\tt (int[] y \textbar\ matrix x, real alpha, vector beta): real}|hyperpage}
190190

191191
`real` **`bernoulli_logit_glm_lpmf`**`(int[] y | matrix x, real alpha, vector beta)`<br>\newline
192192
The log Bernoulli probability mass of y given chance of success
193-
`inv_logit(alpha + x * beta)`, where a constant intercept `alpha` is used
193+
`inv_logit(alpha + x * beta)`, where the same intercept `alpha` is used
194194
for all observations. The number of rows of the independent variable
195-
matrix `x` needs to match the length of the dependent variable vector
196-
`y` and the number of columns of `x` needs to match the length of the
197-
weight vector `beta`.
195+
matrix `x` needs to match the size of the dependent variable vector
196+
`y` and the number of columns of `x` needs to match the size of the
197+
coefficient vector `beta`.
198198
If `x` and `y` are data (not parameters) this function can be executed on a GPU.
199199

200200
<!-- real; bernoulli_logit_glm_lpmf; (int[] y | matrix x, vector alpha, vector beta); -->
@@ -203,8 +203,8 @@ If `x` and `y` are data (not parameters) this function can be executed on a GPU.
203203
`real` **`bernoulli_logit_glm_lpmf`**`(int[] y | matrix x, vector alpha, vector beta)`<br>\newline
204204
The log Bernoulli probability mass of y given chance of success
205205
`inv_logit(alpha + x * beta)`, where an intercept `alpha` is used that is
206-
allowed to vary with the different observations. The number of rows of
207-
the independent variable matrix `x` needs to match the length of the
206+
allowed to vary by observation. The number of rows of
207+
the independent variable matrix `x` needs to match the size of the
208208
dependent variable vector `y` and `alpha` and the number of columns of
209-
`x` needs to match the length of the weight vector `beta`.
209+
`x` needs to match the size of the coefficient vector `beta`.
210210
If `x` and `y` are data (not parameters) this function can be executed on a GPU.

src/functions-reference/bounded_discrete_distributions.Rmd

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ cat(' * <a href="binomial-distribution-logit-parameterization.html">Binomial Dis
1010
cat(' * <a href="beta-binomial-distribution.html">Beta-Binomial Distribution</a>\n')
1111
cat(' * <a href="hypergeometric-distribution.html">Hypergeometric Distribution</a>\n')
1212
cat(' * <a href="categorical-distribution.html">Categorical Distribution</a>\n')
13-
cat(' * <a href="categorical-logit-glm.html">Categorical Logit Generalised Linear Model (Softmax Regression)</a>\n')
13+
cat(' * <a href="categorical-logit-glm.html">Categorical Logit generalized Linear Model (Softmax Regression)</a>\n')
1414
cat(' * <a href="ordered-logistic-distribution.html">Ordered Logistic Distribution</a>\n')
15-
cat(' * <a href="ordered-logistic-glm.html">Ordered Logistic Generalised Linear Model (Ordinal Regression)</a>\n')
15+
cat(' * <a href="ordered-logistic-glm.html">Ordered Logistic generalized Linear Model (Ordinal Regression)</a>\n')
1616
cat(' * <a href="ordered-probit-distribution.html">Ordered Probit Distribution</a>\n')
1717
}
1818
```
@@ -240,8 +240,8 @@ an $N$-simplex (i.e., has nonnegative entries summing to one), then
240240
for $y \in \{1,\ldots,N\}$, \[ \text{Categorical}(y~|~\theta) =
241241
\theta_y. \] In addition, Stan provides a log-odds scaled categorical
242242
distribution, \[ \text{CategoricalLogit}(y~|~\beta) =
243-
\text{Categorical}(y~|~\text{softmax}(\beta)). \] See section
244-
[softmax](#softmax) for the definition of the softmax function.
243+
\text{Categorical}(y~|~\text{softmax}(\beta)). \]
244+
See [the definition of softmax](#softmax) for the definition of the softmax function.
245245

246246
### Sampling Statement
247247

@@ -298,24 +298,24 @@ Generate a categorical variate with outcome in range $1:N$ from
298298
log-odds vector beta; may only be used in transformed data and generated
299299
quantities blocks
300300

301-
## Categorical Logit Generalised Linear Model (Softmax Regression) {#categorical-logit-glm}
301+
## Categorical Logit Generalized Linear Model (Softmax Regression) {#categorical-logit-glm}
302302

303-
Stan also supplies a single primitive for a Generalised Linear Model
304-
with Categorical likelihood and logit link function, i.e. a primitive
305-
for a softmax regression. This should provide a more efficient
303+
Stan also supplies a single function for a generalized linear model
304+
with categorical likelihood and logit link function, i.e. a function
305+
for a softmax regression. This provides a more efficient
306306
implementation of softmax regression than a manually written
307307
regression in terms of a Categorical likelihood and matrix
308308
multiplication.
309309

310-
Note that the implementation does not put any restrictions on the coefficient matrix $\beta$. It is up to the user to use a reference category, a suitable prior or some other means of avoiding non-identifiability. See Multi-logit in the [Stan User's Guide](https://mc-stan.org/docs/2_21/stan-users-guide/multi-logit-section.html).
310+
Note that the implementation does not put any restrictions on the coefficient matrix $\beta$. It is up to the user to use a reference category, a suitable prior or some other means of identifiability. See Multi-logit in the [Stan User's Guide](https://mc-stan.org/users/documentation/).
311311

312312
### Probability Mass Functions
313313

314314
If $N,M,K \in \mathbb{N}$, $N,M,K > 0$, and if $x\in \mathbb{R}^{M\cdot K}, \alpha \in \mathbb{R}^N, \beta\in \mathbb{R}^{K\cdot N}$, then for $y \in \{1,\ldots,N\}^M$,
315315
\[ \text{CategoricalLogitGLM}(y~|~x,\alpha,\beta) = \\[5pt]
316316
\prod_{1\leq i \leq M}\text{CategoricalLogit}(y_i~|~\alpha+x_i\cdot\beta) = \\[15pt]
317317
\prod_{1\leq i \leq M}\text{Categorical}(y_i~|~softmax(\alpha+x_i\cdot\beta)). \]
318-
See section [softmax](#softmax) for the definition of the softmax function.
318+
See [the definition of softmax](#softmax) for the definition of the softmax function.
319319

320320
### Sampling Statement
321321

@@ -335,44 +335,44 @@ dropping constant additive terms.
335335
`real` **`categorical_logit_glm_lpmf`**`(int y | row_vector x, vector alpha, matrix beta)`<br>\newline
336336
The log categorical probability mass function with outcome `y` in
337337
$1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`.
338-
The size of independent variable row vector `x` needs to match the number of rows of the
339-
weight matrix `beta`. The size of intercept vector `alpha` must match number
340-
of columns of the weight matrix `beta`.
338+
The size of the independent variable row vector `x` needs to match the number of rows of the
339+
coefficient matrix `beta`. The size of the intercept vector `alpha` must match the number
340+
of columns of the coefficient matrix `beta`.
341341

342342
<!-- real; categorical_logit_glm_lpmf; (int y | matrix x, vector alpha, matrix beta); -->
343343
\index{{\tt \bfseries categorical\_logit\_glm\_lpmf }!{\tt (int y \textbar\ matrix x, vector alpha, matrix beta): real}|hyperpage}
344344

345345
`real` **`categorical_logit_glm_lpmf`**`(int y | matrix x, vector alpha, matrix beta)`<br>\newline
346346
The log categorical probability mass function with outcomes `y` in
347347
$1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`.
348-
Same vector of intercepts `alpha` and same dependant variable value `y` are used for all instances.
349-
The number of columns of independent variable `x` needs to match the number of rows of the
350-
weight matrix `beta`. The size of intercept vector `alpha` must match number
351-
of columns of the weight matrix `beta`. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
348+
The same vector of intercepts `alpha` and the same dependent variable value `y` are used for all instances.
349+
The number of columns of the independent variable `x` needs to match the number of rows of the
350+
coefficient matrix `beta`. The size of the intercept vector `alpha` must match the number
351+
of columns of the coefficient matrix `beta`. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
352352

353353
<!-- real; categorical_logit_glm_lpmf; (int[] y | vector theta); -->
354354
\index{{\tt \bfseries categorical\_logit\_glm\_lpmf }!{\tt (int[] y \textbar\ row\_vector x, vector alpha, matrix beta): real}|hyperpage}
355355

356356
`real` **`categorical_logit_glm_lpmf`**`(int[] y | row_vector x, vector alpha, matrix beta)`<br>\newline
357357
The log categorical probability mass function with outcomes `y` in
358358
$1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`.
359-
Same vector of intercepts `alpha` and same row vector of independent variables `x` are used for all instances.
360-
The size of independent variable matrix `x` needs to match the number of rows of the
361-
weight vector `beta`. The size of intercept vector `alpha` must match number
362-
of columns of the weight vector `beta`.
359+
The same vector of intercepts `alpha` and same row vector of the independent variables `x` are used for all instances.
360+
The size of the independent variable matrix `x` needs to match the number of rows of the
361+
coefficient vector `beta`. The size of the intercept vector `alpha` must match the number
362+
of columns of the coefficient vector `beta`.
363363

364364
<!-- real; categorical_logit_glm_lpmf; (int[] y | vector theta); -->
365365
\index{{\tt \bfseries categorical\_logit\_glm\_lpmf }!{\tt (int[] y \textbar\ matrix x, vector alpha, matrix beta): real}|hyperpage}
366366

367367
`real` **`categorical_logit_glm_lpmf`**`(int[] y | matrix x, vector alpha, matrix beta)`<br>\newline
368368
The log categorical probability mass function with outcomes `y` in
369369
$1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`.
370-
Same vector of intercepts `alpha` is used for all instances.
370+
The same vector of intercepts `alpha` is used for all instances.
371371
The number of rows of the independent variable
372-
matrix `x` needs to match the length of the dependent variable vector
372+
matrix `x` needs to match the size of the dependent variable vector
373373
`y`. The number of columns of independnt variable `x` needs to match the number of rows of the
374-
weight matrix `beta`. The size of intercept vector `alpha` must match number
375-
of columns of the weight matrix `beta`. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
374+
coefficient matrix `beta`. The size of the intercept vector `alpha` must match the number
375+
of columns of the coefficient matrix `beta`. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
376376

377377

378378
## Ordered Logistic Distribution
@@ -409,16 +409,16 @@ dropping constant additive terms.
409409

410410
`real` **`ordered_logistic_lpmf`**`(ints k | vector eta, vectors c)`<br>\newline
411411
The log ordered logistic probability mass of k given linear predictors
412-
eta, and cutpoints c.
412+
`eta`, and cutpoints `c`.
413413

414414
<!-- int; ordered_logistic_rng; (real eta, vector c); -->
415415
\index{{\tt \bfseries ordered\_logistic\_rng }!{\tt (real eta, vector c): int}|hyperpage}
416416

417417
`int` **`ordered_logistic_rng`**`(real eta, vector c)`<br>\newline
418-
Generate an ordered logistic variate with linear predictor eta and
419-
cutpoints c; may only be used in transformed data and generated quantities blocks
418+
Generate an ordered logistic variate with linear predictor `eta` and
419+
cutpoints `c`; may only be used in transformed data and generated quantities blocks
420420

421-
## Ordered Logistic Generalised Linear Model (Ordinal Regression)
421+
## Ordered Logistic Generalized Linear Model (Ordinal Regression)
422422

423423
### Probability Mass Function
424424

@@ -453,36 +453,36 @@ dropping constant additive terms.
453453

454454
`real` **`ordered_logistic_glm_lpmf`**`(int y | row_vector x, vector beta, vector c)`<br>\newline
455455
The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c.
456-
The size of independent variable row vector `x` needs to match the size of the weight vector `beta`.
457-
Cutpoints `c` must be ordered.
456+
The size of the independent variable row vector `x` needs to match the size of the coefficient vector `beta`.
457+
The cutpoints `c` must be ordered.
458458

459459
<!-- real; ordered_logistic_glm_lpmf; (int y | matrix x, vector beta, vector c); -->
460460
\index{{\tt \bfseries ordered\_logistic\_glm\_lpmf }!{\tt (int y \textbar\ matrix x, vector beta, vector c): real}|hyperpage}
461461

462462
`real` **`ordered_logistic_glm_lpmf`**`(int y | matrix x, vector beta, vector c)`<br>\newline
463463
The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c.
464-
Same value of independent variable `y` is used for all instances.
465-
The number of columns of independent variable row vector `x` needs to match the size of the weight vector `beta`.
466-
Cutpoints `c` must be ordered. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
464+
The same value of the independent variable `y` is used for all instances.
465+
The number of columns of the independent variable row vector `x` needs to match the size of the coefficient vector `beta`.
466+
The cutpoints `c` must be ordered. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
467467

468468
<!-- real; ordered_logistic_glm_lpmf; (int[] y | row_vector x, vector beta, vector c); -->
469469
\index{{\tt \bfseries ordered\_logistic\_glm\_lpmf }!{\tt (int[] y \textbar\ row\_vector x, vector beta, vector c): real}|hyperpage}
470470

471471
`real` **`ordered_logistic_glm_lpmf`**`(int[] y | row_vector x, vector beta, vector c)`<br>\newline
472472
The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c.
473-
Same row vector of independent variables `x` is used for all instances.
474-
The size of independent variable row vector `x` needs to match the size of the weight vector `beta`.
475-
Cutpoints `c` must be ordered.
473+
The same row vector of the independent variables `x` is used for all instances.
474+
The size of the independent variable row vector `x` needs to match the size of the coefficient vector `beta`.
475+
The cutpoints `c` must be ordered.
476476

477477
<!-- real; ordered_logistic_glm_lpmf; (int[] y | matrix x, vector beta, vector c); -->
478478
\index{{\tt \bfseries ordered\_logistic\_glm\_lpmf }!{\tt (int[] y \textbar\ matrix x, vector beta, vector c): real}|hyperpage}
479479

480480
`real` **`ordered_logistic_glm_lpmf`**`(int[] y | matrix x, vector beta, vector c)`<br>\newline
481481
The log ordered logistic probability mass of y, given linear predictors
482482
`x * beta`, and cutpoints c.
483-
The number of rows of the independent variable matrix `x` needs to match the length of the dependent variable vector `y`.
484-
The number of columns of independent variable row vector `x` needs to match the size of the weight vector `beta`.
485-
Cutpoints `c` must be ordered. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
483+
The number of rows of the independent variable matrix `x` needs to match the size of the dependent variable vector `y`.
484+
The number of columns of the independent variable row vector `x` needs to match the size of the coefficient vector `beta`.
485+
The cutpoints `c` must be ordered. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
486486

487487

488488
## Ordered Probit Distribution

0 commit comments

Comments
 (0)