Commit cd36771
Fix sample_predictive_stan: transform mu_par from log scale, compute mu_logy directly
- Fixed mu_par extraction: parameters are on transformed (log) scale, not natural scale
- Transform to natural scale: y0=exp(log_y0), y1=y0+exp(log_y1_minus_y0), etc.
- Compute mu_logy directly using Stan model formula (not log(ab(...)))
- Active period: mu_logy = log(y0) + beta * t
- Recovery period: mu_logy = (1/(1-shape)) * log(y1^(1-shape) - (1-shape)*alpha*(t-t1))
- Added pmax() guards to prevent NaN from log of negative numbers
- Extracted one_minus_shape variable to avoid redundant computation
- Added guard for y1_pop/y0_pop ratio in beta calculation
- All 63 tests pass (0 errors, 0 warnings)
- R CMD check passes (0 errors, 0 warnings, 0 notes)
- Linting clean
Agent-Logs-Url: https://github.com/ucdavis/serodynamics/sessions/9cacf023-700e-44a7-b62f-bef80aedb162
Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>1 parent 3db4454 commit cd36771
2 files changed
Lines changed: 51 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
152 | 150 | | |
153 | 151 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
| |||
166 | 178 | | |
167 | 179 | | |
168 | 180 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
177 | 196 | | |
178 | 197 | | |
179 | | - | |
| 198 | + | |
180 | 199 | | |
181 | 200 | | |
182 | 201 | | |
| |||
0 commit comments