Siang Lim Posted March 9, 2022 Share Posted March 9, 2022 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? 1 Link to comment Share on other sites More sharing options...
Seeq Team Nuraisyah Rosli Posted March 11, 2022 Seeq Team Share Posted March 11, 2022 (edited) Hi Siang Lim, This is one way I could think of. Step 1: Calculate Total Count (Yearly) 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) 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) ) 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. Step 5: Create the histogram. Edited March 11, 2022 by Nuraisyah Rosli Link to comment Share on other sites More sharing options...
Siang Lim Posted March 16, 2022 Author Share Posted March 16, 2022 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) 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) 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) ) 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. Step 5: Create the histogram. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now