But for my reporting purpose, I need to generate a bell curve like plot based on empirical PDF, that also contains original points. Any idea would be helpful. Thanks, On Mon, Mar 12, 2018 at 3:49 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote:> You need to re-read ?density and perhaps think again -- or do some study -- > about how a (kernel) density estimate works. The points at which the > estimate is calculated are *not* the values given, nor should they be! > > Cheers, > Bert > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Sun, Mar 11, 2018 at 11:45 AM, Christofer Bogaso > <bogaso.christofer at gmail.com> wrote: >> >> Hi, >> >> Let say I have below vector of data-points : >> >> Dat = c(-0.444444444444444, -0.25, -0.237449799196787, -0.227467046669042, >> >> -0.227454464682363, -0.22, -0.214876033057851, -0.211781206171108, >> >> -0.199891067538126, -0.192920353982301, -0.192307692307692, >> -0.186046511627907, >> >> -0.184418145956608, -0.181818181818182, -0.181818181818182, >> -0.181266261925412, >> >> -0.181003118503119, -0.179064587973274, -0.178217821782178, >> -0.17809021675454, >> >> -0.177685950413223, -0.177570093457944, -0.176470588235294, >> -0.176470588235294, >> >> -0.174825741611282, -0.168021680216802, -0.166666666666667, >> -0.166666666666667, >> >> -0.166380789022298, -0.164209115281501, -0.164011246485473, >> -0.162689804772234, >> >> -0.162361623616236, -0.160161507402423, -0.16, -0.155038759689922, >> >> -0.154172560113154, -0.15311004784689, -0.151515151515152, >> -0.151462994836489, >> >> -0.151098901098901, -0.150537634408602, -0.150442477876106, >> -0.150406504065041, >> >> -0.149904214559387, -0.149882903981265, -0.149797570850202, >> -0.148496240601504, >> >> -0.148325358851675, -0.147540983606557, -0.147239263803681, >> -0.146989966555184, >> >> -0.14622641509434, -0.146095717884131, -0.145994832041344, >> -0.14572864321608, >> >> -0.145161290322581, -0.144292237442922, -0.144144144144144, >> -0.144021739130435, >> >> -0.14375, -0.142212189616253, -0.141122913505311, -0.140324963072378, >> >> -0.139344262295082, -0.13884007029877, -0.138356164383562, >> -0.137626262626263, >> >> -0.137142857142857, -0.136690647482014, -0.136577708006279, >> -0.136363636363636, >> >> -0.136094674556213, -0.135879774577332, -0.135586319218241, >> -0.135135135135135, >> >> -0.132780082987552, -0.132209405501331, -0.132023755139333, >> -0.131233595800525, >> >> -0.130434782608696, -0.130434782608696, -0.130268199233717, >> -0.128813559322034, >> >> -0.1284046692607, -0.128205128205128, -0.128182616330114, >> -0.127937336814621, >> >> -0.126283367556468, -0.125853658536585, -0.125448028673835, >> -0.125425564840607, >> >> -0.125311203319502, -0.125, -0.124401913875598, -0.124248496993988, >> >> -0.124031007751938, -0.123572170301142, -0.123188405797102, >> -0.122905027932961, >> >> -0.121666666666667, -0.121573685907772, -0.120658135283364, >> -0.120540019286403, >> >> -0.119858156028369, -0.11965811965812, -0.11965811965812, >> -0.119565217391304, >> >> -0.118942731277533, -0.117820324005891, -0.116257947320618, >> -0.115789473684211, >> >> -0.115683584819387, -0.115384615384615, -0.115281501340483, >> -0.114492753623188, >> >> -0.114357262103506, -0.114285714285714, -0.114035087719298, >> -0.113181972212809, >> >> -0.112790697674419, -0.112781954887218, -0.112195121951219, >> -0.112191473448018, >> >> -0.111111111111111, -0.111111111111111, -0.110813226094727, >> -0.110384300899428, >> >> -0.110147441457069, -0.110137672090113, -0.109913793103448, >> -0.109792284866469, >> >> -0.109375, -0.10919540229885, -0.109112709832134, -0.10844250363901, >> >> -0.107776617954071, -0.10752688172043, -0.107317073170732, >> -0.106674272675414, >> >> -0.106382978723404, -0.106100795755968, -0.106060606060606, >> -0.10595160235448, >> >> -0.105742474070326, -0.105263157894737, -0.104454685099846, >> -0.104283054003724, >> >> -0.103916449086162, -0.103723404255319, -0.103448275862069, >> -0.102737680438029, >> >> -0.10267471958585, -0.101696871753434, -0.100893997445721, >> -0.10041265474553, >> >> -0.100042983021706, -0.1, -0.0995111731843576, -0.099502487562189, >> >> -0.0994117647058824, -0.0991561181434598, -0.0989492119089317, >> >> -0.0988372093023255, -0.0983908045977012, -0.0983050847457627, >> >> -0.0977198697068404, -0.0974702380952382, -0.0973819695475956, >> >> -0.097345132743363, -0.0971472629144179, -0.0971438645980254, >> >> -0.0961538461538461, -0.096062667491239, -0.0957347238935687, >> >> -0.0956521739130435, -0.0954773869346733, -0.0954115076474873, >> >> -0.0952380952380952, -0.0951115834218915, -0.0950642007303569, >> >> -0.0949423247559894, -0.0947368421052631, -0.0946291560102303, >> >> -0.0945220193340494, -0.0944309927360775, -0.0943016759776536, >> >> -0.0942720763723149, -0.0941770647653002, -0.0940298507462686, >> >> -0.094017094017094, -0.0935672514619884, -0.0934579439252337, >> >> -0.0930232558139535, -0.0929772502472798, -0.0929054054054054, >> >> -0.0928778745255637, -0.0927700348432055, -0.0925266903914591, >> >> -0.0922502666192677, -0.0918094218415418, -0.0915254237288135, >> >> -0.0914774596906876, -0.0914662894860915, -0.0914285714285715, >> >> -0.0912322274881517, -0.090909090909091, -0.0909090909090909, >> >> -0.09079754601227, -0.0907071455016661, -0.0906593406593406, >> >> -0.0903614457831325, -0.0903323548906352, -0.09, -0.0897243107769424, >> >> -0.0896358543417368, -0.0895522388059702, -0.0895052902487847, >> >> -0.0891719745222929, -0.0888888888888888, -0.0887227819304518, >> >> -0.0887096774193548, -0.0886956521739131, -0.0884703196347032, >> >> -0.0884450784593437, -0.0884413309982488, -0.0883577310155536, >> >> -0.0883054892601431, -0.0882917466410749, -0.0881628999776236, >> >> -0.0881193929739248, -0.0880681818181819, -0.0878186968838525, >> >> -0.087719298245614, -0.0876010781671159, -0.0873634945397815, >> >> -0.0872641509433961, -0.0871512228728901, -0.0871032050299035, >> >> -0.0868133772309825, -0.0865384615384615, -0.0858895705521473, >> >> -0.085742525327403, -0.0855766209280403, -0.0854700854700855, >> >> -0.0853994490358125, -0.0853658536585365, -0.0851063829787235, >> >> -0.085048426150121, -0.0849673202614379, -0.084862385321101, >> >> -0.0843335637529065, -0.0843222985633979, -0.084315503173164, >> >> -0.0842105263157896, -0.0841423948220064, -0.0838323353293414, >> >> -0.0836501901140684, -0.083422459893048, -0.0833333333333334, >> >> -0.0833333333333333, -0.0827236916150815, -0.0826723611958512, >> >> -0.0826039387308535, -0.0824242424242424, -0.0821513002364065, >> >> -0.0820932539682539, -0.0820713238886174, -0.0818181818181818, >> >> -0.0816618911174786, -0.0816613868356214, -0.0816326530612244, >> >> -0.081619937694704, -0.0813748531139835, -0.0811965811965812, >> >> -0.0810372771474878, -0.0809095716552088, -0.0808823529411764, >> >> -0.0808414831492295, -0.0807511737089201, -0.0805722891566266, >> >> -0.0803474484256242, -0.0800000000000001, -0.0800000000000001, >> >> -0.0799584631360333, -0.0795941847087125, -0.0795930580490723, >> >> -0.0794701986754966, -0.0793650793650794, -0.0791855203619909, >> >> -0.0790273556231002, -0.0790273556231002, -0.0789473684210527, >> >> -0.0789473684210526, -0.0787545787545788, -0.0787461773700307, >> >> -0.0786724031960664, -0.0782122905027933, -0.078177727784027, >> >> -0.078125, -0.0778443113772455, -0.0776310524209684, -0.0775862068965517, >> >> -0.0775577557755776, -0.0773930753564156, -0.0772686433063791, >> >> -0.0771513353115727, -0.0771200000000001, -0.0770370370370371, >> >> -0.076923076923077, -0.076923076923077, -0.0769039940461424, >> >> -0.076592082616179, -0.0763425253991292, -0.0762886597938145, >> >> -0.0762886597938145, -0.0761565836298932, -0.0760869565217391, >> >> -0.07597645799893, -0.0758377425044092, -0.0757314974182444, >> >> -0.0755148741418765, -0.0754814305364511, -0.0754189944134078, >> >> -0.0752351097178683, -0.0750988142292491, -0.074935400516796, >> >> -0.0748663101604277, -0.0748031496062992, -0.0747663551401868, >> >> -0.0747295968534907, -0.0747028862478777, -0.0745967741935485, >> >> -0.0741784037558686, -0.0740740740740741, -0.0740740740740741, >> >> -0.0740740740740741, -0.073828125, -0.0736698499317872, >> -0.0735877862595421, >> >> -0.0735824009102977, -0.0735632183908046, -0.0733944954128441, >> >> -0.0728862973760932, -0.0728279386712096, -0.0726480203414457, >> >> -0.0726329442282749, -0.072632190586868, -0.0725766664070006, >> >> -0.0724137931034483, -0.0722664432341852, -0.0719257540603249, >> >> -0.0717538461538461, -0.0716612377850163, -0.0715181932245923, >> >> -0.0714285714285715, -0.0714285714285713, -0.0710646285867525, >> >> -0.0708446866485014, -0.0708117443868739, -0.0708028321132845, >> >> -0.0706436420722135, -0.0705325930495579, -0.0705128205128205, >> >> -0.0705009276437847, -0.0704043019318861, -0.0702106318956871, >> >> -0.0701663201663202, -0.0700661736084078, -0.0699999999999999, >> >> -0.0695540857691487, -0.0692979983084297, -0.0691823899371069, >> >> -0.0691244239631336, -0.0690335305719921, -0.0689655172413792, >> >> -0.0688536409516944, -0.068450039339103, -0.0682332955832389, >> >> -0.0682261208576998, -0.0681818181818182, -0.0679035250463822, >> >> -0.0679012345679012, -0.0677966101694916, -0.0676384839650145, >> >> -0.0675675675675676, -0.0675241157556271, -0.067463706233988, >> >> -0.0674584323040379, -0.0668523676880222, -0.0666666666666667, >> >> -0.066526455612132, -0.0664206642066421, -0.066321243523316, >> >> -0.0662949194547709, -0.0662579580287669, -0.0662251655629139, >> >> -0.0661764705882353, -0.0661478599221789, -0.0657894736842105, >> >> -0.0657534246575342, -0.0654481924472518, -0.0652900974262034, >> >> -0.0652225100070638, -0.0651126106388572, -0.0650887573964497, >> >> -0.0650684931506849, -0.0650195058517555, -0.0649954627949184, >> >> -0.0649081209247184, -0.064891846921797, -0.0648899188876013, >> >> -0.0648148148148149, -0.0645962732919255, -0.0644599303135888, >> >> -0.0644171779141105, -0.0643564356435644, -0.064327485380117, >> >> -0.0642667310944672, -0.0641975308641976, -0.0641025641025641, >> >> -0.0639197041732701, -0.0638436482084691, -0.0635245901639343, >> >> -0.0634996041171813, -0.0632017594629008, -0.0631313131313131, >> >> -0.0630434782608695, -0.0629405840886203, -0.0629155024568842, >> >> -0.0628765060240964, -0.0628571428571429, -0.0625394819962098, >> >> -0.062476757158795, -0.06203552416592, -0.0620347394540943, >> -0.0619971604354, >> >> -0.0619946091644204, -0.0619469026548672, -0.0619235836627141, >> >> -0.0618131868131868, -0.0617667356797793, -0.0617312601531677, >> >> -0.0616740088105726, -0.0614161849710983, -0.0613026819923372, >> >> -0.0612244897959185, -0.0610859728506788, -0.0610526315789473, >> >> -0.0610399397136398, -0.0610169491525424, -0.0609659540775929, >> >> -0.0608695652173912, -0.0606060606060606, -0.0606060606060606, >> >> -0.0604929051530994, -0.0604204204204204, -0.0603636363636364, >> >> -0.0602698650674663, -0.0602115541090318, -0.0599352051835853, >> >> -0.0599001663893511, -0.0596379126730565, -0.0594227504244482, >> >> -0.0587275693311581, -0.0587002096436059, -0.0586319218241041, >> >> -0.0586046511627907, -0.0584174190122145, -0.0584011488750599, >> >> -0.0583707504810776, -0.0579299691040165, -0.0579268292682926, >> >> -0.0579050097592712, -0.057608079558922, -0.0574712643678161, >> >> -0.0572450805008944, -0.0570958904109589, -0.0568263045032167, >> >> -0.0568181818181818, -0.0568181818181818, -0.0568031704095112, >> >> -0.0566301923974486, -0.0566037735849057, -0.0566037735849057, >> >> -0.0566037735849056, -0.0564433866031963, -0.0562770562770562, >> >> -0.0561576354679803, -0.0560928433268858, -0.0559006211180124, >> >> -0.0558213716108453, -0.055689240288759, -0.0554101893181468, >> >> -0.0553961597881263, -0.0553633217993079, -0.0553571428571429, >> >> -0.0553481577665964, -0.0553158101216163, -0.0553108174253549, >> >> -0.0548340548340548, -0.0546601261387525, -0.054590570719603, >> >> -0.0545001187366422, -0.0544511668107173, -0.0544274300932089, >> >> -0.0542372881355932, -0.0542168674698794, -0.0540540540540541, >> >> -0.053763440860215, -0.0537513997760358, -0.0536343468615424, >> >> -0.0535714285714286, -0.0534725518114223, -0.0529294274300931, >> >> -0.0528846153846155, -0.0528756957328386, -0.0526458340386634, >> >> -0.0526315789473684, -0.0525606469002696, -0.0525451559934318, >> >> -0.0525227460711332, -0.051948051948052, -0.051792828685259, >> >> -0.0517241379310345, -0.0513784461152881, -0.0513559322033898, >> >> -0.0512610211195407, -0.0512437810945274, -0.051150895140665, >> >> -0.0510695486616643, -0.0507726269315673, -0.0507377685736475, >> >> -0.0506575742815391, -0.0506024096385543, -0.0505494505494506, >> >> -0.0503194888178913, -0.0501567398119122, -0.05, -0.0499001996007984, >> >> -0.0498214285714285, -0.0497737556561087, -0.0497470489038785, >> >> -0.0494845360824741, -0.0493827160493827, -0.0492157923201731, >> >> -0.0491192897035657, -0.0489642184557439, -0.0488200324265898, >> >> -0.0488031366075114, -0.0485151426051161, -0.0483319076133448, >> >> -0.0481220657276996, -0.0480897675661234, -0.0480599647266314, >> >> -0.0480038022813688, -0.0479900280461202, -0.0479548660084627, >> >> -0.0478449164776243, -0.0475638051044084, -0.0475342709631477, >> >> -0.0473213579172271, -0.0472997462848857, -0.0472050636772667, >> >> -0.046890780551147, -0.0467625899280576, -0.046753107010276, >> >> -0.0466592011944754, -0.0465772759350741, -0.0465753424657535, >> >> -0.0464333781965007, -0.0463888365076373, -0.0463215258855587, >> >> -0.046281851274051, -0.0459946060208471, -0.0458715596330275, >> >> -0.0458563535911603, -0.0457367549668873, -0.0456500165398611, >> >> -0.0454373701114679, -0.0454265548766046, -0.0454183266932271, >> >> -0.045213508233324, -0.045182571340902, -0.0451018428709989, >> >> -0.0451018428709989, -0.044955044955045, -0.0444136016655101, >> >> -0.0443722943722945, -0.0442996742671011, -0.0442477876106195, >> >> -0.0442477876106195, -0.0441176470588236, -0.043982895540623, >> >> -0.0438184663536776, -0.0436363636363636, -0.043261231281198, >> >> -0.0432218514782339, -0.0431654676258993, -0.0424336600525938, >> >> -0.0423429781227946, -0.0423387096774193, -0.0420711974110032, >> >> -0.0420083118050095, -0.0420032310177707, -0.0417256011315418, >> >> -0.0416842105263158, -0.0416141235813367, -0.0414593698175788, >> >> -0.0413793103448276, -0.041320942582144, -0.0407865986890023, >> >> -0.0406158747013539, -0.0405803571428572, -0.0405643738977073, >> >> -0.040422053796998, -0.040268456375839, -0.0400500625782228, >> >> -0.0400449101796407, -0.04, -0.0399718147460123, -0.0399137001078749, >> >> -0.0399044464954666, -0.0398863290368415, -0.0398230088495575, >> >> -0.0394736842105263, -0.0393401015228426, -0.0392720306513411, >> >> -0.0392156862745098, -0.0388349514563106, -0.0386904761904763, >> >> -0.0384615384615385, -0.0382457345700217, -0.0382293762575454, >> >> -0.0381840048105834, -0.0380030474141795, -0.0379746835443038, >> >> -0.0379247280777747, -0.0376432078559739, -0.0375494071146245, >> >> -0.0375490837696336, -0.0373345788572318, -0.0372940156114484, >> >> -0.0371871275327772, -0.037037037037037, -0.0368133174791915, >> >> -0.0368098159509203, -0.0367231638418078, -0.0361445783132531, >> >> -0.0360915492957746, -0.0357142857142857, -0.0356663184599313, >> >> -0.0356413696552528, -0.035513103110458, -0.0353194103194103, >> >> -0.0352112676056338, -0.0350119904076739, -0.0349794238683129, >> >> -0.0349373764007909, -0.0349091600875106, -0.0347826086956522, >> >> -0.0347728547392037, -0.0347682119205298, -0.0346083788706739, >> >> -0.0344706296166022, -0.0344421548425081, -0.0341176470588236, >> >> -0.0338983050847458, -0.033457249070632, -0.0334208223972004, >> >> -0.0333333333333334, -0.0333333333333333, -0.0329670329670331, >> >> -0.0329144225014961, -0.0326797385620915, -0.0323033707865168, >> >> -0.0322118826055834, -0.0321750321750322, -0.0320890635232481, >> >> -0.0318302387267905, -0.0316666666666666, -0.0315586914688903, >> >> -0.0312606184165817, -0.030881017257039, -0.0308764940239045, >> >> -0.0305419952434597, -0.030406198638178, -0.0299651567944252, >> >> -0.029945999018164, -0.0298786181139121, -0.0295741147960329, >> >> -0.0293917033546227, -0.029171528588098, -0.0291327913279132, >> >> -0.0290497291974397, -0.0288721376760064, -0.0287704170466792, >> >> -0.0286236297198539, -0.0285714285714286, -0.0277575837684224, >> >> -0.0277085471338513, -0.0275897304892068, -0.0275526742301458, >> >> -0.027027027027027, -0.0270270270270269, -0.0269087523277468, >> >> -0.0268918695148203, -0.02676704307821, -0.026454253142356, >> -0.0263157894736842, >> >> -0.0263157894736842, -0.0261660978384529, -0.025974025974026, >> >> -0.0257503107796129, -0.0255319148936171, -0.0254237288135594, >> >> -0.025297619047619, -0.0249174422095467, -0.0248888888888889, >> >> -0.024767619719967, -0.0246053853296194, -0.0245269796776454, >> >> -0.024390243902439, -0.0241935483870968, -0.0238907849829351, >> >> -0.0238153295944078, -0.0234413496961306, -0.0232558139534884, >> >> -0.0232558139534883, -0.0230392156862745, -0.0230360307147077, >> >> -0.0228847365106026, -0.0225806451612903, -0.0224519940915805, >> >> -0.0214786344110332, -0.0212360867018161, -0.0205245153933865, >> >> -0.0204170602339606, -0.0200986321764215, -0.0200729927007299, >> >> -0.0199828473413379, -0.0194174757281553, -0.0193536931818183, >> >> -0.0192885771543086, -0.019222732971166, -0.0191414840759143, >> >> -0.0189573459715641, -0.0188902007083826, -0.0186903321231681, >> >> -0.0184456468273487, -0.0183066361556064, -0.0182166826462128, >> >> -0.0181149908112366, -0.0179372197309418, -0.0179172441100772, >> >> -0.0178571428571429, -0.0174672489082969, -0.0174216027874564, >> >> -0.0171428571428572, -0.017017253604349, -0.0169252468265163, >> >> -0.0165094339622642, -0.0158730158730158, -0.0158415841584159, >> >> -0.0157247037374659, -0.0157089706490286, -0.0156250000000001, >> >> -0.0153846153846153, -0.0151668351870576, -0.0151589242053789, >> >> -0.0150489089541008, -0.0150262202501008, -0.0150081124932396, >> >> -0.0148196281468128, -0.0144251166737377, -0.0142857142857142, >> >> -0.0140638734251392, -0.0136986301369863, -0.0133333333333333, >> >> -0.0129464285714286, -0.0129449838187702, -0.0127813811522321, >> >> -0.0126030053320408, -0.0125721665147373, -0.0125, -0.0122160435399906, >> >> -0.0122116689280869, -0.0121019108280255, -0.0118747750989563, >> >> -0.0118277953189996, -0.0117107942973524, -0.0115172759138707, >> >> -0.0114087997381585, -0.0113924050632912, -0.0111524163568772, >> >> -0.0111248454882571, -0.0111111111111111, -0.0102570933795125, >> >> -0.0102040816326532, -0.00963463463463469, -0.00958657878969439, >> >> -0.00941028858218319, -0.00874453466583389, -0.00779588944011335, >> >> -0.00713620850139625, -0.00710720027075056, -0.00709219858156026, >> >> -0.00624999999999998, -0.00551977920883173, -0.00521499557217353, >> >> -0.00453998797354176, -0.00444444444444444, -0.00166389351081533, >> >> -0.00118483412322285, -0.00100704934541787, -0.000937500000000036, >> >> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, >> >> 0.000218031178458569, 0.000796495420151402, 0.00167130919220062, >> >> 0.00190476190476193, 0.00350058343057173, 0.00363914958820145, >> >> 0.00432900432900424, 0.00456037942356804, 0.00477446915441642, >> >> 0.0050825509873745, 0.00525691029336935, 0.00603318250377083, >> >> 0.00652173913043472, 0.00733192494097176, 0.00747663551401869, >> >> 0.00760456273764256, 0.00812529439472442, 0.00991231414410967, >> >> 0.0101685066821615, 0.0106182565507793, 0.0109070034443169, >> 0.0115183246073298, >> >> 0.0115442244823827, 0.0127659574468085, 0.0128076846107665, >> 0.0135135135135135, >> >> 0.0140845070422535, 0.0150730098916627, 0.0159362549800796, >> 0.0172413793103449, >> >> 0.0176899063475547, 0.0186954715413378, 0.0187765706188003, >> 0.0195757403189066, >> >> 0.019607843137255, 0.0199999999999999, 0.0210526315789473, >> 0.0221979621542939, >> >> 0.0239410681399632, 0.0239999999999999, 0.025149051490515, >> 0.0260869565217392, >> >> 0.0262475696694749, 0.028180542563143, 0.0285714285714286, >> 0.0303030303030302, >> >> 0.0315904139433552, 0.0341864716636198, 0.0375782881002089, >> 0.038479809976247, >> >> 0.0387596899224806, 0.0416666666666667, 0.0428100987925357, >> 0.0428134556574923, >> >> 0.0437201907790144, 0.0451127819548872, 0.0460251046025105, >> 0.0487779511180447, >> >> 0.048975188781014, 0.0529872938632063, 0.0562390158172233, >> 0.0589335827876521, >> >> 0.0617551462621885, 0.0628115653040877, 0.0671812464265294, >> 0.0721784776902887, >> >> 0.0736842105263157, 0.0833333333333334, 0.083862394802894, >> 0.0970464135021097, >> >> 0.0971168437025795, 0.102272727272727, 0.111111111111111, >> 0.117117117117117, >> >> 0.123532699832309, 0.141304347826087, 0.179487179487179, >> 0.191268191268191, >> >> 0.205128205128205, 0.219020172910663, 0.271590909090909, 0.333333333333333 >> >> ) >> >> >> Now I want to estimate empirical PDF for interval of (-1, 1) including >> all points of Dat >> >> I have looked into the density() function, however it appears that, >> empirical density is estimated for equally distant points, which not >> necessarily contains actual supplied points (in my case, Dat) >> >> Is there any option to achieve the same? >> >> Thanks for your pointer. >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > >
On 3/11/2018 3:35 PM, Christofer Bogaso wrote:> But for my reporting purpose, I need to generate a bell curve like > plot based on empirical PDF, that also contains original points. > > Any idea would be helpful. Thanks, >Christofer, something like the following may get you what you want: ## get the kernel density estimate dens <- density(Dat) ## estimate the density at your original points dnew <- approx(dens$x,dens$y,xout=Dat) ## plot kernel density estimate plot(dx) ## add your original values with the estimated density points(dnew, pch=1, cex=0.5, col="red") Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA> On Mon, Mar 12, 2018 at 3:49 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: >> You need to re-read ?density and perhaps think again -- or do some study -- >> about how a (kernel) density estimate works. The points at which the >> estimate is calculated are *not* the values given, nor should they be! >> >> Cheers, >> Bert >> >> >> >> Bert Gunter >> >> "The trouble with having an open mind is that people keep coming along and >> sticking things into it." >> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >> >> On Sun, Mar 11, 2018 at 11:45 AM, Christofer Bogaso >> <bogaso.christofer at gmail.com> wrote: >>> >>> Hi, >>> >>> Let say I have below vector of data-points : >>> >>> Dat = c(-0.444444444444444, -0.25, -0.237449799196787, -0.227467046669042, >>> >>> -0.227454464682363, -0.22, -0.214876033057851, -0.211781206171108, >>> >>> -0.199891067538126, -0.192920353982301, -0.192307692307692, >>> -0.186046511627907, >>> >>> -0.184418145956608, -0.181818181818182, -0.181818181818182, >>> -0.181266261925412, >>> >>> -0.181003118503119, -0.179064587973274, -0.178217821782178, >>> -0.17809021675454, >>> >>> -0.177685950413223, -0.177570093457944, -0.176470588235294, >>> -0.176470588235294, >>> >>> -0.174825741611282, -0.168021680216802, -0.166666666666667, >>> -0.166666666666667, >>> >>> -0.166380789022298, -0.164209115281501, -0.164011246485473, >>> -0.162689804772234, >>> >>> -0.162361623616236, -0.160161507402423, -0.16, -0.155038759689922, >>> >>> -0.154172560113154, -0.15311004784689, -0.151515151515152, >>> -0.151462994836489, >>> >>> -0.151098901098901, -0.150537634408602, -0.150442477876106, >>> -0.150406504065041, >>> >>> -0.149904214559387, -0.149882903981265, -0.149797570850202, >>> -0.148496240601504, >>> >>> -0.148325358851675, -0.147540983606557, -0.147239263803681, >>> -0.146989966555184, >>> >>> -0.14622641509434, -0.146095717884131, -0.145994832041344, >>> -0.14572864321608, >>> >>> -0.145161290322581, -0.144292237442922, -0.144144144144144, >>> -0.144021739130435, >>> >>> -0.14375, -0.142212189616253, -0.141122913505311, -0.140324963072378, >>> >>> -0.139344262295082, -0.13884007029877, -0.138356164383562, >>> -0.137626262626263, >>> >>> -0.137142857142857, -0.136690647482014, -0.136577708006279, >>> -0.136363636363636, >>> >>> -0.136094674556213, -0.135879774577332, -0.135586319218241, >>> -0.135135135135135, >>> >>> -0.132780082987552, -0.132209405501331, -0.132023755139333, >>> -0.131233595800525, >>> >>> -0.130434782608696, -0.130434782608696, -0.130268199233717, >>> -0.128813559322034, >>> >>> -0.1284046692607, -0.128205128205128, -0.128182616330114, >>> -0.127937336814621, >>> >>> -0.126283367556468, -0.125853658536585, -0.125448028673835, >>> -0.125425564840607, >>> >>> -0.125311203319502, -0.125, -0.124401913875598, -0.124248496993988, >>> >>> -0.124031007751938, -0.123572170301142, -0.123188405797102, >>> -0.122905027932961, >>> >>> -0.121666666666667, -0.121573685907772, -0.120658135283364, >>> -0.120540019286403, >>> >>> -0.119858156028369, -0.11965811965812, -0.11965811965812, >>> -0.119565217391304, >>> >>> -0.118942731277533, -0.117820324005891, -0.116257947320618, >>> -0.115789473684211, >>> >>> -0.115683584819387, -0.115384615384615, -0.115281501340483, >>> -0.114492753623188, >>> >>> -0.114357262103506, -0.114285714285714, -0.114035087719298, >>> -0.113181972212809, >>> >>> -0.112790697674419, -0.112781954887218, -0.112195121951219, >>> -0.112191473448018, >>> >>> -0.111111111111111, -0.111111111111111, -0.110813226094727, >>> -0.110384300899428, >>> >>> -0.110147441457069, -0.110137672090113, -0.109913793103448, >>> -0.109792284866469, >>> >>> -0.109375, -0.10919540229885, -0.109112709832134, -0.10844250363901, >>> >>> -0.107776617954071, -0.10752688172043, -0.107317073170732, >>> -0.106674272675414, >>> >>> -0.106382978723404, -0.106100795755968, -0.106060606060606, >>> -0.10595160235448, >>> >>> -0.105742474070326, -0.105263157894737, -0.104454685099846, >>> -0.104283054003724, >>> >>> -0.103916449086162, -0.103723404255319, -0.103448275862069, >>> -0.102737680438029, >>> >>> -0.10267471958585, -0.101696871753434, -0.100893997445721, >>> -0.10041265474553, >>> >>> -0.100042983021706, -0.1, -0.0995111731843576, -0.099502487562189, >>> >>> -0.0994117647058824, -0.0991561181434598, -0.0989492119089317, >>> >>> -0.0988372093023255, -0.0983908045977012, -0.0983050847457627, >>> >>> -0.0977198697068404, -0.0974702380952382, -0.0973819695475956, >>> >>> -0.097345132743363, -0.0971472629144179, -0.0971438645980254, >>> >>> -0.0961538461538461, -0.096062667491239, -0.0957347238935687, >>> >>> -0.0956521739130435, -0.0954773869346733, -0.0954115076474873, >>> >>> -0.0952380952380952, -0.0951115834218915, -0.0950642007303569, >>> >>> -0.0949423247559894, -0.0947368421052631, -0.0946291560102303, >>> >>> -0.0945220193340494, -0.0944309927360775, -0.0943016759776536, >>> >>> -0.0942720763723149, -0.0941770647653002, -0.0940298507462686, >>> >>> -0.094017094017094, -0.0935672514619884, -0.0934579439252337, >>> >>> -0.0930232558139535, -0.0929772502472798, -0.0929054054054054, >>> >>> -0.0928778745255637, -0.0927700348432055, -0.0925266903914591, >>> >>> -0.0922502666192677, -0.0918094218415418, -0.0915254237288135, >>> >>> -0.0914774596906876, -0.0914662894860915, -0.0914285714285715, >>> >>> -0.0912322274881517, -0.090909090909091, -0.0909090909090909, >>> >>> -0.09079754601227, -0.0907071455016661, -0.0906593406593406, >>> >>> -0.0903614457831325, -0.0903323548906352, -0.09, -0.0897243107769424, >>> >>> -0.0896358543417368, -0.0895522388059702, -0.0895052902487847, >>> >>> -0.0891719745222929, -0.0888888888888888, -0.0887227819304518, >>> >>> -0.0887096774193548, -0.0886956521739131, -0.0884703196347032, >>> >>> -0.0884450784593437, -0.0884413309982488, -0.0883577310155536, >>> >>> -0.0883054892601431, -0.0882917466410749, -0.0881628999776236, >>> >>> -0.0881193929739248, -0.0880681818181819, -0.0878186968838525, >>> >>> -0.087719298245614, -0.0876010781671159, -0.0873634945397815, >>> >>> -0.0872641509433961, -0.0871512228728901, -0.0871032050299035, >>> >>> -0.0868133772309825, -0.0865384615384615, -0.0858895705521473, >>> >>> -0.085742525327403, -0.0855766209280403, -0.0854700854700855, >>> >>> -0.0853994490358125, -0.0853658536585365, -0.0851063829787235, >>> >>> -0.085048426150121, -0.0849673202614379, -0.084862385321101, >>> >>> -0.0843335637529065, -0.0843222985633979, -0.084315503173164, >>> >>> -0.0842105263157896, -0.0841423948220064, -0.0838323353293414, >>> >>> -0.0836501901140684, -0.083422459893048, -0.0833333333333334, >>> >>> -0.0833333333333333, -0.0827236916150815, -0.0826723611958512, >>> >>> -0.0826039387308535, -0.0824242424242424, -0.0821513002364065, >>> >>> -0.0820932539682539, -0.0820713238886174, -0.0818181818181818, >>> >>> -0.0816618911174786, -0.0816613868356214, -0.0816326530612244, >>> >>> -0.081619937694704, -0.0813748531139835, -0.0811965811965812, >>> >>> -0.0810372771474878, -0.0809095716552088, -0.0808823529411764, >>> >>> -0.0808414831492295, -0.0807511737089201, -0.0805722891566266, >>> >>> -0.0803474484256242, -0.0800000000000001, -0.0800000000000001, >>> >>> -0.0799584631360333, -0.0795941847087125, -0.0795930580490723, >>> >>> -0.0794701986754966, -0.0793650793650794, -0.0791855203619909, >>> >>> -0.0790273556231002, -0.0790273556231002, -0.0789473684210527, >>> >>> -0.0789473684210526, -0.0787545787545788, -0.0787461773700307, >>> >>> -0.0786724031960664, -0.0782122905027933, -0.078177727784027, >>> >>> -0.078125, -0.0778443113772455, -0.0776310524209684, -0.0775862068965517, >>> >>> -0.0775577557755776, -0.0773930753564156, -0.0772686433063791, >>> >>> -0.0771513353115727, -0.0771200000000001, -0.0770370370370371, >>> >>> -0.076923076923077, -0.076923076923077, -0.0769039940461424, >>> >>> -0.076592082616179, -0.0763425253991292, -0.0762886597938145, >>> >>> -0.0762886597938145, -0.0761565836298932, -0.0760869565217391, >>> >>> -0.07597645799893, -0.0758377425044092, -0.0757314974182444, >>> >>> -0.0755148741418765, -0.0754814305364511, -0.0754189944134078, >>> >>> -0.0752351097178683, -0.0750988142292491, -0.074935400516796, >>> >>> -0.0748663101604277, -0.0748031496062992, -0.0747663551401868, >>> >>> -0.0747295968534907, -0.0747028862478777, -0.0745967741935485, >>> >>> -0.0741784037558686, -0.0740740740740741, -0.0740740740740741, >>> >>> -0.0740740740740741, -0.073828125, -0.0736698499317872, >>> -0.0735877862595421, >>> >>> -0.0735824009102977, -0.0735632183908046, -0.0733944954128441, >>> >>> -0.0728862973760932, -0.0728279386712096, -0.0726480203414457, >>> >>> -0.0726329442282749, -0.072632190586868, -0.0725766664070006, >>> >>> -0.0724137931034483, -0.0722664432341852, -0.0719257540603249, >>> >>> -0.0717538461538461, -0.0716612377850163, -0.0715181932245923, >>> >>> -0.0714285714285715, -0.0714285714285713, -0.0710646285867525, >>> >>> -0.0708446866485014, -0.0708117443868739, -0.0708028321132845, >>> >>> -0.0706436420722135, -0.0705325930495579, -0.0705128205128205, >>> >>> -0.0705009276437847, -0.0704043019318861, -0.0702106318956871, >>> >>> -0.0701663201663202, -0.0700661736084078, -0.0699999999999999, >>> >>> -0.0695540857691487, -0.0692979983084297, -0.0691823899371069, >>> >>> -0.0691244239631336, -0.0690335305719921, -0.0689655172413792, >>> >>> -0.0688536409516944, -0.068450039339103, -0.0682332955832389, >>> >>> -0.0682261208576998, -0.0681818181818182, -0.0679035250463822, >>> >>> -0.0679012345679012, -0.0677966101694916, -0.0676384839650145, >>> >>> -0.0675675675675676, -0.0675241157556271, -0.067463706233988, >>> >>> -0.0674584323040379, -0.0668523676880222, -0.0666666666666667, >>> >>> -0.066526455612132, -0.0664206642066421, -0.066321243523316, >>> >>> -0.0662949194547709, -0.0662579580287669, -0.0662251655629139, >>> >>> -0.0661764705882353, -0.0661478599221789, -0.0657894736842105, >>> >>> -0.0657534246575342, -0.0654481924472518, -0.0652900974262034, >>> >>> -0.0652225100070638, -0.0651126106388572, -0.0650887573964497, >>> >>> -0.0650684931506849, -0.0650195058517555, -0.0649954627949184, >>> >>> -0.0649081209247184, -0.064891846921797, -0.0648899188876013, >>> >>> -0.0648148148148149, -0.0645962732919255, -0.0644599303135888, >>> >>> -0.0644171779141105, -0.0643564356435644, -0.064327485380117, >>> >>> -0.0642667310944672, -0.0641975308641976, -0.0641025641025641, >>> >>> -0.0639197041732701, -0.0638436482084691, -0.0635245901639343, >>> >>> -0.0634996041171813, -0.0632017594629008, -0.0631313131313131, >>> >>> -0.0630434782608695, -0.0629405840886203, -0.0629155024568842, >>> >>> -0.0628765060240964, -0.0628571428571429, -0.0625394819962098, >>> >>> -0.062476757158795, -0.06203552416592, -0.0620347394540943, >>> -0.0619971604354, >>> >>> -0.0619946091644204, -0.0619469026548672, -0.0619235836627141, >>> >>> -0.0618131868131868, -0.0617667356797793, -0.0617312601531677, >>> >>> -0.0616740088105726, -0.0614161849710983, -0.0613026819923372, >>> >>> -0.0612244897959185, -0.0610859728506788, -0.0610526315789473, >>> >>> -0.0610399397136398, -0.0610169491525424, -0.0609659540775929, >>> >>> -0.0608695652173912, -0.0606060606060606, -0.0606060606060606, >>> >>> -0.0604929051530994, -0.0604204204204204, -0.0603636363636364, >>> >>> -0.0602698650674663, -0.0602115541090318, -0.0599352051835853, >>> >>> -0.0599001663893511, -0.0596379126730565, -0.0594227504244482, >>> >>> -0.0587275693311581, -0.0587002096436059, -0.0586319218241041, >>> >>> -0.0586046511627907, -0.0584174190122145, -0.0584011488750599, >>> >>> -0.0583707504810776, -0.0579299691040165, -0.0579268292682926, >>> >>> -0.0579050097592712, -0.057608079558922, -0.0574712643678161, >>> >>> -0.0572450805008944, -0.0570958904109589, -0.0568263045032167, >>> >>> -0.0568181818181818, -0.0568181818181818, -0.0568031704095112, >>> >>> -0.0566301923974486, -0.0566037735849057, -0.0566037735849057, >>> >>> -0.0566037735849056, -0.0564433866031963, -0.0562770562770562, >>> >>> -0.0561576354679803, -0.0560928433268858, -0.0559006211180124, >>> >>> -0.0558213716108453, -0.055689240288759, -0.0554101893181468, >>> >>> -0.0553961597881263, -0.0553633217993079, -0.0553571428571429, >>> >>> -0.0553481577665964, -0.0553158101216163, -0.0553108174253549, >>> >>> -0.0548340548340548, -0.0546601261387525, -0.054590570719603, >>> >>> -0.0545001187366422, -0.0544511668107173, -0.0544274300932089, >>> >>> -0.0542372881355932, -0.0542168674698794, -0.0540540540540541, >>> >>> -0.053763440860215, -0.0537513997760358, -0.0536343468615424, >>> >>> -0.0535714285714286, -0.0534725518114223, -0.0529294274300931, >>> >>> -0.0528846153846155, -0.0528756957328386, -0.0526458340386634, >>> >>> -0.0526315789473684, -0.0525606469002696, -0.0525451559934318, >>> >>> -0.0525227460711332, -0.051948051948052, -0.051792828685259, >>> >>> -0.0517241379310345, -0.0513784461152881, -0.0513559322033898, >>> >>> -0.0512610211195407, -0.0512437810945274, -0.051150895140665, >>> >>> -0.0510695486616643, -0.0507726269315673, -0.0507377685736475, >>> >>> -0.0506575742815391, -0.0506024096385543, -0.0505494505494506, >>> >>> -0.0503194888178913, -0.0501567398119122, -0.05, -0.0499001996007984, >>> >>> -0.0498214285714285, -0.0497737556561087, -0.0497470489038785, >>> >>> -0.0494845360824741, -0.0493827160493827, -0.0492157923201731, >>> >>> -0.0491192897035657, -0.0489642184557439, -0.0488200324265898, >>> >>> -0.0488031366075114, -0.0485151426051161, -0.0483319076133448, >>> >>> -0.0481220657276996, -0.0480897675661234, -0.0480599647266314, >>> >>> -0.0480038022813688, -0.0479900280461202, -0.0479548660084627, >>> >>> -0.0478449164776243, -0.0475638051044084, -0.0475342709631477, >>> >>> -0.0473213579172271, -0.0472997462848857, -0.0472050636772667, >>> >>> -0.046890780551147, -0.0467625899280576, -0.046753107010276, >>> >>> -0.0466592011944754, -0.0465772759350741, -0.0465753424657535, >>> >>> -0.0464333781965007, -0.0463888365076373, -0.0463215258855587, >>> >>> -0.046281851274051, -0.0459946060208471, -0.0458715596330275, >>> >>> -0.0458563535911603, -0.0457367549668873, -0.0456500165398611, >>> >>> -0.0454373701114679, -0.0454265548766046, -0.0454183266932271, >>> >>> -0.045213508233324, -0.045182571340902, -0.0451018428709989, >>> >>> -0.0451018428709989, -0.044955044955045, -0.0444136016655101, >>> >>> -0.0443722943722945, -0.0442996742671011, -0.0442477876106195, >>> >>> -0.0442477876106195, -0.0441176470588236, -0.043982895540623, >>> >>> -0.0438184663536776, -0.0436363636363636, -0.043261231281198, >>> >>> -0.0432218514782339, -0.0431654676258993, -0.0424336600525938, >>> >>> -0.0423429781227946, -0.0423387096774193, -0.0420711974110032, >>> >>> -0.0420083118050095, -0.0420032310177707, -0.0417256011315418, >>> >>> -0.0416842105263158, -0.0416141235813367, -0.0414593698175788, >>> >>> -0.0413793103448276, -0.041320942582144, -0.0407865986890023, >>> >>> -0.0406158747013539, -0.0405803571428572, -0.0405643738977073, >>> >>> -0.040422053796998, -0.040268456375839, -0.0400500625782228, >>> >>> -0.0400449101796407, -0.04, -0.0399718147460123, -0.0399137001078749, >>> >>> -0.0399044464954666, -0.0398863290368415, -0.0398230088495575, >>> >>> -0.0394736842105263, -0.0393401015228426, -0.0392720306513411, >>> >>> -0.0392156862745098, -0.0388349514563106, -0.0386904761904763, >>> >>> -0.0384615384615385, -0.0382457345700217, -0.0382293762575454, >>> >>> -0.0381840048105834, -0.0380030474141795, -0.0379746835443038, >>> >>> -0.0379247280777747, -0.0376432078559739, -0.0375494071146245, >>> >>> -0.0375490837696336, -0.0373345788572318, -0.0372940156114484, >>> >>> -0.0371871275327772, -0.037037037037037, -0.0368133174791915, >>> >>> -0.0368098159509203, -0.0367231638418078, -0.0361445783132531, >>> >>> -0.0360915492957746, -0.0357142857142857, -0.0356663184599313, >>> >>> -0.0356413696552528, -0.035513103110458, -0.0353194103194103, >>> >>> -0.0352112676056338, -0.0350119904076739, -0.0349794238683129, >>> >>> -0.0349373764007909, -0.0349091600875106, -0.0347826086956522, >>> >>> -0.0347728547392037, -0.0347682119205298, -0.0346083788706739, >>> >>> -0.0344706296166022, -0.0344421548425081, -0.0341176470588236, >>> >>> -0.0338983050847458, -0.033457249070632, -0.0334208223972004, >>> >>> -0.0333333333333334, -0.0333333333333333, -0.0329670329670331, >>> >>> -0.0329144225014961, -0.0326797385620915, -0.0323033707865168, >>> >>> -0.0322118826055834, -0.0321750321750322, -0.0320890635232481, >>> >>> -0.0318302387267905, -0.0316666666666666, -0.0315586914688903, >>> >>> -0.0312606184165817, -0.030881017257039, -0.0308764940239045, >>> >>> -0.0305419952434597, -0.030406198638178, -0.0299651567944252, >>> >>> -0.029945999018164, -0.0298786181139121, -0.0295741147960329, >>> >>> -0.0293917033546227, -0.029171528588098, -0.0291327913279132, >>> >>> -0.0290497291974397, -0.0288721376760064, -0.0287704170466792, >>> >>> -0.0286236297198539, -0.0285714285714286, -0.0277575837684224, >>> >>> -0.0277085471338513, -0.0275897304892068, -0.0275526742301458, >>> >>> -0.027027027027027, -0.0270270270270269, -0.0269087523277468, >>> >>> -0.0268918695148203, -0.02676704307821, -0.026454253142356, >>> -0.0263157894736842, >>> >>> -0.0263157894736842, -0.0261660978384529, -0.025974025974026, >>> >>> -0.0257503107796129, -0.0255319148936171, -0.0254237288135594, >>> >>> -0.025297619047619, -0.0249174422095467, -0.0248888888888889, >>> >>> -0.024767619719967, -0.0246053853296194, -0.0245269796776454, >>> >>> -0.024390243902439, -0.0241935483870968, -0.0238907849829351, >>> >>> -0.0238153295944078, -0.0234413496961306, -0.0232558139534884, >>> >>> -0.0232558139534883, -0.0230392156862745, -0.0230360307147077, >>> >>> -0.0228847365106026, -0.0225806451612903, -0.0224519940915805, >>> >>> -0.0214786344110332, -0.0212360867018161, -0.0205245153933865, >>> >>> -0.0204170602339606, -0.0200986321764215, -0.0200729927007299, >>> >>> -0.0199828473413379, -0.0194174757281553, -0.0193536931818183, >>> >>> -0.0192885771543086, -0.019222732971166, -0.0191414840759143, >>> >>> -0.0189573459715641, -0.0188902007083826, -0.0186903321231681, >>> >>> -0.0184456468273487, -0.0183066361556064, -0.0182166826462128, >>> >>> -0.0181149908112366, -0.0179372197309418, -0.0179172441100772, >>> >>> -0.0178571428571429, -0.0174672489082969, -0.0174216027874564, >>> >>> -0.0171428571428572, -0.017017253604349, -0.0169252468265163, >>> >>> -0.0165094339622642, -0.0158730158730158, -0.0158415841584159, >>> >>> -0.0157247037374659, -0.0157089706490286, -0.0156250000000001, >>> >>> -0.0153846153846153, -0.0151668351870576, -0.0151589242053789, >>> >>> -0.0150489089541008, -0.0150262202501008, -0.0150081124932396, >>> >>> -0.0148196281468128, -0.0144251166737377, -0.0142857142857142, >>> >>> -0.0140638734251392, -0.0136986301369863, -0.0133333333333333, >>> >>> -0.0129464285714286, -0.0129449838187702, -0.0127813811522321, >>> >>> -0.0126030053320408, -0.0125721665147373, -0.0125, -0.0122160435399906, >>> >>> -0.0122116689280869, -0.0121019108280255, -0.0118747750989563, >>> >>> -0.0118277953189996, -0.0117107942973524, -0.0115172759138707, >>> >>> -0.0114087997381585, -0.0113924050632912, -0.0111524163568772, >>> >>> -0.0111248454882571, -0.0111111111111111, -0.0102570933795125, >>> >>> -0.0102040816326532, -0.00963463463463469, -0.00958657878969439, >>> >>> -0.00941028858218319, -0.00874453466583389, -0.00779588944011335, >>> >>> -0.00713620850139625, -0.00710720027075056, -0.00709219858156026, >>> >>> -0.00624999999999998, -0.00551977920883173, -0.00521499557217353, >>> >>> -0.00453998797354176, -0.00444444444444444, -0.00166389351081533, >>> >>> -0.00118483412322285, -0.00100704934541787, -0.000937500000000036, >>> >>> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, >>> >>> 0.000218031178458569, 0.000796495420151402, 0.00167130919220062, >>> >>> 0.00190476190476193, 0.00350058343057173, 0.00363914958820145, >>> >>> 0.00432900432900424, 0.00456037942356804, 0.00477446915441642, >>> >>> 0.0050825509873745, 0.00525691029336935, 0.00603318250377083, >>> >>> 0.00652173913043472, 0.00733192494097176, 0.00747663551401869, >>> >>> 0.00760456273764256, 0.00812529439472442, 0.00991231414410967, >>> >>> 0.0101685066821615, 0.0106182565507793, 0.0109070034443169, >>> 0.0115183246073298, >>> >>> 0.0115442244823827, 0.0127659574468085, 0.0128076846107665, >>> 0.0135135135135135, >>> >>> 0.0140845070422535, 0.0150730098916627, 0.0159362549800796, >>> 0.0172413793103449, >>> >>> 0.0176899063475547, 0.0186954715413378, 0.0187765706188003, >>> 0.0195757403189066, >>> >>> 0.019607843137255, 0.0199999999999999, 0.0210526315789473, >>> 0.0221979621542939, >>> >>> 0.0239410681399632, 0.0239999999999999, 0.025149051490515, >>> 0.0260869565217392, >>> >>> 0.0262475696694749, 0.028180542563143, 0.0285714285714286, >>> 0.0303030303030302, >>> >>> 0.0315904139433552, 0.0341864716636198, 0.0375782881002089, >>> 0.038479809976247, >>> >>> 0.0387596899224806, 0.0416666666666667, 0.0428100987925357, >>> 0.0428134556574923, >>> >>> 0.0437201907790144, 0.0451127819548872, 0.0460251046025105, >>> 0.0487779511180447, >>> >>> 0.048975188781014, 0.0529872938632063, 0.0562390158172233, >>> 0.0589335827876521, >>> >>> 0.0617551462621885, 0.0628115653040877, 0.0671812464265294, >>> 0.0721784776902887, >>> >>> 0.0736842105263157, 0.0833333333333334, 0.083862394802894, >>> 0.0970464135021097, >>> >>> 0.0971168437025795, 0.102272727272727, 0.111111111111111, >>> 0.117117117117117, >>> >>> 0.123532699832309, 0.141304347826087, 0.179487179487179, >>> 0.191268191268191, >>> >>> 0.205128205128205, 0.219020172910663, 0.271590909090909, 0.333333333333333 >>> >>> ) >>> >>> >>> Now I want to estimate empirical PDF for interval of (-1, 1) including >>> all points of Dat >>> >>> I have looked into the density() function, however it appears that, >>> empirical density is estimated for equally distant points, which not >>> necessarily contains actual supplied points (in my case, Dat) >>> >>> Is there any option to achieve the same? >>> >>> Thanks for your pointer. >>> >>> ______________________________________________ >>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
cwhmisc package provides essentially the algorithm outlined by Dan. If you want answers outside your original data (extrapolation) then the following code at least won't give broken answers, though it is not necessarily any more "correct" for extrapolation than the approx solution is. Regarding "needing this for reporting", do thoroughly read ?density as Bert suggested, because the bandwidth parameter affects your answers and there are various historical recommendations for choosing possible bandwidth values, and really no "right" answer. ############ smoothed.df2 <- function ( d ) { F <- cumsum( d$y ) F <- F / F[ length( F ) ] * ( length( F ) - 0.5 ) / length( F ) eF <- splinefun( d$x, qlogis( F ), "monoH.FC" ) function( x ) { efx <- eF( x ) plogis( efx ) } } set.seed( 42 ) Dat <- c( rnorm( 100, 1 ), rnorm( 100, 5 ) ) d <- density( Dat ) CDF1 <- cwhmisc::smoothed.df( d ) plot( Dat, CDF1( Dat ) ) CDF2 <- smoothed.df2( d ) plot( Dat, CDF2( Dat ) ) CDF1( -5 ) # <0 CDF2( -5 ) # >0 ############ On Sun, 11 Mar 2018, Daniel Nordlund wrote:> On 3/11/2018 3:35 PM, Christofer Bogaso wrote: >> But for my reporting purpose, I need to generate a bell curve like >> plot based on empirical PDF, that also contains original points. >> >> Any idea would be helpful. Thanks, >> > > > Christofer, > > something like the following may get you what you want: > > ## get the kernel density estimate > dens <- density(Dat) > > ## estimate the density at your original points > dnew <- approx(dens$x,dens$y,xout=Dat) > > ## plot kernel density estimate > plot(dx) > > ## add your original values with the estimated density > points(dnew, pch=1, cex=0.5, col="red") > > > Hope this is helpful, > > Dan > > -- > Daniel Nordlund > Port Townsend, WA USA > >> On Mon, Mar 12, 2018 at 3:49 AM, Bert Gunter <bgunter.4567 at gmail.com> >> wrote: >>> You need to re-read ?density and perhaps think again -- or do some study >>> -- >>> about how a (kernel) density estimate works. The points at which the >>> estimate is calculated are *not* the values given, nor should they be! >>> >>> Cheers, >>> Bert >>> >>> >>> >>> Bert Gunter >>> >>> "The trouble with having an open mind is that people keep coming along and >>> sticking things into it." >>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >>> >>> On Sun, Mar 11, 2018 at 11:45 AM, Christofer Bogaso >>> <bogaso.christofer at gmail.com> wrote: >>>> >>>> Hi, >>>> >>>> Let say I have below vector of data-points : >>>> >>>> Dat = c(-0.444444444444444, -0.25, -0.237449799196787, >>>> -0.227467046669042, >>>> >>>> -0.227454464682363, -0.22, -0.214876033057851, -0.211781206171108, >>>> >>>> -0.199891067538126, -0.192920353982301, -0.192307692307692, >>>> -0.186046511627907, >>>> >>>> -0.184418145956608, -0.181818181818182, -0.181818181818182, >>>> -0.181266261925412, >>>> >>>> -0.181003118503119, -0.179064587973274, -0.178217821782178, >>>> -0.17809021675454, >>>> >>>> -0.177685950413223, -0.177570093457944, -0.176470588235294, >>>> -0.176470588235294, >>>> >>>> -0.174825741611282, -0.168021680216802, -0.166666666666667, >>>> -0.166666666666667, >>>> >>>> -0.166380789022298, -0.164209115281501, -0.164011246485473, >>>> -0.162689804772234, >>>> >>>> -0.162361623616236, -0.160161507402423, -0.16, -0.155038759689922, >>>> >>>> -0.154172560113154, -0.15311004784689, -0.151515151515152, >>>> -0.151462994836489, >>>> >>>> -0.151098901098901, -0.150537634408602, -0.150442477876106, >>>> -0.150406504065041, >>>> >>>> -0.149904214559387, -0.149882903981265, -0.149797570850202, >>>> -0.148496240601504, >>>> >>>> -0.148325358851675, -0.147540983606557, -0.147239263803681, >>>> -0.146989966555184, >>>> >>>> -0.14622641509434, -0.146095717884131, -0.145994832041344, >>>> -0.14572864321608, >>>> >>>> -0.145161290322581, -0.144292237442922, -0.144144144144144, >>>> -0.144021739130435, >>>> >>>> -0.14375, -0.142212189616253, -0.141122913505311, -0.140324963072378, >>>> >>>> -0.139344262295082, -0.13884007029877, -0.138356164383562, >>>> -0.137626262626263, >>>> >>>> -0.137142857142857, -0.136690647482014, -0.136577708006279, >>>> -0.136363636363636, >>>> >>>> -0.136094674556213, -0.135879774577332, -0.135586319218241, >>>> -0.135135135135135, >>>> >>>> -0.132780082987552, -0.132209405501331, -0.132023755139333, >>>> -0.131233595800525, >>>> >>>> -0.130434782608696, -0.130434782608696, -0.130268199233717, >>>> -0.128813559322034, >>>> >>>> -0.1284046692607, -0.128205128205128, -0.128182616330114, >>>> -0.127937336814621, >>>> >>>> -0.126283367556468, -0.125853658536585, -0.125448028673835, >>>> -0.125425564840607, >>>> >>>> -0.125311203319502, -0.125, -0.124401913875598, -0.124248496993988, >>>> >>>> -0.124031007751938, -0.123572170301142, -0.123188405797102, >>>> -0.122905027932961, >>>> >>>> -0.121666666666667, -0.121573685907772, -0.120658135283364, >>>> -0.120540019286403, >>>> >>>> -0.119858156028369, -0.11965811965812, -0.11965811965812, >>>> -0.119565217391304, >>>> >>>> -0.118942731277533, -0.117820324005891, -0.116257947320618, >>>> -0.115789473684211, >>>> >>>> -0.115683584819387, -0.115384615384615, -0.115281501340483, >>>> -0.114492753623188, >>>> >>>> -0.114357262103506, -0.114285714285714, -0.114035087719298, >>>> -0.113181972212809, >>>> >>>> -0.112790697674419, -0.112781954887218, -0.112195121951219, >>>> -0.112191473448018, >>>> >>>> -0.111111111111111, -0.111111111111111, -0.110813226094727, >>>> -0.110384300899428, >>>> >>>> -0.110147441457069, -0.110137672090113, -0.109913793103448, >>>> -0.109792284866469, >>>> >>>> -0.109375, -0.10919540229885, -0.109112709832134, -0.10844250363901, >>>> >>>> -0.107776617954071, -0.10752688172043, -0.107317073170732, >>>> -0.106674272675414, >>>> >>>> -0.106382978723404, -0.106100795755968, -0.106060606060606, >>>> -0.10595160235448, >>>> >>>> -0.105742474070326, -0.105263157894737, -0.104454685099846, >>>> -0.104283054003724, >>>> >>>> -0.103916449086162, -0.103723404255319, -0.103448275862069, >>>> -0.102737680438029, >>>> >>>> -0.10267471958585, -0.101696871753434, -0.100893997445721, >>>> -0.10041265474553, >>>> >>>> -0.100042983021706, -0.1, -0.0995111731843576, -0.099502487562189, >>>> >>>> -0.0994117647058824, -0.0991561181434598, -0.0989492119089317, >>>> >>>> -0.0988372093023255, -0.0983908045977012, -0.0983050847457627, >>>> >>>> -0.0977198697068404, -0.0974702380952382, -0.0973819695475956, >>>> >>>> -0.097345132743363, -0.0971472629144179, -0.0971438645980254, >>>> >>>> -0.0961538461538461, -0.096062667491239, -0.0957347238935687, >>>> >>>> -0.0956521739130435, -0.0954773869346733, -0.0954115076474873, >>>> >>>> -0.0952380952380952, -0.0951115834218915, -0.0950642007303569, >>>> >>>> -0.0949423247559894, -0.0947368421052631, -0.0946291560102303, >>>> >>>> -0.0945220193340494, -0.0944309927360775, -0.0943016759776536, >>>> >>>> -0.0942720763723149, -0.0941770647653002, -0.0940298507462686, >>>> >>>> -0.094017094017094, -0.0935672514619884, -0.0934579439252337, >>>> >>>> -0.0930232558139535, -0.0929772502472798, -0.0929054054054054, >>>> >>>> -0.0928778745255637, -0.0927700348432055, -0.0925266903914591, >>>> >>>> -0.0922502666192677, -0.0918094218415418, -0.0915254237288135, >>>> >>>> -0.0914774596906876, -0.0914662894860915, -0.0914285714285715, >>>> >>>> -0.0912322274881517, -0.090909090909091, -0.0909090909090909, >>>> >>>> -0.09079754601227, -0.0907071455016661, -0.0906593406593406, >>>> >>>> -0.0903614457831325, -0.0903323548906352, -0.09, -0.0897243107769424, >>>> >>>> -0.0896358543417368, -0.0895522388059702, -0.0895052902487847, >>>> >>>> -0.0891719745222929, -0.0888888888888888, -0.0887227819304518, >>>> >>>> -0.0887096774193548, -0.0886956521739131, -0.0884703196347032, >>>> >>>> -0.0884450784593437, -0.0884413309982488, -0.0883577310155536, >>>> >>>> -0.0883054892601431, -0.0882917466410749, -0.0881628999776236, >>>> >>>> -0.0881193929739248, -0.0880681818181819, -0.0878186968838525, >>>> >>>> -0.087719298245614, -0.0876010781671159, -0.0873634945397815, >>>> >>>> -0.0872641509433961, -0.0871512228728901, -0.0871032050299035, >>>> >>>> -0.0868133772309825, -0.0865384615384615, -0.0858895705521473, >>>> >>>> -0.085742525327403, -0.0855766209280403, -0.0854700854700855, >>>> >>>> -0.0853994490358125, -0.0853658536585365, -0.0851063829787235, >>>> >>>> -0.085048426150121, -0.0849673202614379, -0.084862385321101, >>>> >>>> -0.0843335637529065, -0.0843222985633979, -0.084315503173164, >>>> >>>> -0.0842105263157896, -0.0841423948220064, -0.0838323353293414, >>>> >>>> -0.0836501901140684, -0.083422459893048, -0.0833333333333334, >>>> >>>> -0.0833333333333333, -0.0827236916150815, -0.0826723611958512, >>>> >>>> -0.0826039387308535, -0.0824242424242424, -0.0821513002364065, >>>> >>>> -0.0820932539682539, -0.0820713238886174, -0.0818181818181818, >>>> >>>> -0.0816618911174786, -0.0816613868356214, -0.0816326530612244, >>>> >>>> -0.081619937694704, -0.0813748531139835, -0.0811965811965812, >>>> >>>> -0.0810372771474878, -0.0809095716552088, -0.0808823529411764, >>>> >>>> -0.0808414831492295, -0.0807511737089201, -0.0805722891566266, >>>> >>>> -0.0803474484256242, -0.0800000000000001, -0.0800000000000001, >>>> >>>> -0.0799584631360333, -0.0795941847087125, -0.0795930580490723, >>>> >>>> -0.0794701986754966, -0.0793650793650794, -0.0791855203619909, >>>> >>>> -0.0790273556231002, -0.0790273556231002, -0.0789473684210527, >>>> >>>> -0.0789473684210526, -0.0787545787545788, -0.0787461773700307, >>>> >>>> -0.0786724031960664, -0.0782122905027933, -0.078177727784027, >>>> >>>> -0.078125, -0.0778443113772455, -0.0776310524209684, -0.0775862068965517, >>>> >>>> -0.0775577557755776, -0.0773930753564156, -0.0772686433063791, >>>> >>>> -0.0771513353115727, -0.0771200000000001, -0.0770370370370371, >>>> >>>> -0.076923076923077, -0.076923076923077, -0.0769039940461424, >>>> >>>> -0.076592082616179, -0.0763425253991292, -0.0762886597938145, >>>> >>>> -0.0762886597938145, -0.0761565836298932, -0.0760869565217391, >>>> >>>> -0.07597645799893, -0.0758377425044092, -0.0757314974182444, >>>> >>>> -0.0755148741418765, -0.0754814305364511, -0.0754189944134078, >>>> >>>> -0.0752351097178683, -0.0750988142292491, -0.074935400516796, >>>> >>>> -0.0748663101604277, -0.0748031496062992, -0.0747663551401868, >>>> >>>> -0.0747295968534907, -0.0747028862478777, -0.0745967741935485, >>>> >>>> -0.0741784037558686, -0.0740740740740741, -0.0740740740740741, >>>> >>>> -0.0740740740740741, -0.073828125, -0.0736698499317872, >>>> -0.0735877862595421, >>>> >>>> -0.0735824009102977, -0.0735632183908046, -0.0733944954128441, >>>> >>>> -0.0728862973760932, -0.0728279386712096, -0.0726480203414457, >>>> >>>> -0.0726329442282749, -0.072632190586868, -0.0725766664070006, >>>> >>>> -0.0724137931034483, -0.0722664432341852, -0.0719257540603249, >>>> >>>> -0.0717538461538461, -0.0716612377850163, -0.0715181932245923, >>>> >>>> -0.0714285714285715, -0.0714285714285713, -0.0710646285867525, >>>> >>>> -0.0708446866485014, -0.0708117443868739, -0.0708028321132845, >>>> >>>> -0.0706436420722135, -0.0705325930495579, -0.0705128205128205, >>>> >>>> -0.0705009276437847, -0.0704043019318861, -0.0702106318956871, >>>> >>>> -0.0701663201663202, -0.0700661736084078, -0.0699999999999999, >>>> >>>> -0.0695540857691487, -0.0692979983084297, -0.0691823899371069, >>>> >>>> -0.0691244239631336, -0.0690335305719921, -0.0689655172413792, >>>> >>>> -0.0688536409516944, -0.068450039339103, -0.0682332955832389, >>>> >>>> -0.0682261208576998, -0.0681818181818182, -0.0679035250463822, >>>> >>>> -0.0679012345679012, -0.0677966101694916, -0.0676384839650145, >>>> >>>> -0.0675675675675676, -0.0675241157556271, -0.067463706233988, >>>> >>>> -0.0674584323040379, -0.0668523676880222, -0.0666666666666667, >>>> >>>> -0.066526455612132, -0.0664206642066421, -0.066321243523316, >>>> >>>> -0.0662949194547709, -0.0662579580287669, -0.0662251655629139, >>>> >>>> -0.0661764705882353, -0.0661478599221789, -0.0657894736842105, >>>> >>>> -0.0657534246575342, -0.0654481924472518, -0.0652900974262034, >>>> >>>> -0.0652225100070638, -0.0651126106388572, -0.0650887573964497, >>>> >>>> -0.0650684931506849, -0.0650195058517555, -0.0649954627949184, >>>> >>>> -0.0649081209247184, -0.064891846921797, -0.0648899188876013, >>>> >>>> -0.0648148148148149, -0.0645962732919255, -0.0644599303135888, >>>> >>>> -0.0644171779141105, -0.0643564356435644, -0.064327485380117, >>>> >>>> -0.0642667310944672, -0.0641975308641976, -0.0641025641025641, >>>> >>>> -0.0639197041732701, -0.0638436482084691, -0.0635245901639343, >>>> >>>> -0.0634996041171813, -0.0632017594629008, -0.0631313131313131, >>>> >>>> -0.0630434782608695, -0.0629405840886203, -0.0629155024568842, >>>> >>>> -0.0628765060240964, -0.0628571428571429, -0.0625394819962098, >>>> >>>> -0.062476757158795, -0.06203552416592, -0.0620347394540943, >>>> -0.0619971604354, >>>> >>>> -0.0619946091644204, -0.0619469026548672, -0.0619235836627141, >>>> >>>> -0.0618131868131868, -0.0617667356797793, -0.0617312601531677, >>>> >>>> -0.0616740088105726, -0.0614161849710983, -0.0613026819923372, >>>> >>>> -0.0612244897959185, -0.0610859728506788, -0.0610526315789473, >>>> >>>> -0.0610399397136398, -0.0610169491525424, -0.0609659540775929, >>>> >>>> -0.0608695652173912, -0.0606060606060606, -0.0606060606060606, >>>> >>>> -0.0604929051530994, -0.0604204204204204, -0.0603636363636364, >>>> >>>> -0.0602698650674663, -0.0602115541090318, -0.0599352051835853, >>>> >>>> -0.0599001663893511, -0.0596379126730565, -0.0594227504244482, >>>> >>>> -0.0587275693311581, -0.0587002096436059, -0.0586319218241041, >>>> >>>> -0.0586046511627907, -0.0584174190122145, -0.0584011488750599, >>>> >>>> -0.0583707504810776, -0.0579299691040165, -0.0579268292682926, >>>> >>>> -0.0579050097592712, -0.057608079558922, -0.0574712643678161, >>>> >>>> -0.0572450805008944, -0.0570958904109589, -0.0568263045032167, >>>> >>>> -0.0568181818181818, -0.0568181818181818, -0.0568031704095112, >>>> >>>> -0.0566301923974486, -0.0566037735849057, -0.0566037735849057, >>>> >>>> -0.0566037735849056, -0.0564433866031963, -0.0562770562770562, >>>> >>>> -0.0561576354679803, -0.0560928433268858, -0.0559006211180124, >>>> >>>> -0.0558213716108453, -0.055689240288759, -0.0554101893181468, >>>> >>>> -0.0553961597881263, -0.0553633217993079, -0.0553571428571429, >>>> >>>> -0.0553481577665964, -0.0553158101216163, -0.0553108174253549, >>>> >>>> -0.0548340548340548, -0.0546601261387525, -0.054590570719603, >>>> >>>> -0.0545001187366422, -0.0544511668107173, -0.0544274300932089, >>>> >>>> -0.0542372881355932, -0.0542168674698794, -0.0540540540540541, >>>> >>>> -0.053763440860215, -0.0537513997760358, -0.0536343468615424, >>>> >>>> -0.0535714285714286, -0.0534725518114223, -0.0529294274300931, >>>> >>>> -0.0528846153846155, -0.0528756957328386, -0.0526458340386634, >>>> >>>> -0.0526315789473684, -0.0525606469002696, -0.0525451559934318, >>>> >>>> -0.0525227460711332, -0.051948051948052, -0.051792828685259, >>>> >>>> -0.0517241379310345, -0.0513784461152881, -0.0513559322033898, >>>> >>>> -0.0512610211195407, -0.0512437810945274, -0.051150895140665, >>>> >>>> -0.0510695486616643, -0.0507726269315673, -0.0507377685736475, >>>> >>>> -0.0506575742815391, -0.0506024096385543, -0.0505494505494506, >>>> >>>> -0.0503194888178913, -0.0501567398119122, -0.05, -0.0499001996007984, >>>> >>>> -0.0498214285714285, -0.0497737556561087, -0.0497470489038785, >>>> >>>> -0.0494845360824741, -0.0493827160493827, -0.0492157923201731, >>>> >>>> -0.0491192897035657, -0.0489642184557439, -0.0488200324265898, >>>> >>>> -0.0488031366075114, -0.0485151426051161, -0.0483319076133448, >>>> >>>> -0.0481220657276996, -0.0480897675661234, -0.0480599647266314, >>>> >>>> -0.0480038022813688, -0.0479900280461202, -0.0479548660084627, >>>> >>>> -0.0478449164776243, -0.0475638051044084, -0.0475342709631477, >>>> >>>> -0.0473213579172271, -0.0472997462848857, -0.0472050636772667, >>>> >>>> -0.046890780551147, -0.0467625899280576, -0.046753107010276, >>>> >>>> -0.0466592011944754, -0.0465772759350741, -0.0465753424657535, >>>> >>>> -0.0464333781965007, -0.0463888365076373, -0.0463215258855587, >>>> >>>> -0.046281851274051, -0.0459946060208471, -0.0458715596330275, >>>> >>>> -0.0458563535911603, -0.0457367549668873, -0.0456500165398611, >>>> >>>> -0.0454373701114679, -0.0454265548766046, -0.0454183266932271, >>>> >>>> -0.045213508233324, -0.045182571340902, -0.0451018428709989, >>>> >>>> -0.0451018428709989, -0.044955044955045, -0.0444136016655101, >>>> >>>> -0.0443722943722945, -0.0442996742671011, -0.0442477876106195, >>>> >>>> -0.0442477876106195, -0.0441176470588236, -0.043982895540623, >>>> >>>> -0.0438184663536776, -0.0436363636363636, -0.043261231281198, >>>> >>>> -0.0432218514782339, -0.0431654676258993, -0.0424336600525938, >>>> >>>> -0.0423429781227946, -0.0423387096774193, -0.0420711974110032, >>>> >>>> -0.0420083118050095, -0.0420032310177707, -0.0417256011315418, >>>> >>>> -0.0416842105263158, -0.0416141235813367, -0.0414593698175788, >>>> >>>> -0.0413793103448276, -0.041320942582144, -0.0407865986890023, >>>> >>>> -0.0406158747013539, -0.0405803571428572, -0.0405643738977073, >>>> >>>> -0.040422053796998, -0.040268456375839, -0.0400500625782228, >>>> >>>> -0.0400449101796407, -0.04, -0.0399718147460123, -0.0399137001078749, >>>> >>>> -0.0399044464954666, -0.0398863290368415, -0.0398230088495575, >>>> >>>> -0.0394736842105263, -0.0393401015228426, -0.0392720306513411, >>>> >>>> -0.0392156862745098, -0.0388349514563106, -0.0386904761904763, >>>> >>>> -0.0384615384615385, -0.0382457345700217, -0.0382293762575454, >>>> >>>> -0.0381840048105834, -0.0380030474141795, -0.0379746835443038, >>>> >>>> -0.0379247280777747, -0.0376432078559739, -0.0375494071146245, >>>> >>>> -0.0375490837696336, -0.0373345788572318, -0.0372940156114484, >>>> >>>> -0.0371871275327772, -0.037037037037037, -0.0368133174791915, >>>> >>>> -0.0368098159509203, -0.0367231638418078, -0.0361445783132531, >>>> >>>> -0.0360915492957746, -0.0357142857142857, -0.0356663184599313, >>>> >>>> -0.0356413696552528, -0.035513103110458, -0.0353194103194103, >>>> >>>> -0.0352112676056338, -0.0350119904076739, -0.0349794238683129, >>>> >>>> -0.0349373764007909, -0.0349091600875106, -0.0347826086956522, >>>> >>>> -0.0347728547392037, -0.0347682119205298, -0.0346083788706739, >>>> >>>> -0.0344706296166022, -0.0344421548425081, -0.0341176470588236, >>>> >>>> -0.0338983050847458, -0.033457249070632, -0.0334208223972004, >>>> >>>> -0.0333333333333334, -0.0333333333333333, -0.0329670329670331, >>>> >>>> -0.0329144225014961, -0.0326797385620915, -0.0323033707865168, >>>> >>>> -0.0322118826055834, -0.0321750321750322, -0.0320890635232481, >>>> >>>> -0.0318302387267905, -0.0316666666666666, -0.0315586914688903, >>>> >>>> -0.0312606184165817, -0.030881017257039, -0.0308764940239045, >>>> >>>> -0.0305419952434597, -0.030406198638178, -0.0299651567944252, >>>> >>>> -0.029945999018164, -0.0298786181139121, -0.0295741147960329, >>>> >>>> -0.0293917033546227, -0.029171528588098, -0.0291327913279132, >>>> >>>> -0.0290497291974397, -0.0288721376760064, -0.0287704170466792, >>>> >>>> -0.0286236297198539, -0.0285714285714286, -0.0277575837684224, >>>> >>>> -0.0277085471338513, -0.0275897304892068, -0.0275526742301458, >>>> >>>> -0.027027027027027, -0.0270270270270269, -0.0269087523277468, >>>> >>>> -0.0268918695148203, -0.02676704307821, -0.026454253142356, >>>> -0.0263157894736842, >>>> >>>> -0.0263157894736842, -0.0261660978384529, -0.025974025974026, >>>> >>>> -0.0257503107796129, -0.0255319148936171, -0.0254237288135594, >>>> >>>> -0.025297619047619, -0.0249174422095467, -0.0248888888888889, >>>> >>>> -0.024767619719967, -0.0246053853296194, -0.0245269796776454, >>>> >>>> -0.024390243902439, -0.0241935483870968, -0.0238907849829351, >>>> >>>> -0.0238153295944078, -0.0234413496961306, -0.0232558139534884, >>>> >>>> -0.0232558139534883, -0.0230392156862745, -0.0230360307147077, >>>> >>>> -0.0228847365106026, -0.0225806451612903, -0.0224519940915805, >>>> >>>> -0.0214786344110332, -0.0212360867018161, -0.0205245153933865, >>>> >>>> -0.0204170602339606, -0.0200986321764215, -0.0200729927007299, >>>> >>>> -0.0199828473413379, -0.0194174757281553, -0.0193536931818183, >>>> >>>> -0.0192885771543086, -0.019222732971166, -0.0191414840759143, >>>> >>>> -0.0189573459715641, -0.0188902007083826, -0.0186903321231681, >>>> >>>> -0.0184456468273487, -0.0183066361556064, -0.0182166826462128, >>>> >>>> -0.0181149908112366, -0.0179372197309418, -0.0179172441100772, >>>> >>>> -0.0178571428571429, -0.0174672489082969, -0.0174216027874564, >>>> >>>> -0.0171428571428572, -0.017017253604349, -0.0169252468265163, >>>> >>>> -0.0165094339622642, -0.0158730158730158, -0.0158415841584159, >>>> >>>> -0.0157247037374659, -0.0157089706490286, -0.0156250000000001, >>>> >>>> -0.0153846153846153, -0.0151668351870576, -0.0151589242053789, >>>> >>>> -0.0150489089541008, -0.0150262202501008, -0.0150081124932396, >>>> >>>> -0.0148196281468128, -0.0144251166737377, -0.0142857142857142, >>>> >>>> -0.0140638734251392, -0.0136986301369863, -0.0133333333333333, >>>> >>>> -0.0129464285714286, -0.0129449838187702, -0.0127813811522321, >>>> >>>> -0.0126030053320408, -0.0125721665147373, -0.0125, -0.0122160435399906, >>>> >>>> -0.0122116689280869, -0.0121019108280255, -0.0118747750989563, >>>> >>>> -0.0118277953189996, -0.0117107942973524, -0.0115172759138707, >>>> >>>> -0.0114087997381585, -0.0113924050632912, -0.0111524163568772, >>>> >>>> -0.0111248454882571, -0.0111111111111111, -0.0102570933795125, >>>> >>>> -0.0102040816326532, -0.00963463463463469, -0.00958657878969439, >>>> >>>> -0.00941028858218319, -0.00874453466583389, -0.00779588944011335, >>>> >>>> -0.00713620850139625, -0.00710720027075056, -0.00709219858156026, >>>> >>>> -0.00624999999999998, -0.00551977920883173, -0.00521499557217353, >>>> >>>> -0.00453998797354176, -0.00444444444444444, -0.00166389351081533, >>>> >>>> -0.00118483412322285, -0.00100704934541787, -0.000937500000000036, >>>> >>>> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, >>>> >>>> 0.000218031178458569, 0.000796495420151402, 0.00167130919220062, >>>> >>>> 0.00190476190476193, 0.00350058343057173, 0.00363914958820145, >>>> >>>> 0.00432900432900424, 0.00456037942356804, 0.00477446915441642, >>>> >>>> 0.0050825509873745, 0.00525691029336935, 0.00603318250377083, >>>> >>>> 0.00652173913043472, 0.00733192494097176, 0.00747663551401869, >>>> >>>> 0.00760456273764256, 0.00812529439472442, 0.00991231414410967, >>>> >>>> 0.0101685066821615, 0.0106182565507793, 0.0109070034443169, >>>> 0.0115183246073298, >>>> >>>> 0.0115442244823827, 0.0127659574468085, 0.0128076846107665, >>>> 0.0135135135135135, >>>> >>>> 0.0140845070422535, 0.0150730098916627, 0.0159362549800796, >>>> 0.0172413793103449, >>>> >>>> 0.0176899063475547, 0.0186954715413378, 0.0187765706188003, >>>> 0.0195757403189066, >>>> >>>> 0.019607843137255, 0.0199999999999999, 0.0210526315789473, >>>> 0.0221979621542939, >>>> >>>> 0.0239410681399632, 0.0239999999999999, 0.025149051490515, >>>> 0.0260869565217392, >>>> >>>> 0.0262475696694749, 0.028180542563143, 0.0285714285714286, >>>> 0.0303030303030302, >>>> >>>> 0.0315904139433552, 0.0341864716636198, 0.0375782881002089, >>>> 0.038479809976247, >>>> >>>> 0.0387596899224806, 0.0416666666666667, 0.0428100987925357, >>>> 0.0428134556574923, >>>> >>>> 0.0437201907790144, 0.0451127819548872, 0.0460251046025105, >>>> 0.0487779511180447, >>>> >>>> 0.048975188781014, 0.0529872938632063, 0.0562390158172233, >>>> 0.0589335827876521, >>>> >>>> 0.0617551462621885, 0.0628115653040877, 0.0671812464265294, >>>> 0.0721784776902887, >>>> >>>> 0.0736842105263157, 0.0833333333333334, 0.083862394802894, >>>> 0.0970464135021097, >>>> >>>> 0.0971168437025795, 0.102272727272727, 0.111111111111111, >>>> 0.117117117117117, >>>> >>>> 0.123532699832309, 0.141304347826087, 0.179487179487179, >>>> 0.191268191268191, >>>> >>>> 0.205128205128205, 0.219020172910663, 0.271590909090909, >>>> 0.333333333333333 >>>> >>>> ) >>>> >>>> >>>> Now I want to estimate empirical PDF for interval of (-1, 1) including >>>> all points of Dat >>>> >>>> I have looked into the density() function, however it appears that, >>>> empirical density is estimated for equally distant points, which not >>>> necessarily contains actual supplied points (in my case, Dat) >>>> >>>> Is there any option to achieve the same? >>>> >>>> Thanks for your pointer. >>>> >>>> ______________________________________________ >>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >>> >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >--------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k