最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

R語言在不同樣本量下的Little's MCAR檢驗

2021-03-08 09:23 作者:拓端tecdat  | 我要投稿

原文鏈接:http://tecdat.cn/?p=10134

我進(jìn)行一個小型仿真,以在不同樣本量下測試Little的MCAR檢驗1。我可以研究線性回歸中的異方差。我能夠找到一些使用Little's MCAR檢驗的小樣本研究人員的例子,因此我進(jìn)行了仿真。

  1. library(BaylorEdPsych)

  2. library(simglm)

  3. library(ggplot2)

  4. library(dplyr)

  5. library(mice)

  6. fixed <- ~1 + age + income

  7. fixed_param <- c(2, 0.3, 1.3)

  8. cov_param <- list(dist_fun = c('rnorm', 'rnorm'),

  9. var_type = c("single", "single"),

  10. opts = list(list(mean = 0, sd = 4),

  11. list(mean = 0, sd = 3)))

  1. ggplot(little.mcar.p, aes(x = n, y = p)) + geom_boxplot() +

  2. geom_crossbar(aes(ymin = q025, y = q05, ymax = q075), data = summarise(

  3. group_by(little.mcar.p, n), q025 = quantile(p, .025, na.rm = TRUE),

  4. q05 = quantile(p, .05, na.rm = TRUE), q075 = quantile(p, .075, na.rm = TRUE)

  5. )) +

  6. geom_hline(yintercept = .05) +

  7. scale_y_continuous(breaks = seq(0, 1, .05), limits = c(0, 1)) +

  8. labs(x = "Sample size", y = "p-value",

  9. title = "Little's MCAR test for data that are MCAR",

  10. subtitle = "2000 replications",

  11. caption = paste(paste("For the narrow boxes, going from top to bottom, lines",

  12. "represent 7.5th, 5th and 2.5th percentiles of p-values."),

  13. "Test maintains nominal error rate across wide range of sample sizes.",

  14. sep = "\n"))

?

數(shù)據(jù)是MCAR

  1. ggplot(little.mcar.p.mar, aes(x = n, y = p)) + geom_boxplot() +

  2. geom_crossbar(aes(ymin = q925, y = q95, ymax = q975), data = summarise(

  3. group_by(little.mcar.p.mar, n), q925 = quantile(p, .925, na.rm = TRUE),

  4. q95 = quantile(p, .95, na.rm = TRUE), q975 = quantile(p, .975, na.rm = TRUE)

  5. ), linetype = 2) +

  6. geom_hline(yintercept = .05) +

  7. scale_y_continuous(breaks = seq(0, 1, .05), limits = c(0, 1)) +

  8. labs(x = "Sample size", y = "p-value",

  9. title = "Little's MCAR test for data that are MAR",

  10. subtitle = "2000 replications",

  11. caption = paste(paste("For the dashed boxes, going from top to bottom, lines",

  12. "represent 97.5th, 95th and 92.5th percentiles of p-values."),

  13. "Test only maintains nominal error rate around sample size of 120.",

  14. sep = "\n"))

數(shù)據(jù)是MAR

回歸接近完美(沒有多重共線性)。

?

R語言在不同樣本量下的Little's MCAR檢驗的評論 (共 條)

分享到微博請遵守國家法律
沾益县| 军事| 资阳市| 罗平县| 云安县| 浮山县| 肥城市| 无极县| 巴楚县| 布尔津县| 临沂市| 盖州市| 修武县| 潮州市| 建平县| 江阴市| 信丰县| 桃源县| 手游| 沂水县| 蒲江县| 响水县| 哈尔滨市| 肥东县| 南江县| 道孚县| 吉水县| 眉山市| 陇南市| 宜黄县| 阜城县| 云和县| 颍上县| 西贡区| 梧州市| 昌宁县| 桂阳县| 华坪县| 万源市| 宁安市| 雅安市|