RxLinMod() turi paleisti keli regresijos "iš" grupė?http://packages.revolutionanalytics.com/datasets/ Sukurti 7 skirtingų XDF failus, vienas kiekvienos savaitės dienos. Skaičiuokite linijinė regresijos modelį už kiekvieną dieną per savaitę.
rxLinMod() tiesiogiai nėra šią funkciją. Vienas būdas tai padaryti būtų galima naudoti funkciją rxSplit() sukurti atskirą XDF failus, vieną kiekvieno unikalų grupės reikšmės ir paskambinkite rxLinMod() ciklo apskaičiuoti kitą regresijos kiekvieną perskyrimo XDF failą. Pvz., naudojant didelis oro duomenis, atsisiųsti iš čiarxGetVarInfo( "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 0 rxSplit(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) }