I need to look to see how others have addressed this... maybe even an R package has a function to handle this already.
The problem is that we need to think about whether, after subsetting to common subjects and removing subjects with missing phenotypes or covariates, the resulting covariates matrix's columns are linearly independent. If they have "full rank", then we're ok... but, if rank is less than the number of columns in the covariates matrix, how to proceed? For example, we can't merely drop an arbitrary column, since a column could have, for example, all zeros. But, if we rule out this case, that a matrix column is all zeros, then maybe we can just drop one column if the rank is only one less than the number of columns. I need to review my matrix algebra - if 4 vectors form a matrix that has rank 3, is it true that any 3 of them (again, assuming none is the zero vector) together have rank 3? No! We also need to consider the possibility that two columns are "parallel". In a more general setting, we need to check the rank of the subsets of columns. Since, for example, a three vectors could all be coplanar, while no two would be parallel. I am sure that others have written code to solve this. Can I find their code?
I need to look to see how others have addressed this... maybe even an R package has a function to handle this already.
The problem is that we need to think about whether, after subsetting to common subjects and removing subjects with missing phenotypes or covariates, the resulting covariates matrix's columns are linearly independent. If they have "full rank", then we're ok... but, if rank is less than the number of columns in the covariates matrix, how to proceed? For example, we can't merely drop an arbitrary column, since a column could have, for example, all zeros. But, if we rule out this case, that a matrix column is all zeros, then maybe we can just drop one column if the rank is only one less than the number of columns. I need to review my matrix algebra - if 4 vectors form a matrix that has rank 3, is it true that any 3 of them (again, assuming none is the zero vector) together have rank 3? No! We also need to consider the possibility that two columns are "parallel". In a more general setting, we need to check the rank of the subsets of columns. Since, for example, a three vectors could all be coplanar, while no two would be parallel. I am sure that others have written code to solve this. Can I find their code?