[R] question for Logic Regression

Yasir Kaheil kaheil at gmail.com
Mon May 19 23:14:56 CEST 2008


try:
alltrees <- predict(logicfit) 





coldeyes wrote:
> 
> thanks for you response,  i try predict command, it is doesn't work. i
> list a simulate code below:
> 
> X <- matrix(as.numeric(runif(400) < 0.5), 50,8) 
> colnames(X) <- paste("X", 1:ncol(X), sep="") 
> rownames(X) <- paste("case", 1:nrow(X), sep="")
> 
> # Define expected result: Y = (NOT X2) AND X6
> Y <- as.numeric(!X[,2] & X[,6]) 
> 
> Z<-cbin(X,Y)
> 
> set.seed(12345)
> 
> Annealing <- logreg.anneal.control(start = 4, end = -4, iter = 1000,
> update = 50)
> 
> logicfit <- logreg(resp=Z[,9], bin=Z[,1:8],
>                    type = 3,
>                    select = 2,
>                    ntrees=2,
>                    nleaves=3,  
>                    anneal.control=Annealing)
> 
> new<-data.frame(Z)
> new<-NULL
> alltrees <- predict(logicfit, new) 
> 
> names(logicfit) 
> 
> doesn't have coef class. 
> 
> thanks
> 
> 
> 
> 
> Yasir Kaheil wrote:
>> 
>> try
>> alltrees <- predict(fit, model.dat2) # make sure response variable is not
>> included in model.dat2
>> 
>> also to see the other attributes in "fit", try: attributes(fit)
>> 
>> thanks
>> y
>> 
>> 
>> 
>> coldeyes.Rhelp wrote:
>>> 
>>> Hi All:
>>> 
>>> how to get the coefficient for logic regression using selection=2 ( fit 
>>> multiple models) and type=3 ( logistic regression)
>>> for example i have a fit like below :
>>> fit<-logreg(resp = model.dat[,21], bin=model.dat[, 
>>> 2:18],sep=model.dat[,1] ,type=3,select=2,ntrees=2,nleaves=6 
>>> ,anneal.control=Annealing,tree.control=TreeControl)
>>> 
>>> i try to use  fit$coef  but i get nothing.
>>> 
>>> and i try to use eval.logreg to evaluate a validate data "model.dat2", 
>>> but i cannot fit "model" class make below formula work
>>> alltrees <- eval.logreg(fit$model , model.dat2)
>>>  
>>> could anyone enlighten me a little.
>>> thanks
>>> leo
>>> 
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>> 
>>> 
>> 
>> 
> 
> 


-----
Yasir H. Kaheil
Catchment Research Facility
The University of Western Ontario 

-- 
View this message in context: http://www.nabble.com/question-for-Logic-Regression-tp17310610p17328322.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list