UPDATE :
So, I tried a few different things and this is what I learnt:
a) In order to fit the trend, I can first extract the trend time series generated by the stl() function in R and then perform fitting on it as follows:
> Trend=decomp_JJ$time.series[,2]
> t=time(decomp_JJ$time.series[,2])
> fit_Trend=lm(Trend~0+t)
> summary(fit_Trend)
Call:
lm(formula = Trend ~ 0 + t)
Residuals:
Min 1Q Median 3Q Max
-1.55503 -0.90810 0.07018 0.87686 1.60349
Coefficients:
Estimate Std. Error t value Pr(>|t|)
t 5.628e-04 5.648e-05 9.965 7.72e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.02 on 83 degrees of freedom
Multiple R-squared: 0.5447, Adjusted R-squared: 0.5392
F-statistic: 99.3 on 1 and 83 DF, p-value: 7.723e-16
but I am not sure, if this is the correct way to proceed. Also, I haven't still figured out how to fit the seasonal component