[R] smoothing a plot in r

MacQueen, Don macqueen1 at llnl.gov
Thu Mar 20 18:25:11 CET 2014


Perhaps you will understand the meaning better if you try the following
sequence:

plot(datalist, ylab='Value')
lines(lowess(datalist),col="blue", lwd=2)
lines(lowess(datalist,f=1/3),col="red", lwd=2)
lines(lowess(datalist,f=1/10),col="green", lwd=2)

-Don


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 3/20/14 9:50 AM, "Babak Bastan" <babakbsn at gmail.com> wrote:

>Hi friends
>
>Iwould like to smooth my plot. I have a plot which is wiggly and I want to
>smooth it. here is my data
>
>539, 532, 531, 538, 544, 554, 575, 571, 543, 559, 511, 525, 512, 540, 535,
>514, 524, 527, 532, 547, 564, 548, 572, 564, 549, 532, 519, 520, 520, 543,
>550, 542, 528, 523, 531, 548, 554, 574, 575, 560, 534, 518, 511, 519, 527,
>554, 543, 527, 540, 524, 523, 539, 569, 552, 553, 540, 522, 522, 492, 519,
>532, 527, 532, 550, 535, 517, 551, 548, 571, 574, 539, 535, 515, 512, 510,
>527, 533, 543, 540, 533, 519, 539, 555, 542, 574, 543, 555, 539, 507, 522,
>518, 519, 516, 546, 523, 530, 532, 539, 540, 568, 554, 563, 550, 526, 509,
>492, 525, 519, 527, 526, 515, 530, 531, 553, 563, 562, 576, 568, 539, 516,
>512, 500, 516, 542, 522, 527, 523, 531
>
>I am using lowess function but it has no meaning for me,
>
>plot( lowess(datalist),col="blue",type="l",ylab="Values",lwd=2)
>
>how can I smooth my plot correctly?
>
>thanks alot
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>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.




More information about the R-help mailing list