approxfun returns a function, give this function an x-value and it will give you the prediction (linear interpolation from the points that you gave to approxfun). The splinefun function also returns a function, but it gives a spline interpolation rather than a linear one.
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 From: Christian Miner [mailto:christian.mi...@gmail.com] Sent: Monday, November 23, 2009 2:05 PM To: Greg Snow Cc: Thomas S. Dye; r-help@r-project.org Subject: Re: [R] Loess Fit Thanks, I'll try that. What is the output of approxfun? On Mon, Nov 23, 2009 at 1:03 PM, Greg Snow <greg.s...@imail.org<mailto:greg.s...@imail.org>> wrote: If the client is always right, then what do they need us for? If you need a function to reproducibly generate predictions, then use loess to generate a set of predictions for a reasonably dense set of x-values, then use approxfun or splinefun to create a function to interpolate for you. Then this function can give the predictions for various x values. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org<mailto:greg.s...@imail.org> 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org> > [mailto:r-help-boun...@r-<mailto:r-help-boun...@r-> > project.org<http://project.org>] On Behalf Of Thomas S. Dye > Sent: Monday, November 23, 2009 1:39 PM > To: Christian Miner > Cc: r-help@r-project.org<mailto:r-help@r-project.org> > Subject: Re: [R] Loess Fit > > Thanks Christian. The client is always right ... > > Tom > > On Nov 23, 2009, at 10:32 AM, Christian Miner wrote: > > > sorry, I don't. I have data that I can estimate, but my client wants > > to "What if..." 20 separate scenarios, and that requires a function. > > > > On Mon, Nov 23, 2009 at 12:22 PM, Thomas S. Dye > > <t...@tsdye.com<mailto:t...@tsdye.com>> > wrote: > > Hi Christian, > > > > Do you have a reference to a publication where this has been done? > > > > All the best, > > Tom > > > > On Nov 23, 2009, at 10:15 AM, Christian Miner wrote: > > > >> it's a tricky maneuver. When I finish the fit, the predict function > >> will give me the values, and I can smooth this out so it looks like > >> a nice non-linear equation. The last thing I need to do is find the > >> equation, knowing I know have the x and y values, as they will > >> relate to each other in a non-linear fashion. > >> > >> Matlab can do this, but I'd rather not go into that realm. > >> > >> On Mon, Nov 23, 2009 at 12:11 PM, Thomas S. Dye > >> <t...@tsdye.com<mailto:t...@tsdye.com>> > >> wrote: > >> Hi Christian, > >> > >> I haven't seen an equation associated with a loess fit before. Do > >> you have a reference to one of these? > >> > >> All the best, > >> Tom > >> > >> > >> On Nov 23, 2009, at 9:03 AM, Christian Miner wrote: > >> > >> I'm working on Loess fit models using R, once I have the fit > >> accomplished, > >> I'm looking to back-out the equation of the fitted non-linear curve, > >> wondering if there is a way to determine this equation in R? I've > >> been > >> looking but can't find any literature. For me, the graph of the > >> function is > >> great, but without the equation of the graph, I'm kinda dead in the > >> water. > >> > >> Christian Miner > >> 503-866-6977 > >> > >> [[alternative HTML version deleted]] > >> > >> ______________________________________________ > >> R-help@r-project.org<mailto:R-help@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. > >> > >> > >> > >> > >> -- > >> Christian Miner > >> 503-866-6977 > >> > > > > > > > > > > -- > > Christian Miner > > 503-866-6977 > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org<mailto:R-help@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. -- Christian Miner 503-866-6977 [[alternative HTML version deleted]] ______________________________________________ R-help@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.