0
$\begingroup$

I'm not very experienced with Mathematica, please be patient..

I've a small dataset with just 2 columns that you can download here. The first column represents the amount of money earned every 1000 pageviews, and the second is the number of pageviews.

I'd like to check if there is a relation between the two variables but before this task I'd like to split the data in clusters and delete the outliers.

I'm trying to play with the data. Can you give me some suggestion on where to start from?

enter image description here

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Putting the data in a bar chart revealed 9 million pageviews earning 0 - 10 and less than 6 thousand earning 10 - 20, so I have put the number of pageviews on a log scale.

The overlaid fit was quite clunky to align. It would be interesting to know a better way to do that.

No outliers considered in this plot.

bins = Partition[10 Range[0, 24], 2, 1];

bdat = Function[{start, end},
    {start, end, Log10[Total[Last /@ #]] /. DirectedInfinity[-1] -> 0} &
     @Select[data, First[#] >= start && First[#] < end &]] @@@ bins;

labels = StringRiffle[Most[#], "-\n"] & /@ bdat;

fit = Fit[{#1 + (#2 - #1)/2, #3} & @@@ bdat, {1, x, x^2, x^3, x^4}, x];

Labeled[Overlay[{

   BarChart[Last /@ bdat, ChartLabels -> labels, ImageSize -> 700, 
    AspectRatio -> 0.5, LabelStyle -> Black],

   Plot[fit, {x, 5, 235}, PlotRange -> {{0, 242}, {-1.3, 7.35}},
    ImageSize -> 700, ImagePadding -> {{26, 20}, {0, 0}}, Axes -> False]}],

 {Rotate["Log No. Pageviews", Pi/2], "Money Earned"}, {Left, Bottom}]

enter image description here

$\endgroup$
1
  • $\begingroup$ thanks a lot, just a last question. Given this large number of samples of earning, is it possible to plot a gaussian curve that represents the distribution of probability of earning x money? For example earning 0 - 10$ would be 99%, earning 10 - 20 would be 1%. $\endgroup$
    – Revious
    Aug 2, 2021 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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