Applies ToRevolution Analytics

RxLinMod() 有執行 「 依 」 群組的數個回復功能嗎?rxLinMod() 沒有這項功能直接。若要執行這項操作的方法之一就是使用 rxSplit() 函式,建立不同的 XDF 檔案,一個用於每個唯一的群組值,並接著呼叫迴圈來計算不同的迴歸為每個分割的 XDF 檔案中的 [rxLinMod()。例如,使用大班機的航空公司資料,從這裡的http://packages.revolutionanalytics.com/datasets/可下載建立 7 不同 XDF 的檔案,每一天,一週中的一個。在一週中的每一天,則計算線性迴歸模型。

rxGetVarInfo( "C:/MyRData/AirlineData87to08.xdf") Var 1: Year 22 factor levels: 1987 1988 1989 1990 1991 ... 2004 2005 2006 2007 2008 Var 2: Month 12 factor levels: January February March April May ... August September October November December Var 3: DayofMonth 31 factor levels: 1 2 3 4 5 ... 27 28 29 30 31 Var 4: DayOfWeek 7 factor levels: Monday Tuesday Wednesday Thursday Friday Saturday Sunday Var 5: DepTime, Type: integer, Low/High: (0, 29) Var 6: CRSDepTime, Type: integer, Low/High: (0, 24) Var 7: ArrTime, Type: integer, Low/High: (0, 29) Var 8: CRSArrTime, Type: integer, Low/High: (0, 24) Var 9: UniqueCarrier 29 factor levels: PS TW UA WN EA ... HA OH F9 YV 9E Var 10: FlightNum 8160 factor levels: 1451 1453 1454 1455 1457 ... 9742 9743 6813 6913 6513 Var 11: TailNum 13537 factor levels: NA N7298U N7449U N7453U N7288U ... N516AS N763JB N766JB N75428 N75429 Var 12: ActualElapsedTime, Type: integer, Low/High: (-719, 1883) Var 13: CRSElapsedTime, Type: integer, Low/High: (-1240, 1613) Var 14: AirTime, Type: integer, Low/High: (-3818, 3508) Var 15: ArrDelay, Type: integer, Low/High: (-1437, 2598) Var 16: DepDelay, Type: integer, Low/High: (-1410, 2601) Var 17: Origin 347 factor levels: SAN SFO BUR OAK LAX ... ROW GCC RKS MKG OTH Var 18: Dest 352 factor levels: SFO RNO OAK BUR LAX ... PIR GCC RKS MKG OTH Var 19: Distance, Type: integer, Low/High: (0, 4983) Var 20: TaxiIn, Type: integer, Low/High: (0, 1523) Var 21: TaxiOut, Type: integer, Low/High: (0, 3905) Var 22: Cancelled, Type: logical, Low/High: (0, 1) Var 23: CancellationCode 4 factor levels: A B C D Var 24: Diverted, Type: logical, Low/High: (0, 1) Var 25: CarrierDelay, Type: integer, Low/High: (0, 2580) Var 26: WeatherDelay, Type: integer, Low/High: (0, 1510) Var 27: NASDelay, Type: integer, Low/High: (-60, 1392) Var 28: SecDelay, Type: integer, Low/High: (0, 533) Var 29: LateAircraftDelay, Type: integer, Low/High: (0, 1407) Var 30: Late, Type: logical, Low/High: (0, 1) Var 31: LateNew 2 factor levels: 1 0rxSplit(inData = "C:/MyRData/AirlineData87to08.xdf", splitByFactor = "DayOfWeek", outFilesBase = "")lmresults <- vector("list", length = 0L)for (i in 1:length(myinfo$DayOfWeek)[[5]]     dataFile = paste("C:/MyRData/AirlineData87to08-ByDay.DayOfWeek.",myfac[i],".xdf", sep = "")     lmresults[[i]] <- rxLinMod(ArrDelay ~ CRSDepTime, data = dataFile)     assign("lmresults", lmresults, pos = 1) }

需要更多協助嗎?

想要其他選項嗎?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。