Jump to content

Configuring a Relative Frequency Histogram with Normalized Counts per Year?


Recommended Posts

I have a signal where I'd like to compare the distributions in 2021 vs. 2022 using a histogram, but with the normalized counts per year (counts divided by total counts in that year, or relative frequency histogram) instead of just the raw counts.

Is there an easy way to configure this in Seeq?

image.thumb.png.f8e02d776f24c5aa71b7e9d3f87a7cbd.png

  • Like 1
Link to comment
Share on other sites

  • Seeq Team

Hi Siang Lim,

This is one way I could think of.

Step 1: Calculate Total Count (Yearly)

image.thumb.png.5f0fdffa397107e14ff4edb2201d8a09.png

Step 2: Calculate the normalized count for each bin. Example here is for bin 85-90. Repeat the step for all your bins.

$signal
.within($signal.isbetween(85,90))
.aggregate(count(),$yearly, startKey())
.toDiscrete()
.divide($total_yearly_count)

image.thumb.png.d49aa37f19ee9122d08e2a33eec6c2d2.png

 

Step 3: Combine all the normalized count for all the bins and move it as example below.

combinewith(
$nc95.move(1min),
$nc90.move(2min),
$nc85.move(3min)
)

image.thumb.png.366c019533139e9350580f7a0416cfee.png

 

Step 4: Create the conditions and set property.

$ref = $y.afterStart(1.1min)

combinewith(
$ref.move(1min,0).setProperty('Bin','95-100'),
$ref.move(2min,1min).setProperty('Bin','90-95'),
$ref.move(3min,2min).setProperty('Bin','85-90')
)

Note: Ensure the move settings are aligned with the above step. For example, the normalized for bin 90-95 is moved at 2 minutes at step 3 and step 4.

image.thumb.png.8ddf98db7e0c569cafe7a58be8ea5b87.png

Step 5: Create the histogram.

image.thumb.png.51120ad3db19cb162bb6ebe1dda7c739.png

image.thumb.png.c90e6ed7fd9b8e1b396d1501b015b86b.png

 

Edited by Nuraisyah Rosli
Link to comment
Share on other sites

On 3/10/2022 at 9:52 PM, Nuraisyah Rosli said:

Hi Siang Lim,

This is one way I could think of.

Step 1: Calculate Total Count (Yearly)

image.thumb.png.5f0fdffa397107e14ff4edb2201d8a09.png

Step 2: Calculate the normalized count for each bin. Example here is for bin 85-90. Repeat the step for all your bins.

$signal
.within($signal.isbetween(85,90))
.aggregate(count(),$yearly, startKey())
.toDiscrete()
.divide($total_yearly_count)

image.thumb.png.d49aa37f19ee9122d08e2a33eec6c2d2.png

 

Step 3: Combine all the normalized count for all the bins and move it as example below.

combinewith(
$nc95.move(1min),
$nc90.move(2min),
$nc85.move(3min)
)

image.thumb.png.366c019533139e9350580f7a0416cfee.png

 

Step 4: Create the conditions and set property.

$ref = $y.afterStart(1.1min)

combinewith(
$ref.move(1min,0).setProperty('Bin','95-100'),
$ref.move(2min,1min).setProperty('Bin','90-95'),
$ref.move(3min,2min).setProperty('Bin','85-90')
)

Note: Ensure the move settings are aligned with the above step. For example, the normalized for bin 90-95 is moved at 2 minutes at step 3 and step 4.

image.thumb.png.8ddf98db7e0c569cafe7a58be8ea5b87.png

Step 5: Create the histogram.

image.thumb.png.51120ad3db19cb162bb6ebe1dda7c739.png

image.thumb.png.c90e6ed7fd9b8e1b396d1501b015b86b.png

 

Thanks for the suggestion @Nuraisyah Rosli, is there a way to automate the creation of the bins instead of defining them manually?

I'd like to generate the histogram for 10+ assets, but they all have different numeric ranges (e.g. some are 0-10, some 0-100).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...