1
$\begingroup$

I have a rather mysterious problem when I try to do a simple boxplot with

boxplot(data$sex,data$freq)

but I'm unable to display box plot, and I cannot figure out why. The type of my variable are respectively factor and numeric, and the dataset is composed of 40.000 observations.

Boxplot

Can you help me please?

$\endgroup$
  • $\begingroup$ You might want to log transform your data to better see their distribution. $\endgroup$ – leoburgy Nov 22 '18 at 13:52
  • $\begingroup$ There are plenty of zeros there, so I wouldn't use logarithm... $\endgroup$ – Łukasz Deryło Nov 22 '18 at 14:14
  • $\begingroup$ This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review $\endgroup$ – kjetil b halvorsen Nov 22 '18 at 14:16
  • $\begingroup$ Forget the boxplot for a moment, and try summarizing the freq variable for each value of sex. $\endgroup$ – The Laconic Nov 22 '18 at 14:30
  • $\begingroup$ Thanks for the advice. However the OP does not explicitly state that the low values displayed by the box plot are true zeroes. I thought that the log transform together with the other answers could 'help' the user as they states. Finally I don't have the feeling that I ask for further clarification in my answer. $\endgroup$ – leoburgy Nov 22 '18 at 14:39
4
$\begingroup$

By default boxplot turns into points all outliers, which are defined as the datapoints that are farther that 1.5*IQR from box (IQR = Quartile3-Quartile1). So probably almost all observations with sex=1 are outliers in above sense.

Factor by which IQR is multiplied to obtain range of non-outliers is determined by range argument of boxplot function. Try experimenting with it. Plus, setting range=0 will force boxplot to treat all observations as non-outliers (whiskers will show min and max then).

$\endgroup$
4
$\begingroup$

It seems that almost all values in group 1 equal zero, with a few positive values above the 75 percentile. So there is nothing wrong with your plot.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.