How to find out the function of a negatively skewed curve to solve for Y based on X in R?

51 views Asked by At

I would like to find the function of the following plot so that I may find the Y value for any given X. This data frame is supposed to look like a negatively skewed distribution curve in order to create a score (Y), for a given X.

df = data.frame(x = c(12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40),
                y = c(20, 20, 20, 20, 35, 75, 125, 175, 225, 275, 325, 370, 405, 440, 470, 480, 450, 385, 300, 200, 130, 90, 60, 35, 20, 20, 20, 20, 20))
        
        
ggplot(data = df,
       aes(x, y)) +
  geom_line(linewidth = 2) 

Negatively skewed curve

I am unsure how to 1. solve for Y based on X? & 2. Calculate the function of the curve for use in other programs, is there a package that helps with this? I have tried to solve this issue using lines of best fit in Excel but as the curve is a bit more complex there doesn't seem to be a tool that helps.

0

There are 0 answers