[R] I need help in analyzing
wojak121
rotworm121 at op.pl
Sun Jun 6 12:38:51 CEST 2010
I'm sory for my weak english. I need to analyze this subject :
x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 y
0 0 1 0 0 1 0 0 1 0 czarne
1 1 0 0 0 0 1 0 0 0 rude
0 0 1 0 0 1 1 0 0 0 braz
0 0 1 0 1 0 1 0 0 0 blond
1 0 0 0 0 1 0 0 0 1 rude
1 1 0 0 0 0 0 0 0 1 blond
0 0 1 1 0 0 0 0 1 0 czarne
1 0 0 1 0 0 1 0 0 0 blond
0 0 1 0 0 1 1 0 0 0 blond
1 0 0 0 0 1 1 0 0 0 czarne
0 0 1 0 0 1 0 0 0 1 czarne
1 0 1 0 0 0 1 0 0 0 czarne
0 0 1 1 0 0 0 0 0 1 braz
0 1 0 1 0 0 0 0 0 1 braz
1 0 1 0 0 0 0 0 1 0 braz
0 0 0 1 1 0 0 0 0 1 blond
1 0 1 0 0 0 0 0 1 0 czarne
0 1 0 0 0 1 0 0 0 1 braz
1 0 0 1 0 0 0 0 0 1 braz
0 0 1 0 0 1 0 0 0 1 braz
0 0 0 1 0 1 0 0 0 1 blond
0 0 1 1 0 0 0 0 0 1 czarne
0 0 1 0 0 1 0 0 0 1 rude
0 0 1 0 0 1 0 0 0 1 braz
0 0 1 0 0 1 1 0 0 0 braz
0 0 1 0 0 1 1 0 0 0 rude
0 0 1 1 0 0 1 0 0 0 braz
1 0 1 0 0 0 0 0 1 0 rude
0 0 0 1 0 1 1 0 0 0 czarne
0 0 1 0 0 1 0 0 1 0 blond
1 0 0 1 0 0 0 0 1 0 blond
0 0 1 0 0 1 1 0 0 0 rude
1 0 0 0 0 1 0 0 0 1 braz
0 0 0 0 1 1 1 0 0 0 blond
0 0 1 1 0 0 0 0 0 1 blond
0 0 1 0 0 1 1 0 0 0 blond
1 0 0 1 0 0 0 0 0 1 blond
1 0 1 0 0 0 1 0 0 0 rude
0 1 0 0 0 1 0 0 1 0 braz
0 1 1 0 0 0 0 0 0 1 czarne
0 0 1 0 0 1 0 1 0 0 blond
0 1 1 0 0 1 0 1 0 0 rude
1 0 0 0 0 1 0 0 0 1 czarne
0 1 1 0 0 0 0 0 1 0 blond
0 0 1 0 0 1 1 0 0 0 rude
0 0 1 0 0 1 0 1 0 0 blond
0 0 1 0 1 0 1 0 0 0 blond
0 1 1 0 0 0 0 1 0 0 braz
0 0 1 1 0 0 0 0 1 0 braz
1 0 0 1 0 0 0 0 0 1 blond
1 1 0 0 0 0 0 0 0 1 czarne
0 1 1 0 0 0 1 0 0 0 rude
1 0 1 0 0 0 0 0 0 1 braz
1 1 0 0 0 0 1 0 0 0 braz
0 0 1 1 0 0 0 0 0 1 czarne
1 1 0 0 0 0 0 0 0 1 blond
1 0 0 1 0 0 1 0 0 0 blond
0 0 1 1 0 0 0 0 0 1 braz
0 0 1 1 0 0 1 0 0 0 czarne
0 0 1 1 0 0 1 0 0 0 czarne
last column is my Y. When i entered this to R i've get
model.lda=lda(y~.,dane)
Warning message:
In lda.default(x, grouping, ...) : variables are collinear
> model.lda
Call:
lda(y ~ ., data = dane)
Prior probabilities of groups:
blond braz czarne rude
0.3166667 0.2833333 0.2333333 0.1666667
Group means:
x1 x2 x3 x4 x5 x6 x7
blond 0.3684211 0.1578947 0.4736842 0.4210526 0.2105263 0.3684211 0.3684211
braz 0.2941176 0.2941176 0.6470588 0.3529412 0.0000000 0.4117647 0.2352941
czarne 0.3571429 0.1428571 0.7142857 0.4285714 0.0000000 0.3571429 0.3571429
rude 0.4000000 0.3000000 0.8000000 0.0000000 0.0000000 0.6000000 0.6000000
x8 x9 x10
blond 0.10526316 0.1578947 0.3684211
braz 0.05882353 0.1764706 0.5294118
czarne 0.00000000 0.2142857 0.4285714
rude 0.10000000 0.1000000 0.2000000
Coefficients of linear discriminants:
LD1 LD2 LD3
x1 5.1043768 4.0739211 -2.3626627
x2 5.1972181 2.9748157 -0.3920615
x3 5.9721912 3.0080526 -2.1908394
x4 3.9526576 2.7992826 -2.4115814
x5 2.0778084 5.5095145 -1.6788562
x6 4.9891371 3.5497498 -1.4580874
x7 0.6484504 0.5349203 -0.4412781
x8 -2.2934686 0.8713075 1.4076988
x9 -0.3536417 -0.2746371 -0.4208209
x10 0.2013050 -0.5773421 0.3025799
Proportion of trace:
LD1 LD2 LD3
0.6918 0.2574 0.0508
> w=sample(1:60,20)
> test=dane[w,]
> ucz=dane[-w,]
> m=lda(y~.,ucz)
> test.x=test[,-11]
> klasyfikacja=predict(m,test.x)
> table(klasyfikacja$class,test$y)
blond braz czarne rude
blond 2 1 1 0
braz 2 3 2 1
czarne 0 2 2 0
rude 1 1 1 1
model=rpart(y~.,dane,method="class",control=rpart.control(xval=3,cp=0))
> plot(model)
> text(model)
model$cptable
CP nsplit rel error xerror xstd
1 0.05691057 0 1.0000000 1.097561 0.08180737
2 0.02439024 3 0.8292683 1.219512 0.07040857
3 0.00000000 4 0.8048780 1.195122 0.07310295
npt=which.min(model$table[,4])
> npt
integer(0)
I need to describe this subject, but i don't know what R is saying to me.
This subject is about what women hairs mens like. x1 to x10 are answers to
questions 1 is yes,0 is no, but there was 2 groups of questions; from x1 to
x6 it must be choisen 2 answers on yes and from x7 to x 10 only 1 on yes.
Help me please, i need this to pass this subject.
--
View this message in context: http://r.789695.n4.nabble.com/I-need-help-in-analyzing-tp2244886p2244886.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list