1. 程式人生 > 其它 >logistic迴歸 簡介_醫學統計與R語言:Tobit迴歸模型

logistic迴歸 簡介_醫學統計與R語言:Tobit迴歸模型

技術標籤:logistic迴歸 簡介r語言 線性迴歸 相關係數r語言 計算模型的rmser語言logistic迴歸r語言迴歸分析

微訊號:moooshaaa

簡介

The tobit model, also called a censored regression model, is designed to estimate linear relationships between variables when there is either left- or right-censoring in the dependent variable (also known as censoring from below and above, respectively). Censoring from above takes place when cases with a value at or above some threshold, all take on the value of that threshold, so that the true value might be equal to the threshold, but it might also be higher. In the case of censoring from below, values those that fall at or below some threshold are censored.

Syntax

輸入1:

install.packages("rio")
library(rio)
tbimport("tb.sav")
head(tb)

結果1:

nonationeducationreligionmarriagesurgicaladmissionabilitywatcherpainscoreSpiritualityfatigueanxietydepression
1123021323228276050
221302021200253154
33130211110076165
441302031518204356
551202111131193965
661202111231183068

輸入2:

install.packages("ggplot2")
library(ggplot2)
ggplot(fqp,aes(x=Spirituality))+geom_histogram(binwidth=1,color="black",fill="lightblue")+theme_classic()

結果2:

 

輸入3:

table(tb$Spirituality)

結果3:

01234567891011121314151617181920212223252627282930
83404645442719312518151910131249105251111242111

輸入4:

tb[,c(2:8)]2:8)],as.factor)
install.packages("AER")
library(AER)
tobleft=0,right=30,data=tb)
summary(tob)

結果4:

Call:
tobit(formula=Spirituality~nation+education+religion+
marriage+surgical+admission+ability+watcher+painscore+
fatigue+anxiety+depression,left=0,right=30,data=tb)

Observations:
TotalLeft-censoredUncensoredRight-censored
5068341211

Coefficients:
EstimateStd.ErrorzvaluePr(>|z|)
(Intercept)-4.81734623.4142289-1.4110.158256
nation27.75357582.80505812.7640.005707**
education20.33421791.28229240.2610.794369
education31.26029361.25314261.0060.314557
education41.20966511.37714780.8780.379735
education50.52449391.43148400.3660.714068
religion12.11906510.99783432.1240.033698*
marriage2-6.20443151.9804453-3.1330.001731**
marriage3-5.52687132.6140756-2.1140.034492*
marriage4-4.41667873.0722339-1.4380.150544
surgical12.31730490.65376173.5450.000393***
admission2-0.30997290.9072388-0.3420.732602
admission31.76189131.08557881.6230.104590
admission41.02498640.91556941.1200.262924
ability21.46378590.79933521.8310.067063.
ability33.38000144.07950920.8290.407370
watcher-0.02612210.2562860-0.1020.918816
painscore0.37988340.19368081.9610.049834*
fatigue0.30417300.05169555.8844.01e-09***
anxiety0.14055800.03689993.8090.000139***
depression0.00023810.03546310.0070.994644
Log(scale)1.90885050.036152352.8002e-16***
---
Signif.codes:0‘***’0.001‘**’0.01‘*’0.05‘.’0.1‘’1

Scale:6.745

Gaussiandistribution
NumberofNewton-RaphsonIterations:4
Log-likelihood:-1461on22Df
Wald-statistic:195.5on20Df,p-value:2.22e-16

此外,VGAM 和Zelig package 也可以實現Tobit迴歸

醫學統計與R語言:唉,畫個圖!

醫學統計與R語言:多重比較P值的視覺化

醫學統計與R語言:爬蟲抓取國自然基金資訊

醫學統計與R語言:多元方差分析與非引數多元方差分析

醫學統計與R語言:使用R語言實現Johnson-Neyman分析

醫學統計與R語言:多層線性模型圖示

醫學統計與R語言:多層線性模型(混合線性模型

醫學統計與R語言:best subset of inputs for the glm famil

醫學統計與R語言:多重線迴歸自變數篩選的幾種方法

醫學統計與R語言:關聯規則Apriori算

醫學統計與R語言:列聯表視覺化的4種方

醫學統計與R語言:盤它!什麼格式檔案都可

醫學統計與R語言:離群值分析(Outlier Detection

醫學統計與R語言:決策樹CHAI

醫學統計與R語言:主成分分析(PCA)及可視

醫學統計與R語言:矩陣的特徵值和奇異值分

醫學統計與R語言:聽說你還在手動畫三線表!

醫學統計與R語言:合併多個Excel文

醫學統計與R語言:政策效果評價之合成控制

醫學統計與R語言:線性迴歸模型假設條件驗證與診斷醫學統計與R語言:可能是最全R語言操作手冊(cheatsheets)

醫學統計與R語言:想發表sci就畫這種Bland-Altman Plot

醫學統計與R語言:logistic迴歸假設條件驗證及診斷

醫學統計與R語言:二分類Logisticl迴歸和診斷強大的log.regr()函式

醫學統計與R語言:logistic迴歸ROC、Nomogram繪製及模型輸出

醫學統計與R語言:logistic迴歸中相加互動作用分析

醫學統計與R語言:線性迴歸中互動作用視覺化的5種方法

醫學統計與R語言:ggplot2一頁多圖及子圖嵌入主圖的多種實現方法

醫學統計與R語言:相關係數矩陣的視覺化

醫學統計與R語言:診斷試驗評價指標

醫學統計與R語言:簡單線性迴歸(區間預測及標化迴歸係數)

d5995aa909734618511d101aa83a0e6f.png

醫學統計與R語言