2

First off, I'm not very experienced in math techniques, so I am wide open to suggestions.

I am working with a set of data in R. I have a curve (mostly linear at first, peaking suddenly, then decreasing.) I want to smooth it out, so I used a spline and that achieves what I want (especially the peak of the curve "off center" from the top point). But there is a dip right below the peak that I want to avoid, as its essentially linear right there. enter image description here

I kind of understand (in a non-mathematical way) why this dip has to be there, to give the curve enough time to angle upwards. But it doesn't represent that data.

Is there any way to avoid this dip? I've thought about graphing it as two separate lines (a linear and a curved one), but that isn't appealing. Is there something besides a spline? Or code I can use to get around this?

Edited to include data

Time           Fe2+
0.04    138.8181818
   7    1258.636364
  14    1320.545455
  21     2110.37037
  28    13730.37037
  35    1550.909091
Valerie S
  • 225
  • 1
  • 6
  • 2
    Could you provide a [reproducible example](http://stackoverflow.com/help/mcve)? –  Jun 26 '15 at 03:19
  • 2
    This seems more like a data modeling question rather than an R programming question. I think your question is a better fit for [stats.se] where statistical and data analysis problems are on-topic. – MrFlick Jun 26 '15 at 03:29
  • Thank you, I really had no idea where to even go. I appreciate it. – Valerie S Jun 26 '15 at 03:29
  • Please do post a reference here if you end up getting an answer on Cross Validated. This is a good question that concerns both R programming and statistical visualization. – akhmed Jun 26 '15 at 06:57
  • Please don't cross post. If the site you originally post to is not the best one, flag it and ask for it to be migrated -- that avoids this issue, where both your cross post and the original end up on the same site. Please see [help/on-topic] which discusses this issue. – Glen_b Jun 30 '15 at 06:42

1 Answers1

0

Cross posted on Cross Validated. Answered well.

Avoiding a spline dip

...There are a number of ways to avoid such effects (e.g. smoothing splines can often be tweaked so as to avoid a dip, or maybe some form of monotonic spline to the left of the peak will be needed), but I think in this particular case a simple approach might be to transform (perhaps take logs or square roots), fit a spline on that scale and transform back.

Unimodal splines exist and may suit you better.... Glen_b

Valerie S
  • 225
  • 1
  • 6