Compute the conditional expectation of Y^2 for a STAR process Y under a generic link function g.
expectation2_gRcpp(g_a_j, g_a_jp1, mu, sigma, Jmax)
y2_hat m x 1
vector of conditional expectations
Jmax x 1
vector of g(a(j))
Jmax x 1
vector of g(a(j + 1))
m x 1
vector of conditional expectations
m x 1
vector of conditional standard deviations
m x 1
vector of maximum integer values to consider