Skip to content

Problem when creating matrix of values based on covariance matrix

10 messages · Bert Gunter, Boel Brynedal, Michael Dewey +3 more

#
Hi,

I want to simulate a data set with similar covariance structure as my
observed data, and have calculated a covariance matrix (dimensions
8368*8368). So far I've tried two approaches to simulating data:
rmvnorm from the mvtnorm package, and by using the Cholesky
decomposition (http://www.cerebralmastication.com/2010/09/cholesk-post-on-correlated-random-normal-generation/).
The problem is that the resulting covariance structure in my simulated
data is very different from the original supplied covariance vector.
Lets just look at some of the values:
X1          X2         X3         X4
X1 34515296.00    99956.69   369538.1  1749086.6
X2    99956.69 34515296.00  2145289.9  -624961.1
X3   369538.08  2145289.93 34515296.0  -163716.5
X4  1749086.62  -624961.09  -163716.5 34515296.0
[,1]         [,2]          [,3]         [,4]
[1,] 0.1873402987  0.001837229  0.0009009272  0.010324521
[2,] 0.0018372286  0.188665853  0.0124216535 -0.001755035
[3,] 0.0009009272  0.012421654  0.1867835412 -0.000142395
[4,] 0.0103245214 -0.001755035 -0.0001423950  0.192883488

So the distribution of the observed covariance is very narrow compared
to the simulated data.

None of the eigenvalues of the observed covariance matrix are
negative, and it appears to be a positive definite matrix. Here is
what I did to create the simulated data:

Chol <- chol(CEUcovar)
Z <- matrix(rnorm(20351 * 8368), 8368)
X <- t(Chol) %*% Z
sample8 <- data.frame(as.matrix(t(X)))
[1] 20351  8368
cov8=cov(sample8,method='spearman')

[earlier I've also tried sample8 <- rmvnorm(1000,
mean=rep(0,ncol(CEUcovar)), sigma=CEUcovar, method="eigen") with as
'bad' results, much larger covariance values in the simulated data ]

Any ideas of WHY the simulated data have such a different covariance?
Any experience with similar issues? Would be happy to supply the
covariance matrix if anyone wants to give it a try.
Any suggestions? Anything apparent that I left our or neglected?

Any advice would be highly appreciated.
Best,
Bo
#
Sampling error?   Do you realize how large a sample size you would
need to precisely estimate an 8000 x 8000 covariance matrix? Probably
exceeds the number of stars in our galaxy...

Numerical issues may also play a role, but I am too ignorant on this
aspect to offer advice.

Finally, this is really not an R question, so you would probably do
better to post on a stats site like stats.stackexchange.com rather
than here.

-- Bert
On Sat, Aug 11, 2012 at 7:17 AM, Boel Brynedal <brynedal at gmail.com> wrote:

  
    
#
Hi, thanks for the reply.
I am not assuming that the supplied covariance vector in any way
captures the 'true' covariance matrix of the population, but thats not
what I am after either. I just want to simulate data that has a
similar covariance as that covariance matrix. And the numbers are so
hugely different! Could sampling error cause that? Could the
covariance structure be too complicated to simulate?

And yes, I should probably post this on a stat-list, true.

Thanks,
Bo

2012/8/11 Bert Gunter <gunter.berton at gene.com>:
#
At 15:17 11/08/2012, Boel Brynedal wrote:
It is, of course, not guaranteed to be the same as you are only 
sampling from the distribution. In your example below you draw a 
sample of size 1000 from a 8368 variable distribution so I suspect it 
is almost sure to be different although I am surprised how different. 
What happens if you increase the sample size?
Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html
#
On Aug 11, 2012, at 16:17 , Boel Brynedal wrote:

            
There's your problem. I'm surprised that nobody seems to have picked up on this, but Spearman covariances are of the ranks, not of the data. Try method="pearson".
#
Thanks for these replies.
@Peter - are these methods only suitable for pearson covariances? That
would def explain my issues. Sorry for my ignorance, but I would
highly appreciate an explanation. My original covariance matrix is
calculated using spearman as well (which is suitable for the data).
@Michael - I am simulating a sample size of 20351* 8368  so I do not
think that the sample size is the issue here.

2012/8/12 peter dalgaard <pdalgd at gmail.com>:
#
A clarification - yes, calculating the pearson covariance does give
the expected results. I dont fully understand why yet, but many thanks
for this help!

2012/8/12 Boel Brynedal <brynedal at gmail.com>:
#
On Sun, Aug 12, 2012 at 1:46 PM, Boel Brynedal <brynedal at gmail.com> wrote:
I'm not sure that the spearman correlation is an appropriate estimator
for the covariance matrix of a multivariate normal, which is defined
in terms of the pearson correlation matrix. (More bluntly, pearson and
spearman are different measures and one won't converge to the other)

A quick unscientific test:

#################

set.seed(1)
covMat <- matrix(c(1, 0.4875, 0.4875, 1), 2, 2) # Arbitrary
library(MASS)
library(TTR) # For fast pearson cor

n <- 5000
rands <- mvrnorm(n, c(0,0), covMat, empirical = TRUE) # I'm pretty
sure we want empirical = TRUE

runPearson <- runCor(rands[,1], rands[,2], cumulative = TRUE)

# This takes a little while but I'm doing my best to make it fast ;-)
runSpearman <- vapply(seq(10, n), function(n) cor(rands[seq_len(n), ],
method =  "spearman")[2], numeric(1))

plot(runPearson, type = "l")
lines(runSpearman, col = 2)

# Show that we get good/decent convergence
abline(h = covMat[2], col = 3)

##############

That long stable difference suggests to me that you don't want to use
cor(,,"spearman") to estimate a quantity defined in terms of cor(,,
"pearson").

I am not sure if this is a general/fixed bias in the spearman
estimator or if it's just a function of the covMat I randomly chose.
Prof. Dalgaard and many others on this list must know.

Cheers,
Michael
#
On Sun, Aug 12, 2012 at 7:52 PM, R. Michael Weylandt
<michael.weylandt at gmail.com> wrote:
To somewhat answer myself, I restricted my attention to 2x2 random
normals and played around with variations of this script, using
standard normals for the marginals:

######################

library(MASS)

x <- seq(-1, 1, length.out = 1000)
bias <- numeric(length(x))
n <- 100

pb <- txtProgressBar(0, length(x))

for(i in seq_along(x)) {
  rands <- mvrnorm(n, c(0,0), matrix(c(1, x[i],x[i],1),2), empirical = TRUE)
  bias[i] <- cor(rands, method = "s")[2] - cor(rands, method = "p")[2]
  # Change "s" -> "k" for kendall's tau below
  if(!(i %% 50)) setTxtProgressBar(pb, i)
}

plot(x, bias, type = "l", xlab = "True Correlation", ylab = "Est.
Bias: Spearman - Pearson")

#######################

# For n <- 100
Min.    1st Qu.     Median       Mean    3rd Qu.       Max.
-0.1112000 -0.0186000 -0.0007219 -0.0007062  0.0172600  0.1177000
Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
0.000000 0.008928 0.017900 0.024240 0.035650 0.117700

# For n <- 10000
Min.    1st Qu.     Median       Mean    3rd Qu.       Max.
-2.642e-02 -1.272e-02 -5.491e-04 -8.178e-05  1.277e-02  2.372e-02
Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
0.000000 0.006904 0.012750 0.011840 0.016490 0.026420

where the general trend is sinusoidal with zeros at x = -1, 0, 1. The
sinusoid is more definite for large n, but has less amplitude.

I then moved to kendall's tau[0] which gives a very different shape
(sort of like nike swoosh, but also an odd function). Notably the
estimated difference is of a different order of magnitude here, even
for a  large sample:

# n <- 50
Min.    1st Qu.     Median       Mean    3rd Qu.       Max.
-0.2966000 -0.1490000  0.0047720  0.0004882  0.1479000  0.3003000
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.00000 0.08273 0.14850 0.13690 0.19210 0.30030

# n <- 5000
Min.    1st Qu.     Median       Mean    3rd Qu.       Max.
-2.131e-01 -1.525e-01  0.000e+00  8.379e-05  1.531e-01  2.137e-01
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.00000 0.08542 0.15290 0.13640 0.19550 0.21370

which seems to put me at odds with Prof Therneau's pronouncement [1]
that spearman and kendall are basically the same for large samples
(though I'm not sure if n in their discussion is observation dimension
or sample size)

Hope this is of interest to someone,

Michael

[1] http://tolstoy.newcastle.edu.au/R/e17/devel/12/06/1434.html

[0] Much slower so I'll give a dput here:

n <- 5000
dput(bias)

c(0, 0.0379451874358857, 0.052342945385874, 0.0640785709093772,
0.072964986590912, 0.0792379195759072, 0.0858528409585821, 0.0934189925873063,
0.0987845440960066, 0.103788103206227, 0.106233070598104, 0.112044791340651,
0.115695599900761, 0.120068472873754, 0.123673832344046, 0.128009737923561,
0.127985731520679, 0.13220481373552, 0.135410253221816, 0.138467183006171,
0.13961445085814, 0.14122325101657, 0.142922789322629, 0.146233529869137,
0.150125186598881, 0.152141108181596, 0.154969352228804, 0.154991755107779,
0.159098814918139, 0.161006714896533, 0.162030918135579, 0.161759182186788,
0.165335415831915, 0.166217510649277, 0.167424790503646, 0.168664396823309,
0.169537369816306, 0.171757972335208, 0.173609861111362, 0.17360361826119,
0.176839623860708, 0.176866827699874, 0.181409654663666, 0.181513673865904,
0.179933196168763, 0.18341565105814, 0.178454017129752, 0.182679180560837,
0.18619556223557, 0.185764754472416, 0.186618523624645, 0.18675871006033,
0.189817400196756, 0.188328140743264, 0.188406714856485, 0.191360103932699,
0.194982106731657, 0.193261120932895, 0.194180183143736, 0.196816708847275,
0.193991022108326, 0.195599822266756, 0.195839388578416, 0.19575152940498,
0.196511199737445, 0.195492434382773, 0.199811696633621, 0.197269266546002,
0.196206652421575, 0.200233376164722, 0.201531874262741, 0.199344875261339,
0.200629130510787, 0.205994521987481, 0.204972075896661, 0.202853570593999,
0.201918341946668, 0.208323141304938, 0.202838362747625, 0.203458805234521,
0.207394310734019, 0.205892248720014, 0.207778704409551, 0.20775197746256,
0.207293644194304, 0.205805504964857, 0.20956113448916, 0.205635387738208,
0.20540221950296, 0.207086394736405, 0.20782558097205, 0.205865347323719,
0.207212015055664, 0.210931637378527, 0.20955552055356, 0.208962760399928,
0.20851834991623, 0.208926749994644, 0.208120187080459, 0.205926466734789,
0.20912630510086, 0.212431124463131, 0.211434443525342, 0.206167468528741,
0.212151223678169, 0.210009033638559, 0.209163422914813, 0.21008664595782,
0.208499286884404, 0.208449675360498, 0.213173658555535, 0.209587179658154,
0.210616343889398, 0.212731325284076, 0.209189655348487, 0.211791614138644,
0.209064987211657, 0.210648982409094, 0.213070265064024, 0.206857340877585,
0.208672582324273, 0.20669106441909, 0.212751794963597, 0.212953113625728,
0.210194320265455, 0.209884656731146, 0.209769912180635, 0.207988434283453,
0.213731021199235, 0.204713376068607, 0.210202152222236, 0.210211912572705,
0.212221112811151, 0.203608828752738, 0.211876880761538, 0.207454554694723,
0.211529768135809, 0.205223545289638, 0.210186456270233, 0.209542005778533,
0.208584052586293, 0.206552604695113, 0.20749007058669, 0.207012693509673,
0.2085914076509, 0.209286745116791, 0.205020130192205, 0.211696183801325,
0.206134749912946, 0.208612043770115, 0.208435366833126, 0.207383634885135,
0.204113219200397, 0.208276130180991, 0.205160465446443, 0.20520895354246,
0.207336257401631, 0.205535095567662, 0.204513609668881, 0.208411667678881,
0.204195462836311, 0.201474116965535, 0.200928566253791, 0.207257030345008,
0.202883674072152, 0.204438543444425, 0.201514276989532, 0.206731318796292,
0.201560042939519, 0.203736476624654, 0.200928073342396, 0.204214168959918,
0.199941152755075, 0.201436490220967, 0.195220525426407, 0.201323344388597,
0.194715621242367, 0.197901856887894, 0.199280531021119, 0.200078769067127,
0.196392910293771, 0.197970504210952, 0.196393867281965, 0.197128892685444,
0.197481761657637, 0.192838271357975, 0.195499762054513, 0.197163293159133,
0.194189576814262, 0.192482513800057, 0.197133522400176, 0.192830900274149,
0.191331558804253, 0.191160963083508, 0.191767482785846, 0.19273087386246,
0.189472780642214, 0.193028370158516, 0.194867776438171, 0.188884338148911,
0.190686937067093, 0.18775290865981, 0.183586153707218, 0.189384271729221,
0.193488610995473, 0.190108573386349, 0.190861362342539, 0.191849558380145,
0.191696406148097, 0.184751015468359, 0.191613026268917, 0.186344610984259,
0.180078716203701, 0.185472593377534, 0.183276792615781, 0.18641133792324,
0.183887951644383, 0.184461024657384, 0.187725996050061, 0.179335676384526,
0.17843981561077, 0.179822490544155, 0.18029266297704, 0.172769076658175,
0.178976236488539, 0.178844208481336, 0.181605079053849, 0.177076171670771,
0.174751385111857, 0.175465446322498, 0.176701852002032, 0.171877045439118,
0.170808350098448, 0.176989584743776, 0.175021509527131, 0.175435510725769,
0.172469956013225, 0.170960852590939, 0.174900358890597, 0.17462174156553,
0.168434262468109, 0.178876189251865, 0.167646901792771, 0.166964843779567,
0.170888666942598, 0.167630733754359, 0.168150676141234, 0.170738552114827,
0.168311985199843, 0.166397680737349, 0.167596478895379, 0.166945947187435,
0.161325621520701, 0.159394033601515, 0.166392391671528, 0.166851361863964,
0.161376025195029, 0.157531414671323, 0.16324663611401, 0.164233711927571,
0.161131009785541, 0.15831604519102, 0.162562652910962, 0.163088676514082,
0.163619020981374, 0.160408457267029, 0.159712156405255, 0.157578127997972,
0.154875665903952, 0.156658900949359, 0.153897387044977, 0.150747475461058,
0.154799004165197, 0.15345361348546, 0.153352631687499, 0.153060251609881,
0.15146425080812, 0.153154347225801, 0.147443283411437, 0.158182549663086,
0.149403672286009, 0.14917450485092, 0.147104969342217, 0.143365979942735,
0.143598184782102, 0.146100283600264, 0.144497401422227, 0.146546769694279,
0.146461311000939, 0.145709799096956, 0.143151845904717, 0.140458665667068,
0.139786209574247, 0.139683467424216, 0.139389006930515, 0.144963400207569,
0.143531432212369, 0.142429930310386, 0.136717746271977, 0.133663533827887,
0.13652266405233, 0.140278933704659, 0.138521140544425, 0.133390832881291,
0.136723657844682, 0.130406872886089, 0.136056481206151, 0.134579864281165,
0.132381983103327, 0.139060917288563, 0.130544012305965, 0.136814384778858,
0.130100720444389, 0.131746487996298, 0.124839344966091, 0.129945804656427,
0.12635868563102, 0.126518876067506, 0.127841218934478, 0.127247178524794,
0.1256103695614, 0.122165198925671, 0.121284061096504, 0.121622367156114,
0.126766754431967, 0.121326144708421, 0.127266211120102, 0.123178031882653,
0.1165997546256, 0.120501013275728, 0.120013234118295, 0.114898129495769,
0.112497167701809, 0.116678962459159, 0.113383101685402, 0.11698686083563,
0.114112204302723, 0.114053150890439, 0.111936085875834, 0.11588279361578,
0.109803656186693, 0.115417417337321, 0.110934759204093, 0.116122515153681,
0.108682305510151, 0.105821251697787, 0.111311788203487, 0.108234851214487,
0.109053893421327, 0.102334627966634, 0.103557430925625, 0.105559589755789,
0.107305697375711, 0.110037282091053, 0.100266846402314, 0.102592749981428,
0.100468963622554, 0.10446240070837, 0.0979444555177301, 0.0965147279706189,
0.0968544743182871, 0.0929756169452109, 0.0941240050212245, 0.0917081602506691,
0.0934414653100791, 0.097768889193254, 0.0977682474633065, 0.0916735869295982,
0.0900162938693846, 0.0922119313952881, 0.0950260926259327, 0.0892903838825825,
0.0884111664374918, 0.0885956817389505, 0.0895878785767164, 0.0915335461086212,
0.0902537685515083, 0.0853916745311025, 0.0868967739493844, 0.0846095949119755,
0.0898920898093537, 0.08848780735126, 0.0854260734028687, 0.0871694604786824,
0.0805273304510752, 0.0802357505334902, 0.0821951808179456, 0.0833133228447492,
0.0777800545894964, 0.0811738517473264, 0.0808368227399235, 0.0804170571852109,
0.0766444610643851, 0.0751873680441794, 0.076232055380045, 0.0772916256925059,
0.068965478861538, 0.0746258093260293, 0.0711012628151256, 0.0768313672344079,
0.0663590311655925, 0.074126663090376, 0.0690982958153193, 0.0662942133972342,
0.0684831295788689, 0.0666757264966508, 0.0662553208139126, 0.072335575263201,
0.0676738413148095, 0.0633003250099469, 0.0604431119657364, 0.063395700881918,
0.0649193640129427, 0.0616316648715129, 0.0637504870343439, 0.0622620277408832,
0.060624258585451, 0.0617878497020728, 0.0644898284962297, 0.0574981885666422,
0.0541075888450961, 0.0608082873832024, 0.0558509743189879, 0.0543065038232871,
0.0537420693347878, 0.0513415876368468, 0.052566791075933, 0.0554214404041971,
0.0467861117368621, 0.0526420013131756, 0.0495783469807073, 0.0545543805858271,
0.0482820845250128, 0.0492752415548176, 0.0460133075664182, 0.0498075048042642,
0.0446335084033825, 0.0385682937588518, 0.0434303845754135, 0.0463167202409452,
0.0433844521857323, 0.0405794095756089, 0.0404382597440408, 0.0456330571019107,
0.0419659220733034, 0.0367853643601593, 0.0393481153087476, 0.0365206682177276,
0.0375315888002425, 0.036189398760633, 0.0378543701533096, 0.0348433663509479,
0.0349800320824926, 0.0387972739292601, 0.0374305989926713, 0.0296485609834679,
0.0306758048306359, 0.0314388358352352, 0.0333128090282721, 0.0296781604969642,
0.0280975227678169, 0.0234940404697555, 0.0214709142429086, 0.030409020262511,
0.0266117792126995, 0.0208994351422837, 0.0256157368010141, 0.0276388598240168,
0.0224382981100726, 0.0211588406169722, 0.0188129298332138, 0.0235913239104279,
0.02060992602925, 0.0274922608946214, 0.0162453699148236, 0.0193011794751344,
0.0213476671710718, 0.0135609882336828, 0.0142750494443235,
0.00962259735230325,
0.0146279168145941, 0.0196866869670231, 0.0156317943869055, 0.011043035033433,
0.0124321112470742, 0.0116876407513733, 0.00846171396441461,
0.00891492300462063, 0.0103656115407267, 0.0103374443056779,
0.00720913704262372, 0.00629983358032973, 0.00627470695340277,
-0.00205544067772523, 0.00466990278936654, 0.00221212963313383,
-0.0054726089161779, 0.00364617323865189, -0.00365848929545655,
-0.00211530225965111, 0.00299979915903091, 0.00374426645088765,
0.0021197799519863, -0.00115895739708494, -0.00362089138548412,
-0.0027120712230533, 0.00277190397038367, -0.00510871375476295,
-0.0066576651466431, -0.00307647050931685, -0.00904566595000687,
-0.00764618765594972, -0.0102036607521703, -0.00849179998161798,
-0.0147781788589949, -0.0111664181084465, -0.0131301724609186,
-0.00748840570916988, -0.0155885873470991, -0.0149110134339179,
-0.0179951518632056, -0.0166803305005348, -0.0184816523665093,
-0.0171279432262829, -0.0172122816955783, -0.0198846577723955,
-0.0161916007625947, -0.0235245889618364, -0.0216741404737405,
-0.0236292530978669, -0.0212521392767043, -0.0252377379980502,
-0.0307558032126947, -0.0282232983133164, -0.0216936739900531,
-0.0296208610290628, -0.0255426069798546, -0.029641348329726,
-0.0285747366089835, -0.0267796591951022, -0.0262032255099669,
-0.0277790622789223, -0.0291481376956072, -0.0274138724441582,
-0.0335136540020714, -0.0343635855899908, -0.033355545583591,
-0.037936143304737, -0.0382531683113398, -0.0382630918976588,
-0.0325245057820373, -0.0357529930810987, -0.037303704825049,
-0.03743893347238, -0.0376823437560386, -0.0377113111511191,
-0.0420633831671238, -0.0439933707662455, -0.0367604057748485,
-0.0388661085169988, -0.0449628494667904, -0.0461030791143213,
-0.0422661533307663, -0.0471402497516521, -0.048416506604624,
-0.0454491947438537, -0.0549709406946454, -0.0503655412163512,
-0.0509413379773052, -0.0513142141541421, -0.0550213571843499,
-0.0528170779301007, -0.0522288018764913, -0.0531001777532681,
-0.0522664126018397, -0.0549274264062021, -0.0539422709767178,
-0.0518898620965436, -0.0598703397936844, -0.0582559385150305,
-0.0610737836856659, -0.0593340773459997, -0.0653847290779478,
-0.0601635264390214, -0.0606144982349827, -0.0606669903350041,
-0.0643779741333653, -0.0599940589519306, -0.0635738165050428,
-0.0664631959825401, -0.0688164682385927, -0.0633475360537572,
-0.065844837115571, -0.0754315560609618, -0.0631796672848085,
-0.0645863502229977, -0.0718750095564662, -0.066656687493655,
-0.0718026782934164, -0.0719199833560306, -0.0742098829375484,
-0.071157274017366, -0.0707282298101259, -0.0737307519161488,
-0.0724256925058685, -0.0709375564802649, -0.073568804331437,
-0.0802995920905901, -0.0768729883714483, -0.0784619477649285,
-0.0778805530875945, -0.0817266038993585, -0.0847857773356474,
-0.0786363890595937, -0.0792289891812197, -0.0844729195688988,
-0.0847987463358537, -0.0779634608803642, -0.0848646827263352,
-0.0836009115737063, -0.0904706071144159, -0.0910238393624669,
-0.0854942550472057, -0.0879790736125203, -0.0912611716337263,
-0.0922312872584528, -0.0888051636353296, -0.0897506343310704,
-0.0938332124482956, -0.0927989271928461, -0.0943888467783648,
-0.0935930092124532, -0.0955386799482018, -0.0915599658069753,
-0.0933851324419039, -0.0966865943358845, -0.0969805747335653,
-0.097362092638748, -0.0995310080234267, -0.0984655165267289,
-0.0983627775805411, -0.0950302726811627, -0.100430554339096,
-0.101466923214473, -0.101454122255883, -0.10689825268357, -0.106648604355506,
-0.105486773590954, -0.101090375913021, -0.107370353510142, -0.103293699780997,
-0.102972517146072, -0.107678099864217, -0.102231412128272, -0.109018691185685,
-0.106508590767202, -0.110011212893229, -0.111729158083869, -0.10473288042994,
-0.109701715798615, -0.113319240905238, -0.111924563571373, -0.115554731206501,
-0.115399181698202, -0.11358810108368, -0.116461477360537, -0.114414829632593,
-0.116564861240516, -0.11886340255038, -0.121549381347741, -0.119538260725218,
-0.118618718418358, -0.125846085493375, -0.122342346347147, -0.122170633606201,
-0.123776236328347, -0.125358634409565, -0.124113426969678, -0.123432652416369,
-0.125206608809249, -0.130072543597809, -0.127008412373165, -0.125641260544401,
-0.121822898473589, -0.129516918879271, -0.128801097316561, -0.131326564011501,
-0.134908882076716, -0.134685639029708, -0.135665196542812, -0.129920529210947,
-0.134567380182743, -0.135082524813271, -0.137855400990108, -0.132845440599631,
-0.144321817476608, -0.134934981711057, -0.1346930149193, -0.135143186555229,
-0.134425764672454, -0.132355912303582, -0.139809884699663, -0.142135631450615,
-0.140024490824091, -0.13533891531059, -0.142122833695868, -0.145138158362403,
-0.149443981128558, -0.141963606655265, -0.142778651265789, -0.144284554047947,
-0.14473808635601, -0.147273475035348, -0.144342970536049, -0.144109165376619,
-0.141922809707087, -0.145856878122371, -0.147393987145778, -0.152387307411432,
-0.150947821115775, -0.148656324418037, -0.15015310537583, -0.152054447245806,
-0.159707659489856, -0.154360831725905, -0.154147510663294, -0.15412062688814,
-0.152746113587082, -0.156275461058177, -0.151326152798127, -0.15733567630443,
-0.153707272225216, -0.15331007438725, -0.155701754324839, -0.157029381451866,
-0.15481117941306, -0.160315161811141, -0.158769734327246, -0.162678197621506,
-0.157459395462676, -0.162719008986982, -0.162333173421471, -0.162474163221033,
-0.160367503490688, -0.159789629517495, -0.167465566306454, -0.162975709936782,
-0.161392674931383, -0.1664925765133, -0.167470693738347, -0.169313623925986,
-0.163358034409685, -0.168085221448694, -0.173057257457498, -0.167850457699148,
-0.168456340477305, -0.170057302271265, -0.16929587158673, -0.175212096433301,
-0.172272310077631, -0.173317960809379, -0.176316002019223, -0.176239828386098,
-0.168285279077838, -0.175298843392302, -0.179907286682562, -0.174910128852598,
-0.171368302088846, -0.180250240078046, -0.175694450521736, -0.17486100543432,
-0.184512537342303, -0.178360428522141, -0.183390716181274, -0.179558751389918,
-0.182414844210083, -0.179385599962836, -0.178830130470539, -0.181132992644575,
-0.185365840815811, -0.180149599169083, -0.182234497750401, -0.185424577367926,
-0.183583250704195, -0.185032502156087, -0.181314640185294, -0.182570252909441,
-0.186612022865033, -0.183164294921046, -0.188103364336531, -0.186458717008667,
-0.187317290324932, -0.181997668002069, -0.187336177305531, -0.183985748821436,
-0.194024718216917, -0.187962067288333, -0.186281252727022, -0.189344586995477,
-0.190175954870654, -0.189830287338749, -0.186079778838651, -0.189197363957276,
-0.189860538193725, -0.189181043896467, -0.189298989087107, -0.195898870665024,
-0.19338797008651, -0.19116592727955, -0.19194688507271, -0.194962529803258,
-0.192412261351169, -0.195620584617424, -0.19897293668944, -0.197942972298163,
-0.194416028511008, -0.191122731453198, -0.198319852479004, -0.198199830076125,
-0.19636890549281, -0.198569667246763, -0.200938142543424, -0.194242404997516,
-0.197896417401598, -0.198558951510022, -0.196226166554632, -0.196784839890901,
-0.202416367798084, -0.204202486623451, -0.203137475222772, -0.200109671263582,
-0.199843219574846, -0.200934479428418, -0.198440862306596, -0.194629221580052,
-0.2007523678109, -0.206324043747689, -0.204642589058352, -0.201798021746491,
-0.206470637871318, -0.207623029951336, -0.207377862519451, -0.203172863121173,
-0.201355541258402, -0.203546861123976, -0.210063366026559, -0.204724219798915,
-0.205291534863529, -0.207028843926944, -0.203714742708301, -0.206872015764514,
-0.201728428648693, -0.208073379240413, -0.209746835533273, -0.207971762120192,
-0.21092291395216, -0.211413733717715, -0.208184769526478, -0.209096473468868,
-0.209852786333042, -0.207890955568491, -0.210241987376454, -0.2105850976001,
-0.211038149812145, -0.209189461676119, -0.212630471479682, -0.209385664119811,
-0.206891886965982, -0.208315853360862, -0.20830673313842, -0.204648403074008,
-0.205574669928981, -0.205679812559109, -0.207996597517702, -0.206403640527905,
-0.210600161433688, -0.206120387080419, -0.207887142033011, -0.208631932592725,
-0.208005408889586, -0.209992367882986, -0.205851541319275, -0.213018896391891,
-0.210591852584731, -0.210826461108038, -0.208581853788175, -0.209101479314882,
-0.208742209062433, -0.211101402502723, -0.211044432710366, -0.210687242874,
-0.207923811789385, -0.203731454919613, -0.208965303290888, -0.208583468525537,
-0.210135620557545, -0.210769508936822, -0.211726501937024, -0.211192476733585,
-0.212394318703581, -0.21313974939132, -0.209801003243692, -0.205221208886422,
-0.207802046655577, -0.207452218291506, -0.210784726394729, -0.208694389929037,
-0.20911191503566, -0.20834088243074, -0.208377051266109, -0.208427622982054,
-0.205810941247309, -0.203674515563773, -0.201568816025467, -0.202194702804425,
-0.207295404546375, -0.20619998706448, -0.209536175903849, -0.201635877445759,
-0.203561704212715, -0.204193672207915, -0.203902895654206, -0.204473411358948,
-0.200469252128704, -0.201814002680416, -0.201176596800842, -0.202275858254734,
-0.202111026890063, -0.196866779642215, -0.198542636415171, -0.203124994488387,
-0.200410853261743, -0.199061785049703, -0.199367607815858, -0.200255306957288,
-0.199519801457789, -0.197101559410982, -0.197982057112123, -0.197073717045712,
-0.197867957495403, -0.192886802866079, -0.191611829473002, -0.191276884085526,
-0.192061042518814, -0.19486464484088, -0.188624038321178, -0.191899414998115,
-0.189159668650447, -0.191487655849489, -0.186321984316783, -0.184521465814685,
-0.187738910905304, -0.184310226770079, -0.182297985923511, -0.185517031334195,
-0.179870143558241, -0.179872385608253, -0.180728398412415, -0.177552884911317,
-0.17870767747143, -0.176361449827503, -0.174984055950329, -0.172272955331807,
-0.167639550252393, -0.170399143772699, -0.167097044954537, -0.16825183751465,
-0.165124013551459, -0.162113012952941, -0.161937299411834, -0.158195112576069,
-0.160040123179791, -0.155471851126982, -0.153326303619083, -0.151530266013163,
-0.149323586278817, -0.149300383239811, -0.147879620688902, -0.142121190604488,
-0.139283024572883, -0.136258581285827, -0.13554436004318, -0.131105393851543,
-0.12963550147467, -0.126714118799736, -0.123053708319241, -0.120079835146208,
-0.114681957172215, -0.112763975177418, -0.107091802344453, -0.102938013188223,
-0.09897338186356, -0.0923530193926674, -0.0869753054514808,
-0.0808739267773476, -0.0726053946725282, -0.064787992793754,
-0.0534967761520273, -0.0381513086601305, 0)
#
There is also the chance that your sampling code is not correct.
Have you tried it out on, say, 5 dimensional data with increasing
numbers of samples? 

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com