[R] Determine most rows in a matrix

djkrofch krofcheck at gmail.com
Sat Dec 1 04:29:02 CET 2012


Greetings

I have a set of coefficients that describe a model. The coefficients are
generated via a loop for multiple days throughout the year. A sample of the
data is below:

 Day     Amax       Alpha           Rd
 [1,] 154 6.561734 0.002099071 -0.143377888
 [2,] 156 6.100190 0.002326559 -0.058174891
 [3,] 151 4.592227 0.002554909 -0.200132722
 [4,] 152 4.893429 0.002636529 -0.128636568
 [5,] 173 4.274289 0.002719069 -0.007346254
 [6,] 169 5.784917 0.002751405  0.015649452
 [7,] 168 3.484089 0.003423258  0.011657278
 [8,] 164 5.375647 0.004127243  0.130097879
 [9,] 172 3.452985 0.004215742 -0.017892225

I want to collect only the 5 most similar rows. I have tried sorting by a
column and creating a 5 day moving average window to find the 5 values with
the lowest variance, but that obviously does not minimize the variance for
the other 2 columns. One idea I was working with was to generate modeled
data for all of the rows of coefficients, and find the 5 rows of
coefficients that produced the smallest variance in the model output?

Not sure how to go about this, its been giving me a headache! I would
greatly appreciate a push in the right direction.

Best,
Dan




--
View this message in context: http://r.789695.n4.nabble.com/Determine-most-rows-in-a-matrix-tp4651528.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list