# Compute the realised n-th moment score.
# x = 1 is the predictive 2nd moment E[Y^2] of a standard normal distribution.
set.seed(12345)
n <- 2
x <- 1
y <- rnorm(n = 100, mean = 0, sd = 1)
print(nmoment_rs(x = x, y = y, n = n))
print(nmoment_rs(x = rep(x = x, times = 100), y = y, n = n))
Run the code above in your browser using DataLab