I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to examine only small range of data, I found that the plot was not smooth (as shown below): plot(density(test$V2), xlim=c(0,1000)) ?Is there away to make it smoother? Thanks a lot!! ? ? -------------- next part -------------- A non-text attachment was scrubbed... Name: datauri-file.png Type: image/png Size: 26793 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150317/d2c4d84b/attachment.png>
Increasing the value of 'n' given to density will give an estimate at more points so it will look smoother. Try n=2^18. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Mar 17, 2015 at 12:06 PM, Fix Ace <acefix at rocketmail.com> wrote:> > > I have a dataset with 6187 elements, ranged from 3 to 104028. When I > tried to examine only small range of data, I found that the plot was not > smooth (as shown below): > plot(density(test$V2), xlim=c(0,1000)) > > > Is there away to make it smoother? > Thanks a lot!! > > > > > > > > > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
Thank you for the email. What is the default "n"? Thanks! On Tuesday, March 17, 2015 4:06 PM, William Dunlap <wdunlap at tibco.com> wrote: Increasing the value of 'n' given to density will give an estimate at more points so it will look smoother.? Try n=2^18. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Mar 17, 2015 at 12:06 PM, Fix Ace <acefix at rocketmail.com> wrote: ?I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to examine only small range of data, I found that the plot was not smooth (as shown below): plot(density(test$V2), xlim=c(0,1000)) ?Is there away to make it smoother? Thanks a lot!! ? ? ? ______________________________________________ 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. [[alternative HTML version deleted]]
> I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to > examine only small range of data, I found that the plot was not smooth (as > shown below): > plot(density(test$V2), xlim=c(0,1000)) > > > ?Is there away to make it smoother?For small ranges, use 'from' and 'to' in density() to restrict the range over which the density is calculated rather than increasing the number of points. for example plot(density(test$V2, from=0, to=1000)) This should produce a 512-point density plot for the region of interest only - though you may not find it very interesting for such a small range.... S Ellison ******************************************************************* This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you have received this message in error, please notify the sender immediately via +44(0)20 8943 7000 or notify postmaster at lgcgroup.com and delete this message and any copies from your computer and network. LGC Limited. Registered in England 2991879. Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK