crtahlin / medplot

Functions for drawing graphs in R visualizing medical information.
4 stars 2 forks source link

Logistf - print out the reference group #67

Closed crtahlin closed 10 years ago

crtahlin commented 10 years ago

The reference group should be printed out in the label of the graph (what is the denominator in the odds ratio calculation).

crtahlin commented 10 years ago

This bug arises because data sent to the function plotLogistf() is in either numeric or chr format. If selection under: "Select a numeric variable to associate with presence of symptoms:" Is actually a numeric variable, than the plot is as expected. If it is a cetegorical variable (factor), than it is not, since the label above the grpah does not get printed out, because the function expects a factor my.var:

my.level.string=ifelse(is.numeric(my.var), "", 
                paste0(levels(my.var)[i+1], " versus ", levels(my.var)[1], " (reference)"))

We could just say levels(as.factor(my.var)) in the above code. But is the first level of a factor really the reference level of the logistf() function? What if the factor has more than two levels - will it work correctly?

llaarraa commented 10 years ago

if it has more than two levels we should display the contrasts for all of them... might restrict the possibility to binary variables - we have the same problem for all the models

llaarraa commented 10 years ago

Give super-low priority to logistf. It does only a more robust version of logistic regression - can think about not including it in the first version/ But transfer the idea of the graph to the results of the other models

crtahlin commented 10 years ago

This graph has been redone and issue no longer relevant.