Hi, I am using cross recurrence quantification analysis (CRQA) to analysis NBA players as dynamic system. For example, Close defense distance(CLOSE_DEF_DIST) is analyzed as a time series. I use to a loop to analysis all the players. Due to the fact that some players' close defense distance time series are problematic, so that I couldn't run it. I want to detect these problematic time series and remove them in my code. But the problem is that I dont know how to write such code to return these abnormal time series and remove them. I am wondering if someone can help me out with it.
Cheers,
Yanwei
This is my code and with the warning message:
list <- unique(nba_project$player_id)
for (j in 1: length(list)){
case <- list[j]
subdata <- subset(nba_project, player_id == case)
optimp <- optimizeParam(ts1 = subdata$CLOSE_DEF_DIST, ts2 = subdata$CLOSE_DEF_DIST,
par = list(lgM = 20, radiusspan = 100, radiussample = 40,
normalize = 0, rescale = 0, mindiagline = 2,
minvertline = 2, tw = 0, whiteline = FALSE,
recpt = FALSE, fnnpercent = 10, typeami = "mindip"),
min.rec = 2, max.rec = 5)
cradd <- crqa(ts1 = subdata$CLOSE_DEF_DIST, ts2 = subdata$CLOSE_DEF_DIST,
delay = optimp$delay, embed = optimp$emddim, radius = optimp$radius,
normalize = 0, rescale = 0,
mindiagline = 2,
minvertline = 2, tw = 0, whiteline = FALSE,
recpt = FALSE, side = "both")
if(j==1){
table <-as.data.frame(c(cradd$RR, cradd$DET, cradd$ENTR,
cradd$LAM, cradd$TT))
} else {
new.player <- as.data.frame(c(cradd$RR, cradd$DET, cradd$ENTR,
cradd$LAM, cradd$TT))
table<- rbind(table, new.player)
}
}
**warnings:**
Error in optimizeParam(ts1 = subdata$CLOSE_DEF_DIST, ts2 = subdata$CLOSE_DEF_DIST, :
(converted from warning) Optimal Radius Not found: try again choosing a wider radius span and larger sample size