epinowcast
|
Go to the source code of this file.
Functions | |
vector | combine_effects (array[] real intercept, vector beta, int nobs, int neffs, matrix fdesign, tuple(vector, array[] int, array[] int) sparse, vector beta_sd, matrix rdesign, int add_intercept, int sparse_design) |
vector combine_effects | ( | array[]real | intercept, |
vector | beta, | ||
int | nobs, | ||
int | neffs, | ||
matrix | fdesign, | ||
tuple(vector, array[] int, array[] int) | sparse, | ||
vector | beta_sd, | ||
matrix | rdesign, | ||
int | add_intercept, | ||
int | sparse_design | ||
) |
Combine nested regression effects using design matrices
This function combines nested regression effects based on a design matrix and applies effect pooling using a second design matrix. It allows for scaling of effects with specified standard deviations, enabling the pooling of these effects. The function can also incorporate an intercept into the linear predictions.
intercept | Array containing the regression intercept (length one). |
beta | Vector of regression effects, typically unit-scaled for possible rescaling with beta_sd. |
nobs | Integer the number of observations (i.e. design matrix columns). |
neffs | Integer the number of effects (i.e. the number of rows in the design matrix). |
fdesign | Dense matrix mapping observations (rows) to fixed effects (columns). |
beta_sd | Vector of standard deviations for scaling and pooling effects. |
rdesign | Dense matrix relating effect sizes to standard deviations. The first column indicates no scaling for independent effects. |
sparse | Sparse matrix components for fixed effects design matrix. The output from csr_extract(fdesign). |
add_intercept | Binary flag to indicate if the intercept should be added to the beta vector. |
sparse_design | Binary flag to indicate whether to use sparse or dense matrices. |
add_intercept
is true, the intercept is included in the linear predictions. The function handles cases with no effects by returning a vector of the intercept repeated for each observation.Definition at line 62 of file combine_effects.stan.