OPDV = speed difference between a vehicle and its lead vehicle in the same lane
(delta x - L) = H = distance between the front center of vehicle and rear end of its lead vehicle
CC6 and delta.CC5 are parameters.
Now, consider the following data frame, that contains all parameters of the equation:
df <- data.frame(w = rep(1.83, 17), vrate = 0.0006, CC4 = -0.35, dCC5 = 0.35, H = c(300, 200, 100, 70, 60, 50, 40, 30, 20, 10, 5, 2, 1, 0.5, 0.005, 0.0005, 0)) library(dplyr) df <- df %>% mutate(CC6 = 1*vrate/w) %>% mutate( OPDV = -CC6*H^2-dCC5, DV2 = -CC6*H^2)
Note that I'm considering CC6/17000 as one parameter CC6.
This will result in following plot:
library(ggplot2) ggplot(data = df)+ geom_line(aes(x = (OPDV), y = H, color = "OPDV"))
Here, I assumed the values of CC6 and CC5. But in observed data I don't know the values of these parameters
I have observed values of OPDV and H. When I plot them, I want to use a smoothing method that is similar to this equation, i.e. a quadratic part and a constant subtracted from it. Following is what I get if I use quadratic equation only:
ggplot(data = ud8 %>% filter(svelkm.level == "(15,20]", abs(slo_v)>0.1, abs(slo_p)>0.1))+ geom_point(aes(x = OPDV, y = frspacing_OPDV)) + geom_smooth(aes(x = OPDV, y = frspacing_OPDV), method="lm", formula = y ~ x + I(x^2))
Which smoothing method is best to use that can replicate the equation? I use R.