Description Usage Arguments Value Author(s) References Examples
Function to cluster mouse trajectory using hierarchical cluster analysis or distance to given prototypical trajectories
1 2 |
data |
A dataframe with x,y values of time-normalizes trajectories (all trajectories have the same length) and id variable(s). |
i.xyt |
Vector containing the column names of the x, y, t variables in that order. |
i.id |
Vector containing the column names of the indicator variables that uniquely identify single trajectories (e.g. c('experiment1', 'trial')). |
type |
|
nclust |
The number of clusters that should be extracted in the hierarchical clustering method |
nResc |
Before calculating the distance matrix, all trajectories are spatially normalized, i.e. we distribute |
prototypes |
A list containing prototypical trajectories, to which the method |
subsampN |
Takes a random subsample from the original data and performs the clustering analysis on this subsample. This is useful for datasets with a large number of trajectories, which could render hierarchical clustering computationally infeasible. |
Returns a list containing:
call |
The function input except the data. |
data_res |
A data frame containing the spatially normalized data. |
hierarchical |
The results of the hierarchical cluster analysis. |
prototypes |
Contains the results of the prototype classification. |
Jonas Haslbeck <jonashaslbeck@gmail.com>
Spivey, M. J., Grosjean, M., & Knoblich, G. (2005). Continuous attraction toward phonological competitors. Proceedings of the National Academy of Sciences of the United States of America, 102(29), 10393-10398.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ## Not run:
# THIS EXAMPLE DOES NOT RUN ANYMORE
# we use a part of the following example dataset
head(data_sp2015)
# we use prepr() to time normalize all trajectories to 101 time-steps and strech them to a norm display
layout_stretch <- list("start"=c(0,0), "left"=c(-1,1.5), "right"=c(1,1.5))
output <- prepr(data = data_sp2015[1:1000,],
i.xyt = c('x', 'y', 't'),
i.id = c('id.ptp', 'id.trial'),
type = "time",
steps = 101,
start2zero = TRUE,
stretch = layout_stretch)
head(output$data)
# clustering; prototypes from example datasets "prototypes"
out_clust <- trajcluster(output$data,
i.xyt = c('x', 'y', 't'),
i.id = c('id.ptp', 'id.trial'),
type=c("hierarchical", "prototypes"),
nclust = 4,
nResc = 10,
prototypes = prototypes,
subsampN = NA)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.