<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello Mary -- Thanks for checking this out. I ran your script and
the your plots have the same problem that my own script had. Namely,
changing the tension parameter, sig, has almost no effect on the
smooth. Perhaps it is the difference between what a physicist and a
biologist might think of as smoothing ... I've attached a plot where
I use your data to create smooths with different "tension". Since
these smooths were created with locally weighted robust regression
the tension is actually the span, or the proportion of the data used
for each locally weighted fit. But the effect is what I am after.
When you adjust the span, or tension, the curve becomes more or less
smooth. <br>
<br>
Here is the R-code:<br>
# test.smooth.with.Haley.data<br>
library(RNetCDF, graphics)<br>
# load Marys test data and plot a subsample<br>
# ====================================<br>
nc <- open.nc("TestData.xy3.nc")<br>
dat <- read.nc(nc)<br>
print(summary(dat))<br>
yi <- dat$T[1:36]<br>
<br>
# fit a lowess smooth with differing spans<br>
# equivalent to tension on a smooth<br>
# ========================================<br>
pdf("test.smooth.pdf")<br>
plot(yi, type="b", ylab="Temperature")<br>
i <- seq(1,36,1)<br>
d <- cbind(i,yi)<br>
span <- seq(0.1,0.5,0.1)<br>
c <- seq(1,5,1)<br>
for(k in 1:length(span)) {<br>
lines(lowess(d, f=span[k]), col=c[k])<br>
}<br>
graphics.off()<br>
<br>
Best fishes<br>
Sam<br>
<br>
<div class="moz-cite-prefix">On 08/07/2015 12:13 PM, Mary Haley
wrote:<br>
</div>
<blockquote
cite="mid:CACNN_C+-ChWwVeWA=RiexsVaTY4SR9vxnCCmLTGbfej5PYQ7MA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Sam,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Here's a
slightly better example, that uses dummy data read off a
NetCDF file. The script is pretty much the same, except I
changed the data and added more tension factors to test. I
also created a panel plot for comparison.</div>
<div class="gmail_default" style="font-size:small"><br>
I've also added this example to our 1D interpolators page:</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default"><a moz-do-not-send="true"
href="http://www.ncl.ucar.edu/Applications/interp1d.shtml#ex3">http://www.ncl.ucar.edu/Applications/interp1d.shtml#ex3</a><br>
</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default" style="font-size:small">--Mary</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Aug 7, 2015 at 12:43 PM, Mary
Haley <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Hi Sam,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">It
appears you are using the parameter correctly.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Please
try running the attached example, which shows a simple
XY plot, and different tension factors using the "sig"
parameter with ftcurv.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">If this
doesn't shine a light on the problem at your end, then
can you provide us with a script and the data?</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">--Mary</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">
<div>
<div class="h5">On Tue, Aug 4, 2015 at 5:07 PM, Sam
McClatchie (NOAA Federal) <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:sam.mcclatchie@noaa.gov"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sam.mcclatchie@noaa.gov">sam.mcclatchie@noaa.gov</a></a>></span>
wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div class="h5">
<div bgcolor="#FFFFFF" text="#000000"> Colleagues<br>
<br>
I want to put a smooth line through a
de-seasonalized time series that shows a trend
and residual variability. I'm having trouble
adjusting the tension of the smooth which I
think needs to be less than one. I would like
the overlaid smooth curve to be much more smooth
than the data, but I'm basically getting a high
order polynomial smooth at present. <br>
<br>
Here is a snip of code:<br>
<br>
(Note: the xyplot tsplots(2) was previously
defined)<br>
<br>
xi = (/spice_ts_ss&time/)<br>
yi = monthly_anom(:,0,0)<br>
xo = fspan(1985., 2015., 200)<br>
ftsetp("sig",0.5)<br>
yo = ftcurv(xi,yi,xo)<br>
<br>
colors = (/"red","green","blue"/)<br>
resplot@xyLineColor = colors(0)<br>
tsplots(3) = gsn_csm_xy (wks,xo,yo,resplot)<br>
overlay(tsplots(2), tsplots(3))<br>
<br>
Changing the value of the sig parameter in
ftsetp between 0.1 to 40 seems to have no
effect, which suggests that I am misusing
something?<br>
<br>
Thanks in advance,<br>
Sam<span><font color="#888888"><br>
<div>-- <br>
Sam McClatchie, <br>
Supervisory oceanographer, <br>
NOAA lead for the CalCOFI program <br>
Southwest Fisheries Science Center, NOAA,
<br>
8901 La Jolla Shores Dr. <br>
La Jolla, CA 92037-1509, U.S.A. <br>
email <a moz-do-not-send="true"
href="mailto:Sam.McClatchie@noaa.gov"
target="_blank"><Sam.McClatchie@noaa.gov></a>
<br>
Office: <a moz-do-not-send="true"
href="tel:858%20546%207083"
value="+18585467083" target="_blank">858
546 7083</a>, Cellular: <a
moz-do-not-send="true"
href="tel:858%20752%208495"
value="+18587528495" target="_blank">858
752 8495</a> <br>
Research home page <<a
moz-do-not-send="true"
href="http://www.fishocean.info"
target="_blank"><a class="moz-txt-link-abbreviated" href="http://www.fishocean.info">www.fishocean.info</a></a>><br>
<img style="width:150px;min-height:149px"
alt="CalCOFI 66 years"
src="cid:part8.00000309.00020007@noaa.gov"><br>
</div>
</font></span></div>
<br>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a moz-do-not-send="true"
href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a moz-do-not-send="true"
href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk"
rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>email signature</title>
Sam McClatchie,
<br>
Supervisory oceanographer, <br>
NOAA lead for the CalCOFI program <br>
Southwest Fisheries Science Center, NOAA,
<br>
8901 La Jolla Shores Dr.
<br>
La Jolla, CA 92037-1509, U.S.A.
<br>
email <a class="moz-txt-link-rfc2396E" href="mailto:Sam.McClatchie@noaa.gov"><Sam.McClatchie@noaa.gov></a>
<br>
Office: 858 546 7083, Cellular: 858 752 8495
<br>
Research home page <<a class="moz-txt-link-abbreviated" href="http://www.fishocean.info">www.fishocean.info</a>><br>
<img style="width: 150px; height: 149px;" alt="CalCOFI 66 years"
src="cid:part11.02030307.04060107@noaa.gov"><br>
</div>
</body>
</html>