0

I am currently working on curves generated in tensile tests of polymer specimens. Here, I try to generate a mean curve of five data sets generated at the same composition of the samples. Unfortunately, the resulting curve is not a function but has a vertical section which is why a simple smooth is not sufficient. Is there a way to fix the smoothed curve to a defined end point in R? Or an even better way that I did not see yet?

I already tried a geometric_smooth() from ggplot2 on all data points but it did not work as wished.

My current approach:

data <- read.csv("data.csv", header = TRUE, sep = ";")
ggplot(data, aes(y=stress, x=strain))+geom_point()+geom_smooth()

In the figure, you can see that the blue average curve does not fit the actual curves near their end points, probably due to the vertical sections. That's why I want to fix it to the mean end point. Additionally, I would like to fix it to (0|0) as the blue mean curve starts somewhere above it which does not fit the actual behaviour.

example figure

msu-welle
  • 65
  • 1
  • 11
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. So you know what type of line fitting you want to do? Nearly all of statistics is built around different methods to fit lines to data. If you are not sure what's right for your data, maybe you should be asking for help from the statisticians at [stats.se] instead since this doesn't seem like a specific programming question. – MrFlick May 08 '19 at 18:26
  • Thank you; I will post on Cross Validated! – msu-welle May 08 '19 at 18:46

0 Answers0