You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在R中提取Doornik-Hansen正态性检验的Ep统计量与Sig.Ep

Extracting Doornik-Hansen Test Statistic and P-Value from normality.test2

First, you’ll want to capture the output of normality.test2() into a variable instead of just printing it to the console. This output is a named list containing all the test results, which makes it straightforward to pull out specific values like Ep and Sig.Ep.

Here’s how to adjust your code to do this:

# Define your matrix as before
m_1 <- matrix(data[,2], nrow = nrow(data), ncol = 1)

# Run the test and store the full result in a variable
dh_test_output <- normality.test2(m_1)

# Extract the test statistic Ep
ep_stat <- dh_test_output$Ep

# Extract the significance (p-value) Sig.Ep
sig_ep_value <- dh_test_output$Sig.Ep

# Optional: Print the results to verify
cat("Doornik-Hansen Test Statistic (Ep):", ep_stat, "\n")
cat("P-Value (Sig.Ep):", sig_ep_value, "\n")

How this works:

The normality.test2() function returns a list where each result component has a clear name (like Ep, Sig.Ep, Sk for skewness, Ku for kurtosis, etc.). Using the $ operator lets you directly access these named elements. If you ever want to see all available components in the test output, run names(dh_test_output) to list them out.

内容的提问来源于stack exchange,提问作者Klaus Hoejlund

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:31:58