epinowcast
|
Go to the source code of this file.
Functions | |
vector | combine_effects (array[] real intercept, vector beta, matrix design, vector beta_sd, matrix sd_design, int add_intercept) |
vector combine_effects | ( | array[]real | intercept, |
vector | beta, | ||
matrix | design, | ||
vector | beta_sd, | ||
matrix | sd_design, | ||
int | add_intercept | ||
) |
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. |
design | Design matrix mapping observations (rows) to effects (columns). |
beta_sd | Vector of standard deviations for scaling and pooling effects. |
sd_design | Design matrix relating effect sizes to standard deviations. The first column indicates no scaling for independent effects. |
add_intercept | Binary flag to indicate if the intercept should be added to the beta vector. |
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 46 of file combine_effects.stan.