[R] Problem with custom.model.names in plotreg (texreg)
Antonello Preti
antoviral at gmail.com
Sun Oct 18 21:07:30 CEST 2015
Hi, I need some advice.
I'm using the package 'texreg' to extract effects in a multinomial model.
While using the 'plotreg' command I've got a problem with the subcommand
'custom.model.names'.
I'm able to have this subcommand working with the 'screenreg' command.
However, when I use the subcommand 'custom.model.names' with the 'plotreg'
command, an error is what I get.
Is there any way to have the proper name of the models?
I do not like the, rather ugly, default naming ('Model 1', Model 2' and so
on).
Thank you in advance,
Antonello Preti
Here some code for exemplification. It is a very elementary model with the
'iris' dataset.
### the data
data(iris)
dim(iris)
str(iris)
### Polytomous (multinomial) logit model
library(nnet)
mod.mn <- multinom(Species ~ Sepal.Length + Sepal.Width + Petal.Length +
Petal.Width , data = iris)
summary(mod.mn, cor=FALSE)
### coefficients
print(t(summary(mod.mn)$coefficients))
### standard errors
print(t(summary(mod.mn)$standard.errors))
#################################
#### summary of results
#################################
library(texreg)
### custom.model.names OK
screenreg(mod.mn, custom.model.names = c("versicolor", "virginica"))
### custom.model.names giving error
plotreg(mod.mn, custom.model.names = c("versicolor", "virginica"))
### Error in plotreg(mod.mn, custom.model.names = c("versicolor",
"virginica")) :
### The 'custom.model.names' argument must have the same length as the 'l'
argument.
## sessionInfo()
## R version 3.0.2 (2013-09-25)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## locale:
## [1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252
## [3] LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C
## [5] LC_TIME=Italian_Italy.1252
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
## other attached packages:
## [1] texreg_1.34 nnet_7.3-7
## loaded via a namespace (and not attached):
## [1] tools_3.0.2
[[alternative HTML version deleted]]
More information about the R-help
mailing list