Non-parametric discriminant analysis in R I want to use Discriminant Analysis between two non normal populations in R. Can anybody tell me the name of the R function to do so?
Could also anybody tell me how accurate my results will be if I violate the normality assumption?
 A: There are several nonparametric methods for discriminant analysis: rank methods, classifiers based on robust estimators of location and scale (M-estimators or MCD-estimators, for instance), and so on. Have you decided what kind of method that you want to use?
As for the impact of non-normality on LDA and QDA, I'd recommend that you have a look at the following paper:
Lachenbruch, P. A., Sneeringer, C., and Revo, L. T. (1973). Robustness of the linear and quadratic discriminant function to certain types of non-normality, Comm. Statist., 1(1):39–56.
A: You can use the distance discriminant rule which is described in this pdf. It doesn't require normality and the equity of covariance matrices. Also, you can use this code if you want to:
1)You should create a column in your data which will indicate in which group your cases truly belong to:
data$group_star = NA
(I chose the name group_star in order not to have any trouble because in R the word group is used a lot. You can pick any name you want)
2)You should put values in the column group_star so that you know in which group every case belongs to
3)You want to find the mean vectors and the covariance matrices of all groups. In order to do this, I will create a list with all the mean vectors and another list with all the covariance matrices
list_of_means = list()

for (i in 1:length(unique(data$group_star))) {

  data_sub = data[data$group_star == i,]

  list_of_means[[i]] = colMeans(data_sub[,-1])

  #we want the means of the columns expect of the column group_star
  #which is last column

}

list_of_cov_matrices = list()

for (i in 1:length(unique(data$group_star))) {

  data_sub = data[data$group_star == i,]

  list_of_cov_matrices[[i]] = cov(data_sub[,-1])

  #we want the covariance matrix of data without the variable
  #group_star
}

As you can see in the distance discriminat rule (which is in the link I mentioned) uses the inverse matrix of a covariance matrix. So in order to be able to do this, every single covariance matrix you have computed shouldn't be singular (det = 0). If you found that there is a singular convariance matrix follow the steps from this link.
If you decide to remove a variable then you should compute the list_of_means and the list_of_cov_matrices again.
If you want to check that there isn't any singular covariance matrix write this code
for (i in 1:length(list_of_cov_matrices)) {
  
  solve(matrix(unlist(list_of_cov_matrices[i]), ncol = ncol(data)-1, byrow = TRUE))
  
}

In the ncol argument you put the number of variables in your dataset. Watch out if you remove a variable because it causes multicollinearity you shouldn't put this value. If there is multicollinearity in your dataset you should put ncol(data) - (the number of variables you removed) - 1.
3)Now you have made all the preparation for the Discriminan Analysis. You should create a column in which the output of discriminant analysis will be displayed.
data$discr_group = NA

4)Now you can use this code to perform the Discriminant Analysis based on the distance discriminat rule
for (i in 1:nrow(data)) {# i holds the number of every case
  
  #w holds the i-th observation
  
  w = as.numeric(data[i,-c(ncol(data),ncol(data)-1]) #we don't want the columns group_star and discr_group
  
  #We assume that the first group is more close to w
  
  g = 1 #g holds the number of group which is closer to w

  #We calculate the distance of the observation from the first group
  #based on the distance discriminant rule
  
  min1 = t((w - unlist(list_of_means[1])))%*%solve(matrix(unlist(list_of_cov_matrices[1]), ncol = ncol(data)-1, byrow = TRUE))%*%(w - unlist(list_of_means[1]))

  #In ncol argument you put the same value third chuck of code (solve       
  #blah blah)
  
  #So let's see if there is a smaller distance
  
  for (j in 2:length(unique(data$group_star))) {#j holds the number of group from which we calculate the distance
    
    if (t((w - unlist(list_of_means[j])))%*%solve(matrix(unlist(list_of_cov_matrices[j]), ncol = ncol(data)-1, byrow = TRUE))%*%(w - unlist(list_of_means[j]))< min1){

      #So if you find a smaller distance
      
      g = j #change the group
      
      min1 = t((w - unlist(list_of_means[j])))%*%solve(matrix(unlist(list_of_cov_matrices[j]), ncol = ncol(data)-1, byrow = TRUE))%*%(w - unlist(list_of_means[j]))

      #In ncol argument you put the same value third chuck of code (solve       
      #blah blah)
      
      #we did this in order to check in the upcoming irritation if there
      #is a group which is closer to the current group
    }
    
  }

  #Now we can put values in the group that was predicted from the method
  #we used in the discr_group column
  
  data$discr_group[i] = g


 }

Now you can check the accuracy of this method with this code
(sum(data$group_star == data$discr_group)/nrow(data))*100 #It is a percentage

Also you can see how many observations are in every group based on the method you applied
table(data$discr_group)

