Recently Published
Intro to notebook.
Basics.
Anthony-Games-Report-111024
Anthony-Games-Report-111024 for ConRR, MPhil PHS Cambridge
Dendrogram
Dendrogram is a tree-like diagram that shows the hierarchical structure of the clusters
library(dynamicTreeCut)
dist_matrix <- dist(merged_data[, -1]) # Assuming the first column is 'Region'
hclust_model <- hclust(dist_matrix, method = "ward.D2")
options(repr.plot.width = 16, repr.plot.height = 10)
plot(hclust_model, labels = merged_data$Region, main = "Hierarchical Clustering Dendrogram",
xlab = "Region", ylab = "Height", sub = "", cex = 0.4, las = 2)
rect.hclust(hclust_model, k = 5, border = "red")
dendro_colors <- cutreeDynamic(hclust_model, distM = as.matrix(dist_matrix), method = "tree")
plot(hclust_model, labels = merged_data$Region, main = "Hierarchical Clustering Dendrogram with Dynamic Cut",
xlab = "Region", ylab = "Height", sub = "", cex = 0.4, las = 2)
rect.hclust(hclust_model, k = 5, border = "red")
rpart
> library(rpart)
> library(rpart.plot)
>
> # Train decision tree model
> decision_tree <- rpart(Decision ~ AI_Capability_Index + Public_Sector_Innovation + Talent + Infrastructure + Government.Strategy,
+ data = merged_data, method = "class")
>
> # Plot the decision tree
> rpart.plot(decision_tree, type = 3, extra = 104, fallen.leaves = TRUE, main = "Geopolitical Decisions")
tree 1 test
This is a test for our classification tree
BoxPlot
ggplot(merged_data, aes(x = Political.regime, y = AI_Capability_Index)) +
geom_boxplot() +
theme_minimal()
Compare the distribution of AI_Capability_Index across different Political.regime categories.
AI cap and Infra
library(ggplot2)
ggplot(merged_data, aes(x = Infrastructure, y = AI_Capability_Index)) +
geom_point() +
geom_smooth(method = "lm") +
theme_minimal()