Re: [R] loess plotting problem

2023-03-23 Thread John Fox
Dear , On 2023-03-23 11:08 a.m., Anupam Tyagi wrote: Thanks, John. However, loess.smooth() is producing a very different curve compared to the one that results from applying predict() on a loess(). I am guessing they are using different defaults. Correct? No need to guess. Just look at the

Re: [R] loess plotting problem

2023-03-23 Thread Anupam Tyagi
Thanks, John. However, loess.smooth() is producing a very different curve compared to the one that results from applying predict() on a loess(). I am guessing they are using different defaults. Correct? On Thu, 23 Mar 2023 at 20:20, John Fox wrote: > Dear Anupam Tyagi, > > You didn't include y

Re: [R] loess plotting problem

2023-03-23 Thread John Fox
Dear Anupam Tyagi, You didn't include your data, so it's not possible to see exactly what happened, but I think that you misunderstand the object that loess() returns. It returns a "loess" object with several components, including the original data in x and y. So if pass the object to lines(),

Re: [R] loess plotting problem

2023-03-23 Thread Ivan Krylov
В Thu, 23 Mar 2023 19:48:40 +0530 Anupam Tyagi пишет: > lines(loess(si_pov_gini ~ ny_gnp_pcap_pp_kd, gini_pci_wdi_narm)) lines() on an object of class "loess" ends up calling lines.default(...), which uses xy.coords(...) to obtain the points to plot, which, in turn, ends up extracting the $x and

[R] loess plotting problem

2023-03-23 Thread Anupam Tyagi
For some reason the following code is not plotting as I want it to. I want to plot a "loess" line plotted over a scatter plot. I get a jumble, with lines connecting all the points. I had a similar problem with "lowess". I solved that by dropping "NA" rows from the data columns. Please help. librar