Skip to content

Commit

Permalink
average license holdings
Browse files Browse the repository at this point in the history
  • Loading branch information
carlylovas committed Jan 22, 2024
1 parent 1969e2d commit e61f610
Show file tree
Hide file tree
Showing 2 changed files with 562 additions and 78 deletions.
593 changes: 523 additions & 70 deletions R/license_networks.html

Large diffs are not rendered by default.

47 changes: 39 additions & 8 deletions R/license_networks.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ license_types %>%
filter(!(str_starts(license_type, "mi"))) %>%
filter(!(str_starts(license_type, "nb"))) %>%
filter(!(str_starts(license_type, "p"))) %>%
filter(!license_type %in% c("st", "sts", "csw", "csws", "mws")) %>%
filter(!license_type %in% c("st", "sts", "csw", "csws", "mws", "mw")) %>%
drop_na() -> license_types # the one NA here is sut
license_types %>%
Expand All @@ -72,7 +72,8 @@ license_types %>%
```

## Licenses Issued
## Licenses Issued

Below are two plots depicting the total number of licenses issued per year and the number of unique license types issued per year

```{r}
Expand All @@ -86,23 +87,22 @@ Below are two plots depicting the total number of licenses issued per year and t
ind_lic_portfolio %>%
select(license_year, license_types$license_type) %>%
pivot_longer(cols = 2:55, names_to = "license_type", values_to = "count") %>%
pivot_longer(cols = 2:56, names_to = "license_type", values_to = "count") %>%
left_join(license_types) %>%
group_by(license_year) %>%
summarise(total = sum(count)) -> total_licenses
ggplot(data = total_licenses)+
geom_line(aes(x = license_year, y = total)) +
ggtitle("Total Licenses Issued") +
xlab("Total") + ylab("Year") +
ylab("Total") + xlab("Year") +
ylim(c(10000,20000)) +
theme_gmri(plot.title = element_text(size = 8),
axis.text = element_text(size = 8),
axis.title = element_text(size = 8))
```


```{r}
#| label: unique license types each year
#| echo: false
Expand All @@ -114,7 +114,7 @@ ggplot(data = total_licenses)+
ind_lic_portfolio %>%
select(license_year, license_types$license_type) %>%
pivot_longer(cols = 2:55, names_to = "license_type", values_to = "count") %>%
pivot_longer(cols = 2:56, names_to = "license_type", values_to = "count") %>%
filter(!count == 0) %>%
select(license_year, license_type) %>%
distinct() %>%
Expand Down Expand Up @@ -169,7 +169,38 @@ license_time_series %>%
gridExtra::marrangeGrob(license_time_series$time_series, layout_matrix = matrix(1:12, ncol = 3, nrow = 4, byrow = TRUE), top = NULL, left = textGrob(
expression(bold("Total Annual")), rot = 90, gp = gpar(col = "black", fontsize = 8)))
```

## Average license holdings
Below are the summary statisitcs of the average number of licenses held by an individual per year.
```{r}
#| label: average license holdings
#| echo: false
#| message: false
#| warning: false
#| column: page
#| fig-width: 7
#| fig-height: 5
ind_lic_portfolio %>%
select(license_year, license_types$license_type, landings_number) %>%
pivot_longer(cols = 2:56, names_to = "license_type", values_to = "count") %>%
left_join(license_types) %>%
group_by(license_year, landings_number) %>%
summarise(total = sum(count)) %>%
drop_na() -> average_licenses
# summary(lm(total ~ license_year, data = average_licenses))
gt(broom::glance(lm(total ~ license_year, data = average_licenses)))
average_licenses %>%
ggplot() +
stat_smooth(aes(x = license_year, y = total), method = "lm") +
ggtitle("Average number of licenses held per individual") +
theme_gmri(plot.title = element_text(size = 8),
axis.text = element_text(size = 6),
axis.title = element_blank())
```

## Annual License Network Metrics
Expand All @@ -182,6 +213,7 @@ Important nodes tend to have more connections to other nodes. Highly connected n
```{r}
#| label: annual metrics
#| echo: false
#| message: false
#| warning: false
#| column: page
#| fig-width: 9
Expand Down Expand Up @@ -237,8 +269,8 @@ degree_plots <- metrics_series %>%
gridExtra::marrangeGrob(degree_plots$time_series, layout_matrix = matrix(1:15, ncol = 3, nrow = 5, byrow= TRUE), top = NULL, left = textGrob(
expression(bold("Degree")), rot = 90, gp = gpar(col = "black", fontsize = 8)))
```
### Betweeness

### Betweeness
"\[*Betweenness*\] ranks the nodes based on the flow of connections through the network. Importance is demonstrated through high frequency of connection with multiple other nodes. Nodes with high levels of betweenness tend to serve as a bridge for multiple sets of other important nodes." [*Source*](https://bookdown.org/jdholster1/idsr/network-analysis.html#advanced-case-study)

```{r}
Expand Down Expand Up @@ -267,7 +299,6 @@ gridExtra::marrangeGrob(betweeness_plots$time_series, layout_matrix = matrix(1:1
expression(bold("Degree")), rot = 90, gp = gpar(col = "black", fontsize = 8)))
```


## Annual Network Plots

Density time series and network plots are available [here](https://carlylovas.github.io/mesg-permits/R/license_network_plots.html)
Expand Down

0 comments on commit e61f610

Please sign in to comment.