Skip to content

Commit 33f3b01

Browse files
committed
some fixes
1 parent a20c2ce commit 33f3b01

File tree

4 files changed

+41
-39
lines changed

4 files changed

+41
-39
lines changed

src/functions-reference/binary_distributions.Rmd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ 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
150+
`inv_logit(alpha + x * beta)`, where a constant intercept `alpha` and dependant variable value `y` are used
151151
for all observations. The number of columns of `x` needs to match the length of the
152152
weight vector `beta`.
153153
If `x` and `y` are data (not parameters) this function can be executed on a GPU.
@@ -157,7 +157,7 @@ If `x` and `y` are data (not parameters) this function can be executed on a GPU.
157157

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
160-
`inv_logit(alpha+x*beta)`, where an intercept `alpha` is used that is
160+
`inv_logit(alpha + x * beta)`, where an intercept `alpha` is used that is
161161
allowed to vary with the different observations. The dependant variable
162162
value `y` is used for all observations.
163163
The number of rows of `x` must match the length of `alpha` and
@@ -169,18 +169,18 @@ If `x` and `y` are data (not parameters) this function can be executed on a GPU.
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
173-
same indepependent variables values `x` are used for all observations.
172+
`inv_logit(alpha + x * beta)`, where a constant intercept `alpha` and
173+
same independent variables values `x` are used for all observations.
174174
The number of columns of `x` needs to match the length of the weight 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
181-
`inv_logit(alpha+x*beta)`, where an intercept `alpha` is used that is
181+
`inv_logit(alpha + x * beta)`, where an intercept `alpha` is used that is
182182
allowed to vary with the different observations.
183-
Same indepependent variables values `x` are used for all observations.
183+
Same independent variables values `x` are used for all observations.
184184
The length of `y` must match the length of `alpha` and
185185
the number of columns of `x` needs to match the length of the weight vector `beta`.
186186

@@ -190,7 +190,7 @@ the number of columns of `x` needs to match the length of the weight vector `bet
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 a constant intercept `alpha` is used
194194
for all observations. The number of rows of the independent variable
195195
matrix `x` needs to match the length of the dependent variable vector
196196
`y` and the number of columns of `x` needs to match the length of the
@@ -202,7 +202,7 @@ If `x` and `y` are data (not parameters) this function can be executed on a GPU.
202202

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
205-
`inv_logit(alpha+x*beta)`, where an intercept `alpha` is used that is
205+
`inv_logit(alpha + x * beta)`, where an intercept `alpha` is used that is
206206
allowed to vary with the different observations. The number of rows of
207207
the independent variable matrix `x` needs to match the length of the
208208
dependent variable vector `y` and `alpha` and the number of columns of

src/functions-reference/bounded_discrete_distributions.Rmd

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,14 @@ 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).
311+
310312
### Probability Mass Functions
311313

312314
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$,
313315
\[ \text{CategoricalLogitGLM}(y~|~x,\alpha,\beta) = \\[5pt]
314-
\prod_{1\leq i \leq M}\text{CategoricalLogit}(y_i~|~\alpha+\beta_i\cdot x_i) = \\[15pt]
315-
\prod_{1\leq i \leq M}\text{Categorical}(y_i~|~softmax(\alpha+\beta_i\cdot x_i)). \]
316+
\prod_{1\leq i \leq M}\text{CategoricalLogit}(y_i~|~\alpha+x_i\cdot\beta) = \\[15pt]
317+
\prod_{1\leq i \leq M}\text{Categorical}(y_i~|~softmax(\alpha+x_i\cdot\beta)). \]
316318
See section [softmax](#softmax) for the definition of the softmax function.
317319

318320
### Sampling Statement
@@ -333,7 +335,7 @@ dropping constant additive terms.
333335
`real` **`categorical_logit_glm_lpmf`**`(int y | row_vector x, vector alpha, matrix beta)`<br>\newline
334336
The log categorical probability mass function with outcome `y` in
335337
$1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`.
336-
The size of independant variable row vector `x` needs to match the number of rows of the
338+
The size of independent variable row vector `x` needs to match the number of rows of the
337339
weight matrix `beta`. The size of intercept vector `alpha` must match number
338340
of columns of the weight matrix `beta`.
339341

@@ -344,7 +346,7 @@ of columns of the weight matrix `beta`.
344346
The log categorical probability mass function with outcomes `y` in
345347
$1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`.
346348
Same vector of intercepts `alpha` and same dependant variable value `y` are used for all instances.
347-
The number of columns of independant variable `x` needs to match the number of rows of the
349+
The number of columns of independent variable `x` needs to match the number of rows of the
348350
weight matrix `beta`. The size of intercept vector `alpha` must match number
349351
of columns of the weight matrix `beta`. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
350352

@@ -354,8 +356,8 @@ of columns of the weight matrix `beta`. If `x` and `y` are data (not parameters)
354356
`real` **`categorical_logit_glm_lpmf`**`(int[] y | row_vector x, vector alpha, matrix beta)`<br>\newline
355357
The log categorical probability mass function with outcomes `y` in
356358
$1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`.
357-
Same vector of intercepts `alpha` and same row vector of independant variables `x` are used for all instances.
358-
The size of independant variable matrix `x` needs to match the number of rows of the
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
359361
weight vector `beta`. The size of intercept vector `alpha` must match number
360362
of columns of the weight vector `beta`.
361363

@@ -368,7 +370,7 @@ $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`.
368370
Same vector of intercepts `alpha` is used for all instances.
369371
The number of rows of the independent variable
370372
matrix `x` needs to match the length of the dependent variable vector
371-
`y`. The number of columns of independant variable `x` needs to match the number of rows of the
373+
`y`. The number of columns of independnt variable `x` needs to match the number of rows of the
372374
weight matrix `beta`. The size of intercept vector `alpha` must match number
373375
of columns of the weight matrix `beta`. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
374376

@@ -451,25 +453,25 @@ dropping constant additive terms.
451453

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

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

460462
`real` **`ordered_logistic_glm_lpmf`**`(int y | matrix x, vector beta, vector c)`<br>\newline
461463
The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c.
462-
Same value of independant variable `y` is used for all instances.
463-
The number of columns of independant variable row vector `x` needs to match the size of the weight vector `beta`.
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`.
464466
Cutpoints `c` must be ordered. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
465467

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

469471
`real` **`ordered_logistic_glm_lpmf`**`(int[] y | row_vector x, vector beta, vector c)`<br>\newline
470472
The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c.
471-
Same row vector of independant variables `x` is used for all instances.
472-
The size of independant variable row vector `x` needs to match the size of the weight vector `beta`.
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`.
473475
Cutpoints `c` must be ordered.
474476

475477
<!-- real; ordered_logistic_glm_lpmf; (int[] y | matrix x, vector beta, vector c); -->
@@ -479,7 +481,7 @@ Cutpoints `c` must be ordered.
479481
The log ordered logistic probability mass of y, given linear predictors
480482
`x * beta`, and cutpoints c.
481483
The number of rows of the independent variable matrix `x` needs to match the length of the dependent variable vector `y`.
482-
The number of columns of independant variable row vector `x` needs to match the size of the weight vector `beta`.
484+
The number of columns of independent variable row vector `x` needs to match the size of the weight vector `beta`.
483485
Cutpoints `c` must be ordered. If `x` and `y` are data (not parameters) this function can be executed on a GPU.
484486

485487

src/functions-reference/unbounded_continuous_distributions.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ dropping constant additive terms.
180180
\index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (real y \textbar\ matrix x, real alpha, vector beta, real sigma): real}|hyperpage}
181181

182182
`real` **`normal_id_glm_lpdf`**`(real y | matrix x, real alpha, vector beta, real sigma)`<br>\newline
183-
The log normal probability density of y given location `alpha+x*beta`
183+
The log normal probability density of y given location `alpha + x * beta`
184184
and scale `sigma`, where a constant intercept `alpha`, `sigma` and dependent variable value `y` are
185185
used for all observations. The number of columns of `x` needs to match
186186
the length of the weight vector `beta`.
@@ -190,7 +190,7 @@ If `x` and `y` are data (not parameters) this function can be executed on a GPU.
190190
\index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (real y \textbar\ matrix x, vector alpha, vector beta, real sigma): real}|hyperpage}
191191

192192
`real` **`normal_id_glm_lpdf`**`(real y | matrix x, vector alpha, vector beta, real sigma)`<br>\newline
193-
The log normal probability density of y given location `alpha+x*beta`
193+
The log normal probability density of y given location `alpha + x * beta`
194194
and scale `sigma`, where a constant `sigma` and dependent variable value`y` are used for all
195195
observations and an intercept `alpha` is used that is allowed to vary
196196
with the different observations. The number of rows of the independent
@@ -203,7 +203,7 @@ If `x` and `y` are data (not parameters) this function can be executed on a GPU.
203203
\index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (vector y \textbar\ row\_vector x, real alpha, vector beta, real sigma): real}|hyperpage}
204204

205205
`real` **`normal_id_glm_lpdf`**`(vector y | row_vector x, real alpha, vector beta, real sigma)`<br>\newline
206-
The log normal probability density of y given location `alpha+x*beta`
206+
The log normal probability density of y given location `alpha + x * beta`
207207
and scale `sigma`, where a constant intercept `alpha`, `sigma` and independent variable values `x` are
208208
used for all observations. The number of columns of `x` needs to match
209209
the length of the weight vector `beta`.
@@ -212,7 +212,7 @@ the length of the weight vector `beta`.
212212
\index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (vector y \textbar\ row\_vector x, vector alpha, vector beta, real sigma): real}|hyperpage}
213213

214214
`real` **`normal_id_glm_lpdf`**`(vector y | row_vector x, vector alpha, vector beta, real sigma)`<br>\newline
215-
The log normal probability density of y given location `alpha+x*beta`
215+
The log normal probability density of y given location `alpha + x * beta`
216216
and scale `sigma`, where a constant `sigma` and independent variable values `x` are used for all
217217
observations and an intercept `alpha` is used that is allowed to vary
218218
with the different observations. The length of the dependent
@@ -223,7 +223,7 @@ the length of the weight vector `beta`.
223223
\index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (vector y \textbar\ matrix x, real alpha, vector beta, real sigma): real}|hyperpage}
224224

225225
`real` **`normal_id_glm_lpdf`**`(vector y | matrix x, real alpha, vector beta, real sigma)`<br>\newline
226-
The log normal probability density of y given location `alpha+x*beta`
226+
The log normal probability density of y given location `alpha + x * beta`
227227
and scale `sigma`, where a constant intercept `alpha` and `sigma` is
228228
used for all observations. The number of rows of the independent
229229
variable matrix `x` needs to match the length of the dependent
@@ -235,7 +235,7 @@ If `x` and `y` are data (not parameters) this function can be executed on a GPU.
235235
\index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (vector y \textbar\ matrix x, vector alpha, vector beta, real sigma): real}|hyperpage}
236236

237237
`real` **`normal_id_glm_lpdf`**`(vector y | matrix x, vector alpha, vector beta, real sigma)`<br>\newline
238-
The log normal probability density of y given location `alpha+x*beta`
238+
The log normal probability density of y given location `alpha + x * beta`
239239
and scale `sigma`, where a constant `sigma` is used for all
240240
observations and an intercept `alpha` is used that is allowed to vary
241241
with the different observations. The number of rows of the independent

0 commit comments

Comments
 (0)