Reputation: 423
No Issuer LR1 LR2 LR3 LR4 LR5 DR1
1 CompanyA 1.41470 1.32430 -0.16422 139.30633 8.49702 0.85071
2 CompanyB 1.44627 0.42427 0.40415 8.77173 6.66632 0.53576
3 CompanyC 1.54267 1.52505 0.81449 261.21500 35.86433 0.53681
4 CompanyD 3.64603 2.70640 2.32230 107.33922 1.79202 0.48101
5 CompanyE 1.00592 0.98415 0.78911 82.44725 27.00442 0.68071
6 CompanyF 2.59738 1.70374 0.92933 145.01431 1.81996 0.43577
DR2 DR3 AR1 AR2 AR3 AR4 AR5 PR1 PR2 PR3
5.84882 0.60382 2.62012 8.49702 4.68022 0.51531 0.00822 0.06236 0.05199 0.01595
1.15546 0.33039 41.61093 6.66632 4.04257 2.24779 0.00677 0.06957 0.00083 0.00301
1.16084 0.40417 1.39732 35.86433 0.32469 0.21293 0.04110 0.33770 0.25534 0.19301
0.92684 0.38246 3.40043 1.79202 1.10595 0.46242 0.03522 0.41886 0.14047 0.07617
2.13194 0.60695 4.42707 27.00442 0.23780 0.19290 0.05958 0.42816 0.39135 0.30883
1.00352 0.33506 2.51699 1.81996 1.07226 0.46796 0.04559 0.24596 0.16839 0.09742
PR4 PR5 PR6 PR7 RR1 RR2 Rating
-0.26783 0.00822 0.05651 -0.13802 0.00822 0.05651 4
0.03071 0.00677 0.01460 0.06903 0.00677 0.01460 3
0.02213 0.04110 0.08887 0.00471 0.04110 0.08887 3
0.23080 0.03522 0.06787 0.10673 0.03522 0.06787 3
0.09979 0.05958 0.18659 0.01925 0.05958 0.18659 3
0.10664 0.04559 0.10498 0.04990 0.04559 0.10498 3
Above is from the head(data)
using R. I wanted to use SVM, but before doing so, i want to regress the data. The Y is "Rating" variable, located in the last column, the rest is X which are LR1,LR2,...,RR1,RR2. Here is my steps :
x <- data[,3:24]
y <- data[,25]
lm <- (y~x)
but this is what i get from the warning
Error in model.frame.default(formula = y ~ x, drop.unused.levels = TRUE) :
invalid type (list) for variable 'x'
I have tried couple of times , including using the data.frame(x)
first, but the result are the same. The "Rating" variable determines the performance of the company, Rating 1 is the best performance while 4 is the worst performance.
Why i get such trouble? Please help thank you
Upvotes: 3
Views: 118
Reputation: 21
attach(data)
reg <- lm(Rating ~ LR1 + LR2 + ... + RR2, data=data)
Or you can separate the X and Y.
x <- LR1+LR2+ ... + RR2
y <- Rating
reg <- lm(y~x, data=data)
Upvotes: 1
Reputation: 10483
You can regress one variable against all the others by using the 'dot' notation like below:
fit <- lm(Rating ~ ., data = data)
Upvotes: 6