Dear users

I have a problem with the dr function: "dimension reduction".
I give you my example, and i'll be pleased to read your comments.

#let be X a matrix 50*100:

library(dr);
X<- matrix(rnorm(50*100,5,1),50,100);

#and let be Y a vector response:
Y<- sample(0:1,50,replace=T);

#I choose (for the expérience, but in reality i don't have it) a few variables #which 
are censed to explain Y:

index<- sample(1:100,10);
X[Y==1,index]<-10*X[Y==1,index];

#so now I want to proceed to a logistic regression, but I don't know the vector 
#"index". So I have to reduce the dimension of X, and that's why I use the function 
#"dr" (dr package).

model<- dr(Y~X,family="binomial",method="phdy");

edr<- dr.direction(model);

#And now my problem: I hope that edr is a matrix constructed with linear #combinaison 
of X, prinipally the "index" vectors of X. But in reality it's not the #situation:

library(nnet);
fit<-multinom(Y~.,data=data.frame(edr));

pred<-predict(fit,data.frame(edr));
table(Y,pred)
0  21
0  19

????
thank you for tel me where is my error!

best regards

Benjamin Esterni
Institut Paoli Calmettes
France
        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to