Group Abstract Group Abstract

Message Boards Message Boards

Error using smooth kernel distribution with a high amount of elements

Posted 4 years ago

Hello everyone. I want to save Gaussian random points in a txt file and then load them and calculate the empiric pdf. However, I am getting an error if the number of elements is high enough.

To keep it simple, I have prepared a small example.

d1 = RandomVariate[NormalDistribution[0, 1], 100000];

Export["d1TEST.txt", d1];

d2 = Flatten[Import["d1TEST.txt", "Table"]];

\[ScriptCapitalD]1 = SmoothKernelDistribution[d1];

\[ScriptCapitalD]2 = SmoothKernelDistribution[d2];

SmoothKernelDistribution::invldd: The input data SmoothKernelDistribution[{-0.850889,1.1616,0.696657,1.78897,-0.504029,0.713672,-0.415394,-1.02279,-0.575213,-0.0739832,<<31>>,-1.67304,-0.0996146,0.262648,1.21812,-1.34935,0.0263795,0.714684,-0.67401,-0.498297,<<99950>>}] should be a vector or a matrix of real numbers or a valid TemporalData object.

d3 = RandomVariate[NormalDistribution[0, 1], 1000];

\[ScriptCapitalD]3 = SmoothKernelDistribution[d3];

Can someone please tell me why I am getting the error under D2? It cannot be the size of the vector, since D1 works fine.

Any help is appreciated. Best regards. Jaime.

POSTED BY: Jaime de la Mota
2 Replies
Posted 4 years ago
POSTED BY: Rohit Namjoshi
POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard