How can one fit a linear model to the higher moments of CAPM in R?
Fitting a linear model to the second moment (classical CAPM) would be lm(stock~market, data=example)
$$R_{i,t} - R_{f,t} = \alpha_i + \beta_i(R_{M,t}-R_{f,t}) + \epsilon_t \tag{2nd}$$
But how would one fit a linear model to third and fourth moment of CAPM?
$$R_{i,t}-R_{f,t} = \alpha_i + \beta_i(R_{m,t}-R_{f,t})+\gamma_i(R_{m,t}-R_{f,t})^2 \tag{3rd}$$ $$R_{i,t}-R_{f,t} = \alpha_i + \beta_i(R_{m,t}-R_{f,t})+\gamma_i(R_{m,t}-R_{f,t})^2+\delta_i(R_{m,t}-R_{f,t})^3 \tag{4th}$$
Where the $\beta_i$ is systematic variance, $\gamma_i$ is systematic skewness and $\delta_i$ is systematic kurtosis calculated as follows, $\beta_i = Cov(R_i,R_m)/E[(R_m-E(R_m))^2] =Cov(R_i,R_m)/Var(R_m)$ ,$\gamma_i = Cov(R_i,R_m^2)/E[(R_m-E(R_m))^3]$, $\delta_i = Cov(R_i,R_m^3)/E[(R_m-E(R_m))^4]$
I have tried squaring the market excess returns and fitting a linear model as follows
market2 <- market^2
lm(stock~market+market2, data=example)
market3 <- market^3
lm(stock~market+market2+market3, data=example)
This could be right but I doubt it, it's hard to check. Any ideas about this?