idbrms_stan_chunk.Rd
Read in a idbrms Stan code chunk
idbrms_stan_chunk(path)
path | The path within the "stan" folder of the installed idbrms package to the stan code chunk of interest. |
---|
A character string containing the stan code chunk of interest.
idbrms_stan_chunk("functions/idbrms_convolve.stan")
#> [1] "vector idbrms_convolve(int[] primary, vector scale, vector cmean,\n vector lcsd, int[] cmax, int[] index, int[] cstart,\n int[] init) {\n int n = num_elements(scale);\n vector[n] p = to_vector(primary);\n vector[n] ils = inv_logit(scale);\n vector[n] csd = exp(lcsd);\n vector[n] cs;\n int mcmax = max(cmax);\n vector[mcmax] pmf[n];\n \n pmf = calc_unique_pmfs(cmean, csd, mcmax);\n for (i in 1:n) {\n real cp = 1e-5;\n cp += dot_product(p[cstart[i]:index[i]], tail(pmf[i], cmax[i]));\n cs[i] = cp * ils[i];\n }\n return(cs);\n }"