I'm trying to run a model in R, but it's far of a larger process where the input matrix isn't the same each time. There are occasions where I get an error to say that the matrix contains singular columns. How can I check which these are, and more importantly, how can I remove them prior to the modelling stage?

  • 2
    $\begingroup$ lm automatically identifies such columns. The problem is that they are not unique: there's no such thing as "a" singular column; all you can tell is whether various subsets of columns are linearly independent or not. You probably would prefer to ask the question addressed at stats.stackexchange.com/questions/173665. At stats.stackexchange.com/a/366993/919 I answer the question you have asked: namely, by showing how to find all such sets of columns. $\endgroup$
    – whuber
    Jul 27 '21 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.