Hello,
I want to represent an exponenial growth withn the dataset :
Annee;Obs
2009;5,0
2010;6,0
2015;30,0
2016;100,0
2017;110,0
2018;120,0
2019;250,0
2022;1000,0
My code is this
traject=read.csv(file.choose(), sep=";", dec=",", header=TRUE)
library(ggplot2)
library(tidyr)
library(tidyverse)
library(lubridate)
library(ggthemes)
plot(traject)
dfTR <- data.frame(traject)
ggplot(dfTR, aes(x = Annee, y = Obs))+
ggtitle("Trajectoire dorée")+
xlab("Année")+
ylab("Indice de majoration")+
geom_point()+
geom_smooth(color="gold", fill="gold4")
trajD <- lm(log(Obs)~ Annee, data=dfTR)
summary(trajD)
I have the result
Call:
lm(formula = log(Obs) ~ Annee, data = dfTR)
Residuals:
Min 1Q Median 3Q Max
-0.45886 -0.09723 0.02878 0.19425 0.33773
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -817.00703 49.49012 -16.51 3.15e-06 ***
Annee 0.40738 0.02455 16.59 3.06e-06 ***
With the log transformation, I have the equation of the curve
Obs = exp^(0.40738*Annee-817.007)
My main question : I want to represent this fot the values of x between 2002 and 2030 with ggplot2
Thanks for your help