1

I am currently translating some MATLAB scripts to R for Multivariate Data Analysis. Currently I am trying to generate the same data as the Coeffs.Linear and Coeffs.Const part of the fitdiscr function in MATLAB. The code being used is:

fitcdiscr(data, groups, 'DiscrimType', 'linear'); 

The data consists of 3 groups.

Unfortunately the R function seems to do the LDA only for two LDs and MATLAB seems to always compare all groups in all constellations. Does anybody have an idea how I could obtain that data?

1 Answers1

0

I suspect you mean information on the implementation of various MATLAB function, which would be doc <functionname> (doc fitcdiscr would yield this documentation page on fitcdscr) to get the documentation, and edit <functionname> to get the implementation, if it is not obscured by The MathWorks. If those two do not give you enough information, I'm afraid you're out of luck, since not all TMW codes are available non-obscured.

fitcdiscr is non-obscured, although very brief; it's just a wrapper for some other functions. Keep doing edit <functionname> and doc <functionname> and see how deep the rabbit hole takes you.


NB: there's no built-in function called fitdiscr, but the syntax you describe is that of fitcdiscr (note the c), so I used that as examples. If the actual function being called is named fitdiscr, it's custom-made and you'll have to spit through its file by edit fitdiscr and hope for the best.

Adriaan
  • 17,741
  • 7
  • 42
  • 75
  • Forgot to mention it, I already looked through what the Matlab page says. Also looked into output where it says that Coeffs is the coefficient of the linear boundaries between classes i and j. For linear and Const it only gives information about what they are. Linear is a vector with p componenents where p is the number of columns in x and Const simply is a scalar. Thanks anyway though :) Will see if a book I bought can help me find a solution or let me write one myself. – MiraculicKz May 15 '19 at 14:28
  • Update: In Matlab what I get in linear is the classification borders. These I would also find in the partimat() function in R. Problem: The partimat function just plots, but gives no output. Will be seeing if I can adapt it, so I get the values I need instead of the plot. – MiraculicKz May 17 '19 at 16:33