otsegun / fdaoutlier

Outlier Detection Tools for Functional Data Analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning for large p provides Warning message: In qf(0.993, dimension, m - dimension + 1) : NaNs produced

aefdz opened this issue · comments

Hi Segun,

First things first, thank you for the great work!

I found that the aproximation of the degrees of freedom for large dimension provides values smaller than dimension+1. Then the quantile of the F distribution cannot be computed. Find attached an R code with a visualization of the problem.

To solve the issue, I modified the function croux_hesbroeck_asymptotic.R to use the asyntotic m value when this happends. I add the following at the end of the function assuming that for large p and n the asyntotic is a good estimator.

if(m >= dimension){
cutoff <- qf(0.993, dimension, m - dimension + 1)
}else{ #for large dimension and m, we assume that the m_asy is a good estimator
m <- m_asy
}

I will create a pull request.

#2 Fixed!