久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

R語(yǔ)言中的Theil-Sen回歸分析

 拓端數(shù)據(jù) 2023-02-08 發(fā)布于浙江

原文鏈接:http:///?p=10080

Theil-Sen估計(jì)器是一種在社會(huì)科學(xué)中不常用 的簡(jiǎn)單線性回歸估計(jì)器  ,。三個(gè)步驟:點(diǎn)擊文末“閱讀原文”獲取完整代碼數(shù)據(jù),。

  • 在數(shù)據(jù)中所有點(diǎn)之間繪制一條線

  • 計(jì)算每條線的斜率

  • 中位數(shù)斜率是 回歸斜率

用這種方法計(jì)算斜率非??煽俊.?dāng)誤差呈正態(tài)分布且沒(méi)有異常值時(shí),,斜率與OLS非常相似,。

相關(guān)視頻

有幾種獲取截距的方法。如果 關(guān)心回歸中的截距,,那么知道 軟件在做什么是很合理的,。 

當(dāng)我對(duì)異常值和異方差性有擔(dān)憂時(shí),請(qǐng)?jiān)谏戏结槍?duì)Theil-Sen進(jìn)行簡(jiǎn)單線性回歸的評(píng)論 ,。

我進(jìn)行了一次 模擬,,以了解Theil-Sen如何在異方差下與OLS比較。它是更有效的估計(jì)器。

library(simglm)
library(ggplot2)
library(dplyr)
library(WRS)

# Hetero
nRep <- 100
n.s <- c(seq(50, 300, 50), 400, 550, 750, 1000)
samp.dat <- sample((1:(nRep*length(n.s))), 25)
lm.coefs.0 <- matrix(ncol = 3, nrow = nRep*length(n.s))
ts.coefs.0 <- matrix(ncol = 3, nrow = nRep*length(n.s))
lmt.coefs.0 <- matrix(ncol = 3, nrow = nRep*length(n.s))
dat.s <- list()



ggplot(dat.frms.0, aes(x = age, y = sim_data)) +
geom_point(shape = 1, size = .5) +
geom_smooth(method = "lm", se = FALSE) +
facet_wrap(~ random.sample, nrow = 5) +
labs(x = "Predictor", y = "Outcome",
title = "Random sample of 25 datasets from 15000 datasets for simulation",
subtitle = "Heteroscedastic relationships")


點(diǎn)擊標(biāo)題查閱往期內(nèi)容

數(shù)據(jù)分享|R語(yǔ)言邏輯回歸,、Naive Bayes貝葉斯,、決策樹(shù)、隨機(jī)森林算法預(yù)測(cè)心臟病

左右滑動(dòng)查看更多

01

02

03

04

ggplot(coefs.0, aes(x = n, colour = Estimator)) +
  geom_boxplot(
    aes(ymin = q025, lower = q25, middle = q50, upper = q75, ymax = q975), data = summarise(
      group_by(coefs.0, n, Estimator), q025 = quantile(Slope, .025),
      q25 = quantile(Slope, .25), q50 = quantile(Slope, .5),
      q75 = quantile(Slope, .75), q975 = quantile(Slope, .975)), stat = "identity") +
  geom_hline(yintercept = 2, linetype = 2) + scale_y_continuous(breaks = seq(1, 3, .05)) +
  labs(x = "Sample size", y = "Slope",
       title = "Estimation of regression slope in simple linear regression under heteroscedasticity",
       subtitle = "1500 replications - Population slope is 2",
       caption = paste(
         "Boxes are IQR, whiskers are middle 95% of slopes",
         "Both estimators are unbiased in the long run, however, OLS has higher variability",
         sep = "\n"
       ))


    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多