Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hafen/seriesclust
https://github.com/hafen/seriesclust
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hafen/seriesclust
- Owner: hafen
- License: other
- Created: 2017-04-14T16:51:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-25T06:14:34.000Z (over 7 years ago)
- Last Synced: 2024-05-21T02:54:30.244Z (4 months ago)
- Language: R
- Size: 163 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# seriesclust
A few simple tools to cluster series of data and investigate the cluster results with respect to cluster membership across other variables in the data.
## Installation
You can install seriesclust from github with:
```r
# install.packages("devtools")
devtools::install_github("hafen/seriesclust")
```## Example
```r
library(seriesclust)
library(dplyr)# scale the monthly median close price so that we are clustering on general shape
d <- nasd16 %>%
group_by(symbol) %>%
mutate(close_scl = as.numeric(scale(med_close))) %>%
select(-company, -med_close)set.seed(1234)
# k-means clustering with 2, 5, and 9 clusters
km <- get_kmeans(d, x = "month", y = "close_scl", k = c(2, 5, 9))
plot_scree(km)
plot_clust(km, 9)
plot_heat(km, 9, col = "sector")
plot_heat(km, 9, col = "industry", cutoff = 10)
```