[R] please show me simple example how to plot

Greg Snow Greg.Snow at imail.org
Tue Dec 7 19:33:17 CET 2010


Like Peter says, this sounds like loess, there are examples on the help page for scatter.smooth, you could also do this with lattice graphics using type=c('p','smooth'), or ggplot2 graphics (probably something like geom_smooth or geom_loess, I don't know ggplot2 that well yet).

If you want to learn more about how loess works then use loess.demo in the TeachingDemos package.  

There are also other smoothers available, but we would need more information before knowing where to point you.

For adding a general curve or line to a scatterplot also look at functions like "lines", "abline", and "curve", as well as the entire ggplot2 package.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of madr
> Sent: Tuesday, December 07, 2010 10:37 AM
> To: r-help at r-project.org
> Subject: Re: [R] please show me simple example how to plot
> 
> 
> Well, maybe I didn't write it clear.
> I know how to create scatterplot, and how to import data from csv file.
> But I do not know how to add this fitting that mentioned in sumbject to
> a
> plot.
> I do not know for what function name to look for in R. I played some
> time
> with ls, and it didn't create a line. I know the name for the fitting I
> ned
> from Statistica, and this is from help from this program:
> 
> "A curve is fitted to the XY coordinate data according to the
> distance-weighted least squares smoothing procedure (the influence of
> individual points decreases with the horizontal distance from the
> respective
> points on the curve). For more information, see Distance-Weighted Least
> Squares."
> 
> Now I need to recreate it in R.
> 
> Sorry again for not being clear.
> --
> View this message in context: http://r.789695.n4.nabble.com/please-
> show-me-simple-example-how-to-plot-Distance-Weighted-Least-Squares-
> fitting-tp3076824p3076863.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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