r - lm models over all possible pairwise combinations of the columns of two matrices -


I am working through a problem in R and got stuck. I searched on various help lists for help but I could not find anything - but if I remember something then I am sorry to have a dummy example of my problem below, I will continue to work on this, but any Help would be greatly appreciated.

Thank you in advance for your time.

I have the matrix of the response variable:

  p < -metrix (c (rnorm (120, 1), rnorm (120,1), rnorm (120,1)), 120,3)   

and two matrices of corporates:

  g < Metrics (C (Representative (1: 3, each = 40), Representative (3: 1, each = 40), Representative (1: 3, 40)), 120,3) M & lt; -matrix (c (rep (1: 2, 60), representative (2: 1, 60), representative (1: 2, each = 60)), 120,3)   

For all the combinations of the columns, I want to run these two models of protection matrix G and M:

  test & lt; - Function (uniq_m, uniq_g, p = p) {full & lt; - lm (p ~ factor ('f' = full, 'n' = null))}   

Then I tested for a conversation between column 1 of column and column 1 of G I want to, then column 2 of column 2 and column 1, then column column 2 and column 2 of 2 column ... and so on in all possible bilateral dialogue. The response variable is the same each time and the matrix containing more than one column.

So far, I can do this for a combination of columns:

  test_1 & lt; - Me (M [, 1], j [, 1], p)   

And I can also run a model on all columns of the meter and a column of G:

  test_2 & lt; - Apply (m, 2, function (uniq_m) {test (uniq_m, g [, 1], p = p)}) I can do so each response variable of each model Get the F data for:  
  sapply (summary (test_2 [[1]] $ f, function (x) x $ fstatistic) sapply (summary (test_2   

and I can compare the model using F-test for each response variable:

  D1 and LT-colsums (matrix (residual (test_2 [[1 ]] $ N), Enro (g), nxl (p)) 2) d2 and lt; - Col Summus (Matrix (Residual (Test 2 [2]] $ F, Enro (G), NXL (P)) ^ 2) F & LT; - ((D1-D2) / (D2/114) )   

My question is how do I run LM models on all combinations of columns from M and G matrix, and get EF-statistics?

However This is a dummy example, in the real analysis there will be a reaction matrix which is 700 x 8000, and the matrix will be 700 x 4000 and 700 x 100, so I need that thing Programming is as fast as possible.

Hope this helps, some of the code shared with me is my friend. It can not be what you want but you can set it in the right direction (although it is given after 9 months after you are asked, this can not be used exclusively for you!):

  #### This first function model improves the text size based on the force of correlation and fixes; - Function (X, Y, Issue = 2, Prefix = "", cex.cor, ... ..) {usr & lt; - par ("usr"); On. Ext. (Equivalent (USR)) equal (USR = C (0, 1, 0, 1)) R & LT; - Pet (Core (X, Y)) TSTT & lt; - Format (C (R, 0.12345678 9) Points = Points) [1] txt & lt; - paste0 (prefix, txt) if (missing (cex.cor)) cex.cor & lt; - 0.8 / strwidth (txt) text (0.5, 0.5, txt, cex = cex cor * r)} ##### This function diagonal panel hist and lt; - function (x, ...) {usr & lt; - Contains a histogram of your data on par ("usr"); On. EXT (equal to (USR)) equal (USR = C (USR [1: 2], 0, 1.5)) H & lt; - Hist (X, plot = FALSE) brakes & lt; - h $ brakes; NB & lt; - Length (punctuation) y   

Credit to all James Kitting

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -