Group Abstract Group Abstract

Message Boards Message Boards

Error using smooth kernel distribution with a high amount of elements

Posted 4 years ago
POSTED BY: Jaime de la Mota
2 Replies
Posted 4 years ago

The problem occurs when the values are small, in that case, Export as text causes the numbers to be read as String.

d2 // Map[Head] // DeleteDuplicates
(* {Real, String} *)

d2 // Select[Head[#] === String &]
(* {"-5.846412131032388*^-6", "-9.827288974460845*^-6"} *)

Best to use Save or DumpSave and Get as suggested by Neil, and as I suggested here.

POSTED BY: Rohit Namjoshi

Jaime,

I would report this as a bug -- sometimes it works and sometimes it does not. It must depend on the data. If you avoid the text file, it works at any size (I tried up to 10,000,000). Use

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

Save["d1TEST", d1];

d2 = Get["d1TEST"];

\[ScriptCapitalD]1 = SmoothKernelDistribution[d2];

Or do binary read/writes to save space.

Regards,

Neil

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