[R] Logic regression equation in character form?
Earl F. Glynn
efg at stowers-institute.org
Thu Feb 24 21:28:05 CET 2005
Perhaps I can ask a more focused question:
"Earl F. Glynn" <efg at stowers-institute.org> wrote in message
news:cvig76$3jq$1 at sea.gmane.org...
> I want to get some "simple" logic regression examples to work before
> exploring a hard problem.
..
> logicfit <- logreg(resp=Y, bin=X,
> type = REGRESSION.TYPE<-2,
> select = FIT.SINGLE.MODEL<-1,
> ntrees=1,
> nleaves=2, # force shape of final tree
> anneal.control=Annealing)
OK, I have a logic regression equation and just want it in a character form.
For example, I can see this equation from the R command prompt:
> logicfit
score 0.968
+2.14 * (((not X4) or ((not X13) and X19)) and (not X3)) -1.25 * ((((not
X1) or (not X3)) and ((not X2) or X20)) and (((not X17) and X16) or ((not
X20) and (not X1))))
But I cannot figure out how to get this equation in character form:
Why does this NOT work?
> typeof(logicfit)
[1] "list"
> class(logicfit)
[1] "logreg"
> x <- paste(print(logicfit))
score 0.968
+2.14 * (((not X4) or ((not X13) and X19)) and (not X3)) -1.25 * ((((not
X1) or (not X3)) and ((not X2) or X20)) and (((not X17) and X16) or ((not
X20) and (not X1))))
> x
character(0)
> cat(x, "\n")
[nothing]
>
The "print" makes the following error go away but does not give me the
string displayed on the R console:
> cat(logicfit)
Error in cat(list(...), file, sep, fill, labels, append) :
argument 1 not yet handled by cat
This simpler analogy DOES work:
> x <- paste( print("string") )
[1] "string"
> x
[1] "string"
> cat(x, "\n")
string
>
Any clues? Thanks for any help with this.
efg
More information about the R-help
mailing list