- Aggregated Pivot Table
- Bit Shifting
- Bitwise XOR
- Calculate Tick Size
- Collapsing Dictionaries
- Graphs - Breadth First Search
- Graphs - Depth First Search
- Graphs - Detecting Cycles
- Greatest Common Divisor
- Identity Matrix
- Least Common Multiple
- Log Parser
- Nanosleep
- One Hot Encoding
- Parent Child ID Mapping
- Slippage
- Split Training and Testing Sets
- Stratified Sampling
- Symbol Column Update
- Table Indexing
- Word Count
Outlier Removal
Question: Outliers are values that vary abnormally from the rest of the values in a pool of values. When performing data analysis, it is sometimes useful to exclude outliers. One method of removing outliers is removing any value that has a z-score greater than 3 or less than -3. Create a function 'ro' that removes outliers from the given vector using the aforementioned technique.
More Information:
https://en.wikipedia.org/wiki/Standard_scoreExample
q)volume:300 400,100?100j
q)count volume
102
q)count ro[volume]
100
Solution
######## solution.q ########
ro:{x where 3>=abs %[;dev x] x - avg x}
Explanation: The formula for calculating a z-score is: (value - mean) % std. deviation. Calculate the z-score for every value and select the ones with a absolute z-score less than or equal to 3.