# \donttest{
#get simulation data
data(exampledata)
data=exampledata
# To get n.comp value, we can use NG_number function.
# use JB statistic as the measure of nongaussianity to run lngca with df=0
estX_JB = lngca(xData = data$dX, n.comp = 4,
whiten = 'sqrtprec', restarts.pbyd = 20, distribution='JB',df=0)
# use the tiltedgaussian distribution to run lngca with df=8. This takes a long time:
estX_tilt = lngca(xData = data$dX, n.comp = 4,
whiten = 'sqrtprec', restarts.pbyd = 20, distribution='tiltedgaussian',df=8)
# true non-gaussian component of Sx, include individual and joint components
trueSx = rbind(data$sjX,data$siX)
# use pmse to compare the difference of the two methods
pmse(S1 = t(trueSx),S2=t(estX_JB$S),standardize = TRUE)
pmse(S1 = t(trueSx),S2=t(estX_tilt$S),standardize = TRUE)
# the lngca using tiltedgaussian tends to be more accurate
# with smaller pmse value, but takes longer to run.
# }
Run the code above in your browser using DataLab