```r
linear.df=data_frame(x=rep(1:20,4),y=c(seq(11,20,length.out=20),seq(17,14,length.out=20),seq(14,17,length.out=20),seq(4,7,length.out=20)),type=rep(c("a","b","c","d"),each=20))     
      
a=ggplot(linear.df)+
  aes(x=x,y=y,col=type)+
  geom_point()

linear.coefs=linear.df%>%
  group_by(type)%>%
  do(data_frame(DCT = emuR::dct(.$y,m=2,fit=F))) %>%
  mutate(DCTCOEF = paste0("k",0:(table(type)-1))) %>%
  tidyr::spread(DCTCOEF, DCT)

b=ggplot(linear.coefs)+
  aes(x=type,y=k0,fill=type)+
  geom_col()+
  ggtitle("k0 corresponds to the MEAN")
c=ggplot(linear.coefs)+
  aes(x=type,y=k1,fill=type)+
  geom_col()+
  ggtitle("k1 corresponds to the SLOPE")
d=ggplot(linear.coefs)+
  aes(x=type,y=k2,fill=type)+
  geom_col()+
  ggtitle("k2 corresponds to CURVATURE") +
  coord_cartesian(ylim = c(-0.025,0.025))
```