lundi 13 janvier 2020

Column names not showing in random number generation using function 'rmsn' in R package 'sn'

Using a dataframe, df, containing several S&P500 stocks monthly returns, I generated the inputs required for the multivariate random normal distribution function rmsn in the R package sn:

library(moments)
library(sn)
muvec = apply(df, 2, mean)
covmat = cov(df)
skew = apply(df, 2, skewness)
rmsn(100, muvec, covmat, skew)

However, the randomly generated numbers do not contain the original column headers in my input vectors (e.g. "A", "B", "C"). Instead, the output of rmsn contains generic names ("V1", "V2", "V3"). Is there a way to ensure that my original column headers are passed through into the output?

Output of random number generation




Aucun commentaire:

Enregistrer un commentaire