← 返回 roblox 的题目列表Difference in Difference Calculation and Trend Validation
类型:online_judge
Given three arrays: period, group, and outcome, calculate the difference in differences, and validate the trend by checking if the difference in 'pre' is within a given threshold.
Input:
period: Integer array representing time points
group: Integer array representing group identifiers
outcome: Numeric array representing outcome values
Output:
Difference in differences value
Yes/No if the 'pre' difference is within a given threshold
Example Input:
period = [1, 2, 1, 2]
group = [1, 1, 2, 2]
outcome = [10, 15, 14, 20]
threshold = 5
Example Output:
difference_in_difference = 3
is_within_threshold = Yes
Example
Input
[1, 2, 1, 2]
[1, 1, 2, 2]
[10, 15, 14, 20]
5