Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = {{x1,y1},{x2,y2},...}
- datadistr = SmoothKernelDistribution[data]
- PDF[datadistr, {x, y}]
- (* Generate some bounded data *)
- data = RandomVariate[BinormalDistribution[{0, 0}, {1, 1}, 0.9], 5000];
- data = Select[data, #[[1]] > -1 && -1 < #[[2]] < 1 &];
- (* Get nonparametric density estimate *)
- skd = SmoothKernelDistribution[data, 0.3, {"Bounded", {{-1, ∞}, {-1, 1}}, "Gaussian"}];
- (* Show results *)
- Show[ListPlot[data, PlotRange -> {{-1.5, 3}, {-1.5, 1.5}}, Frame -> True],
- ContourPlot[PDF[skd, {x, y}], {x, -1.5, 3}, {y, -1.5, 1.5},
- ContourShading -> None, PlotPoints -> 100]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement