-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make cases prediction optional, switch markdown to use function, impr…
…ove guidance
- Loading branch information
1 parent
c83b400
commit f7cd64f
Showing
7 changed files
with
62 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
```{asis, echo = {{pred_knit}}, eval = {{pred_knit}}, include = {{pred_knit}}} | ||
Generate predictions from the model | ||
Generate predictions from the model and plot the generated rasters | ||
``` | ||
|
||
```{r, echo = {{pred_knit}}, include = {{pred_knit}}} | ||
prediction <- disaggregation::predict_model(fitted_model, predict_iid = {{pred_iid}}) | ||
plot(prediction$prediction) | ||
prediction$cases <- prediction$prediction * aggregation_prepared | ||
plot(prediction$cases) | ||
prediction <- disagapp::pred_pred(fitted_model, | ||
aggregation_prepared, | ||
cases = {{pred_cases}}, | ||
predict_iid = {{pred_iid}}, | ||
uncertain = {{pred_uncertain}}, | ||
N = {{pred_uncertain_n}}, | ||
CI = {{pred_uncertain_ci}}) | ||
plot(prediction$`prediction (rate)`) | ||
if (!is.null(prediction$`prediction (cases)`)){ | ||
plot(prediction$`prediction (cases)`) | ||
} | ||
if (!is.null(prediction$field)){ | ||
terra::crs(prediction$field) <- terra::crs(prepared_data$covariate_rasters[[1]]) | ||
prediction$field <- terra::mask(prediction$field, prepared_data$covariate_rasters[[1]]) | ||
plot(prediction$field) | ||
} | ||
if (!is.null(prediction$iid)){ | ||
plot(prediction$iid) | ||
} | ||
``` | ||
|
||
```{r, echo = {{pred_uncertain_knit}}, include = {{pred_uncertain_knit}}} | ||
uncertainty <- disaggregation::predict_uncertainty(fitted_model, predict_iid = {{pred_iid}}, N = {{pred_uncertain_n}}, CI = {{pred_uncertain_ci}}) | ||
if (!is.null(prediction$uncertainty)){ | ||
plot(uncertainty$predictions_ci$`lower CI`) | ||
plot(uncertainty$predictions_ci$`upper CI`) | ||
} | ||
plot(uncertainty$predictions_ci$`lower CI`) | ||
plot(uncertainty$predictions_ci$`upper CI`) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters