Skip to content

Commit

Permalink
use smaller quad cost factor
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Dec 11, 2015
1 parent dd7cccf commit ce252a2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
18 changes: 14 additions & 4 deletions inst/notebook/robustness.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ fig3 <- function(cost, dr, noise){
measure = c(g = 0.1, m = 0.5, i = 0.1),
implement = c(g = 0.1, m = 0.1, i = 0.5)),
function(s)
multiple_uncertainty(f = logistic, x_grid = grid, sigma_g = s[["g"]], sigma_m = s[["m"]], sigma_i = s[["i"]], noise_dist = noise, profit_fn = profit),
multiple_uncertainty(f = logistic, x_grid = grid, sigma_g = s[["g"]], sigma_m = s[["m"]], sigma_i = s[["i"]], noise_dist = as.character(noise), profit_fn = profit),
mc.cores = parallel::detectCores())
df <- data.frame(y_grid = grid, small = o$small, growth = o$growth,
Expand All @@ -281,11 +281,10 @@ fig3 <- function(cost, dr, noise){
expand.grid(cost = c(0, 0.02, 0.2),
dr = c(0, 0.1),
dr = c(0, 0.01),
noise = c("uniform", "lognormal")) %>%
dplyr::group_by(cost, dr, noise) %>%
dplyr::do(fig3(.$cost, .$dr, .$noise)) -> df
```

```{r}
Expand All @@ -297,9 +296,20 @@ df %>%
xlab("Stock") +
ylab("Escapement") +
coord_cartesian(xlim = c(0, 150), ylim = c(0,100)) +
theme_bw()
theme_bw() + ggtitle("Uniform Noise")
```

```{r}
df %>%
dplyr::filter(noise == "lognormal") %>%
ggplot(aes(x = y_grid, y = value, col = scenario)) +
geom_line() +
facet_grid(cost ~ dr) +
xlab("Stock") +
ylab("Escapement") +
coord_cartesian(xlim = c(0, 150), ylim = c(0,100)) +
theme_bw() + ggtitle("Lognormal Noise")
```



Expand Down
22 changes: 18 additions & 4 deletions inst/notebook/robustness.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ fig3 <- function(cost, dr, noise){
measure = c(g = 0.1, m = 0.5, i = 0.1),
implement = c(g = 0.1, m = 0.1, i = 0.5)),
function(s)
multiple_uncertainty(f = logistic, x_grid = grid, sigma_g = s[["g"]], sigma_m = s[["m"]], sigma_i = s[["i"]], noise_dist = noise, profit_fn = profit),
multiple_uncertainty(f = logistic, x_grid = grid, sigma_g = s[["g"]], sigma_m = s[["m"]], sigma_i = s[["i"]], noise_dist = as.character(noise), profit_fn = profit),
mc.cores = parallel::detectCores())

df <- data.frame(y_grid = grid, small = o$small, growth = o$growth,
Expand All @@ -313,7 +313,7 @@ fig3 <- function(cost, dr, noise){


expand.grid(cost = c(0, 0.02, 0.2),
dr = c(0, 0.1),
dr = c(0, 0.01),
noise = c("uniform", "lognormal")) %>%
dplyr::group_by(cost, dr, noise) %>%
dplyr::do(fig3(.$cost, .$dr, .$noise)) -> df
Expand All @@ -328,11 +328,25 @@ df %>%
xlab("Stock") +
ylab("Escapement") +
coord_cartesian(xlim = c(0, 150), ylim = c(0,100)) +
theme_bw()
theme_bw() + ggtitle("Uniform Noise")
```

![](robustness_files/figure-markdown_github/unnamed-chunk-18-1.png)

``` r
df %>%
dplyr::filter(noise == "lognormal") %>%
ggplot(aes(x = y_grid, y = value, col = scenario)) +
geom_line() +
facet_grid(cost ~ dr) +
xlab("Stock") +
ylab("Escapement") +
coord_cartesian(xlim = c(0, 150), ylim = c(0,100)) +
theme_bw() + ggtitle("Lognormal Noise")
```

![](robustness_files/figure-markdown_github/unnamed-chunk-19-1.png)

Varying the assumption on inverse probability calculation (uniform noise only)
------------------------------------------------------------------------------

Expand Down Expand Up @@ -367,6 +381,6 @@ ggplot(df, aes(x = x, y = f, color = model)) +
facet_grid(model ~ r)
```

![](robustness_files/figure-markdown_github/unnamed-chunk-20-1.png)
![](robustness_files/figure-markdown_github/unnamed-chunk-21-1.png)

Recall or observe that the parameter `r` does not change the carrying capacity of the Logistic, Ricker or Allen models, but does for the Beverton-Holt and Gompertz model. This makes it difficult to directly consider how
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ce252a2

Please sign in to comment.