I have a dataset that has daily data about Covid19 for many countries. I want to group them in such a way that the first country has the number one, the second country has the number two and so on. For this I have wrote the below code:
list_of_countries = unique(final_dataset$location) #the number of countries in the dataset is 145
final_dataset$group = NA
for(i in 1:length(list_of_countries)){
country = list_of_countries[i]
start = 1
while (final_dataset$location[start]!= country) {
start = start + 1
}
while (final_dataset$location[start] == country & start<=nrow(final_dataset)) {
final_dataset$group[start] = i
start = start + 1
}
}
I have done this successfully. Now, I want to check if the covariance matrices which correspond to the countries of the dataset are statistically equal.In other words, I want to check if the 145 covariance matrices are equal. I have found the covmtest() function in order to do this. So I wrote the below code:
covmtest(x = as.matrix(final_dataset[, 5:20]), ina = as.matrix(final_dataset[, 21]), a = 0.05)
and I got the below output:
M.test p-value df critical
NaN NaN 19584.00 19910.66
I don't know why the p-value is NaN. I have searched a lot and I haven't found the solution yet. Does anyone know how to solve this error?