modeest with non-numeric data?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

modeest with non-numeric data?

Tom Hopper
Hello,

I have recently discovered the modeest library, and am trying to understand
how to use it with non-numeric data (e.g. determining the most common last
name, or analysing customer demographics ​by zip code).

I have the mlv() function working for numeric (double and integer) data,
but it throws either an error or a warning and produces unexpected output
with character data. Any help is appreciated.

A simple example:


> my.rand.letters <- sample(letters, size=100, replace=TRUE)

> mlv(my.rand.letters, mode=C("discrete"))Error in match.arg(x, .distribList) : 'arg' must be of length 1In addition: There were 21 warnings (use warnings() to see them)



> mlv(as.factor(my.rand.letters))Mode (most frequent value): NA NA
Bickel's modal skewness: -2
Call: mlv.factor(x = as.factor(my.rand.letters)) Warning message:In
discrete(x, ...) : NAs introduced by coercion



TIA,

Tom

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Fwd: modeest with non-numeric data?

Tom Hopper
Hello,

(Apologies for the repost, but it appears that the original text was
garbled.)

I have recently discovered the modeest library, and am trying to understand
how to use it with non-numeric data (e.g. determining the most common last
name, or analysing customer demographics by zip code).

I have the mlv() function working for numeric (double and integer) data,
but it throws either an error or a warning and produces unexpected output
with character data. The modeest help is not clear to me on character data,
and I have been unable to find examples online. Any help is appreciated.

A simple example:

> my.rand.letters <- sample(letters, size=100, replace=TRUE)

> mlv(my.rand.letters, mode=C("discrete"))
Error in match.arg(x, .distribList) : 'arg' must be of length 1
In addition: There were 21 warnings (use warnings() to see them)

> mlv(as.factor(my.rand.letters))
Mode (most frequent value): NA NA
Bickel's modal skewness: -2
Call: mlv.factor(x = as.factor(my.rand.letters))
Warning message:
In discrete(x, ...) : NAs introduced by coercion

TIA,

Tom

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.