R Script Hierarchical K Means
This R script explores hierarchical and k-means clustering techniques. In Question 1, clustering
is applied to a small custom dataset, using both single-linkage hierarchical clustering and
k-means with varying cluster counts (k = 2, 3, 5). A dendrogram is plotted to visualize the
hierarchical clustering. In Question 2, clustering is applied to the Smarket dataset from the ISLR
package, focusing on lagged market returns and volume data. The script computes the distance
matrix, performs hierarchical clustering with a single linkage, and applies k-means clustering to
the training set with different values of k (2, 3, 5), demonstrating how clustering behaves with
financial market data.