[問題] 取出Residual再跑一次Regression
[問題類型]:
程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來)
[軟體熟悉度]:
入門(寫過其他程式,只是對語法不熟悉)
[問題敘述]:
請簡略描述你所要做的事情,或是這個程式的目的
程式碼:
model.1 <- lm(TAC ~ 0 +TA +REC +PPE ,data=merge.data.3)
model.2 <- lm(merge.data.3$RIR ~ model.1$residual)
其中,
merge.data.3 大概資料型態:
Code RIR TAC TA REC PPE
1 20 200 0.5 . .
2 30 . . . .
.
.
.
533 . . . . .
先跑一個簡單線性回歸模型(model.1),取出此模型之殘差,
再跑一次簡單線性回歸(model.2),但此時殘差(model.1$residual)
的排列與原先的data.frame不同(無法執行,跑出Variable lengths differ)
有嘗試用cbind與data.frame重組資料,但好像也無法解決,想請教各位高手
。
[關鍵字]:
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 120.126.58.61
※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1448962118.A.B24.html
→
12/01 17:33, , 1F
12/01 17:33, 1F
→
12/01 17:34, , 2F
12/01 17:34, 2F
→
12/01 17:34, , 3F
12/01 17:34, 3F
推
12/01 18:14, , 4F
12/01 18:14, 4F
→
12/01 18:14, , 5F
12/01 18:14, 5F
→
12/01 18:14, , 6F
12/01 18:14, 6F
→
12/01 18:14, , 7F
12/01 18:14, 7F
→
12/01 18:14, , 8F
12/01 18:14, 8F
→
12/02 11:44, , 9F
12/02 11:44, 9F
→
12/02 11:45, , 10F
12/02 11:45, 10F
→
12/02 11:46, , 11F
12/02 11:46, 11F
→
12/02 11:47, , 12F
12/02 11:47, 12F
→
12/02 11:48, , 13F
12/02 11:48, 13F
→
12/02 11:50, , 14F
12/02 11:50, 14F
→
12/02 11:52, , 15F
12/02 11:52, 15F
→
12/02 11:53, , 16F
12/02 11:53, 16F
→
12/02 12:05, , 17F
12/02 12:05, 17F
→
12/02 12:05, , 18F
12/02 12:05, 18F
→
12/02 12:07, , 19F
12/02 12:07, 19F
→
12/02 12:48, , 20F
12/02 12:48, 20F
→
12/02 12:49, , 21F
12/02 12:49, 21F
→
12/02 12:50, , 22F
12/02 12:50, 22F
→
12/02 12:51, , 23F
12/02 12:51, 23F
→
12/02 12:51, , 24F
12/02 12:51, 24F
→
12/02 13:04, , 25F
12/02 13:04, 25F
→
12/02 13:05, , 26F
12/02 13:05, 26F
→
12/02 13:25, , 27F
12/02 13:25, 27F
→
12/02 13:44, , 28F
12/02 13:44, 28F
→
12/02 13:45, , 29F
12/02 13:45, 29F
→
12/02 13:46, , 30F
12/02 13:46, 30F
→
12/02 13:47, , 31F
12/02 13:47, 31F
→
12/02 13:49, , 32F
12/02 13:49, 32F
→
12/02 13:52, , 33F
12/02 13:52, 33F
→
12/02 13:53, , 34F
12/02 13:53, 34F
→
12/02 13:56, , 35F
12/02 13:56, 35F
→
12/02 13:57, , 36F
12/02 13:57, 36F
→
12/02 14:20, , 37F
12/02 14:20, 37F
→
12/02 15:16, , 38F
12/02 15:16, 38F
→
12/02 15:18, , 39F
12/02 15:18, 39F
→
12/02 20:19, , 40F
12/02 20:19, 40F
→
12/02 20:20, , 41F
12/02 20:20, 41F
→
12/02 20:21, , 42F
12/02 20:21, 42F
→
12/02 20:23, , 43F
12/02 20:23, 43F
→
12/02 20:25, , 44F
12/02 20:25, 44F
→
12/02 21:02, , 45F
12/02 21:02, 45F
→
12/02 21:20, , 46F
12/02 21:20, 46F
→
12/02 21:23, , 47F
12/02 21:23, 47F
→
12/02 21:43, , 48F
12/02 21:43, 48F
→
12/02 21:44, , 49F
12/02 21:44, 49F
→
12/04 01:02, , 50F
12/04 01:02, 50F
→
12/04 03:50, , 51F
12/04 03:50, 51F
→
12/04 03:51, , 52F
12/04 03:51, 52F
→
12/04 04:02, , 53F
12/04 04:02, 53F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
R_Language 近期熱門文章
PTT數位生活區 即時熱門文章