People Analytics
The agent operates as a senior people analytics partner, translating workforce data into actionable insights using statistical modeling, segmentation analysis, and data governance best practices.
Clarify First
Before generating the analysis, confirm these inputs. If any is unknown or vague, ASK — do not assume:
Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
Workflow
- Frame the question -- Clarify the business question with the HR or business stakeholder. Examples: "Why is Sales attrition 2x the company average?" or "Are we paying equitably across gender?" Define the success metric for the analysis.
- Assess data readiness -- Identify required data sources (HRIS, ATS, survey platform, payroll). Check for completeness, recency, and quality. Flag any gaps before proceeding.
- Analyze -- Apply the appropriate method from the analytics toolkit (descriptive stats, regression, classification, segmentation). Document assumptions and limitations.
- Validate findings -- Sense-check results with domain experts (HRBPs, managers). Test for statistical significance and practical significance. Check predictive models for bias across protected groups.
- Recommend -- Translate findings into 2-3 specific, actionable recommendations with expected impact and cost.
- Deliver and monitor -- Present insights using the dashboard framework. Set up ongoing monitoring for key metrics with alert thresholds.
Checkpoint: After step 2, confirm that all data has been anonymized or aggregated to comply with privacy policy before analysis begins.
Analytics Maturity Model
| Level |
Name |
Capabilities |
Typical Questions Answered |
| 1 |
Operational Reporting |
Headcount, compliance, ad-hoc queries |
"How many people do we have?" |
| 2 |
Advanced Reporting |
Dashboards, trends, benchmarking, segmentation |
"How has attrition changed by quarter?" |
| 3 |
Analytics |
Statistical analysis, correlation, root cause |
"What drives attrition in Sales?" |
| 4 |
Predictive |
Turnover prediction, performance modeling, risk scoring |
"Who is likely to leave in the next 6 months?" |
| 5 |
Prescriptive |
Automated recommendations, real-time interventions |
"What should we do to retain this person?" |
Core HR Metrics
Workforce Metrics
| Metric |
Formula |
Benchmark |
| Turnover Rate |
(Separations / Avg HC) x 100 |
10-15% |
| Retention Rate |
(Retained / Starting HC) x 100 |
85-90% |
| Time to Fill |
Days from req open to offer accept |
30-45 days |
| Cost per Hire |
Total recruiting cost / Hires |
$3-5K |
| Regrettable Turnover |
Regrettable exits / Total exits |
< 30% |
Performance Metrics
| Metric |
Formula |
Benchmark |
| High Performers |
% rated top tier |
15-20% |
| Goal Completion |
Goals achieved / Goals set |
80%+ |
| Promotion Rate |
Promotions / Headcount |
8-12% |
Engagement Metrics
| Metric |
Formula |
Benchmark |
| eNPS |
Promoters % - Detractors % |
20-40 |
| Engagement Score |
Survey composite (1-100) |
70%+ |
| Absenteeism |
Absent days / Work days |
< 3% |
Turnover Prediction Model
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
def build_turnover_model(employee_data: pd.DataFrame) -> dict:
"""
Build and evaluate a turnover prediction model.
Input: DataFrame with columns for features + 'left_company' (0/1).
Output: dict with model, feature importance, and evaluation metrics.
"""
features = [
'tenure_months', 'salary_ratio_to_market', 'performance_rating',
'months_since_last_promotion', 'manager_tenure', 'team_size',
'engagement_score', 'training_hours_ytd', 'projects_completed'
]
X = employee_data[features]
y = employee_data['left_company']
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42, stratify=y
)
model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
report = classification_report(y_test, y_pred, output_dict=True)
importance = (
pd.DataFrame({'feature': features, 'importance': model.feature_importances_})
.sort_values('importance', ascending=False)
)
return {'model': model, 'importance': importance, 'evaluation': report}
def score_flight_risk(model, current_employees: pd.DataFrame) -> pd.DataFrame:
"""
Score current employees for flight risk.
Returns DataFrame with employee_id, flight_risk_score (0-1), and risk_level.
"""
probabilities = model.predict_proba(current_employees[model.feature_names_in_])[:, 1]
risk_levels = pd.cut(
probabilities,
bins=[0, 0.25, 0.50, 0.75, 1.0],
labels=['Low', 'Medium', 'High', 'Critical']
)
return pd.DataFrame({
'employee_id': current_employees['employee_id'],
'flight_risk_score': probabilities.round(3),
'risk_level': risk_levels
}).sort_values('flight_risk_score', ascending=False)
Example: Sales Attrition Root-Cause Analysis
QUESTION
Sales voluntary turnover is 22% vs 12% company average. Why?
DATA
Source: HRIS + engagement survey + exit interviews (n=45 exits, trailing 12 mo)
ANALYSIS
Segmentation by tenure band:
< 1 yr: 35% of exits (onboarding/ramp issues)
1-2 yr: 40% of exits (comp dissatisfaction + career path)
2+ yr: 25% of exits (manager relationship)
Regression on exit survey scores (n=38 respondents):
Top drivers of intent-to-leave:
1. "I am paid fairly" (beta = -0.42, p < 0.01)
2. "I see a career path here" (beta = -0.31, p < 0.01)
3. "My manager supports my development" (beta = -0.28, p < 0.05)
Compensation benchmark:
Sales IC3 compa-ratio: 0.88 (12% below midpoint)
Sales IC2 compa-ratio: 0.91 (9% below midpoint)
Rest of company average: 0.98
FINDINGS
1. Sales comp is significantly below market, especially at IC2-IC3
2. No defined career ladder for Sales ICs beyond IC3
3. New hires (< 1 yr) leaving due to unrealistic ramp expectations
RECOMMENDATIONS
1. Market adjustment: Bring Sales IC2-IC3 to 95th percentile compa-ratio ($180K budget)
2. Publish a Sales career ladder through IC5 with clear promotion criteria
3. Redesign onboarding: extend ramp period from 30 to 90 days with milestone targets
EXPECTED IMPACT
Reduce Sales attrition from 22% to 14-16% within 12 months
ROI: $180K adjustment saves ~$450K in replacement costs (10 fewer exits x $45K/hire)
Pay Equity Analysis
import pandas as pd
import statsmodels.api as sm
def analyze_pay_equity(employee_data: pd.DataFrame) -> dict:
"""
Conduct pay equity analysis controlling for legitimate pay factors.
Returns raw gap, adjusted gap, model fit, and employees flagged for review.
"""
# Raw gap
avg_by_gender = employee_data.groupby('gender')['salary'].mean()
raw_gap = (avg_by_gender['Female'] - avg_by_gender['Male']) / avg_by_gender['Male']
# Adjusted gap (control for level, tenure, performance, location)
controls = pd.get_dummies(
employee_data[['job_level', 'tenure_years', 'performance_rating', 'department', 'location']],
drop_first=True
)
controls = sm.add_constant(controls)
controls['is_female'] = (employee_data['gender'] == 'Female').astype(int)
model = sm.OLS(employee_data['salary'], controls).fit()
adjusted_gap = model.params['is_female']
# Flag outliers (residual > 2 std dev)
employee_data['predicted'] = model.predict(controls)
employee_data['residual'] = employee_data['salary'] - employee_data['predicted']
threshold = 2 * employee_data['residual'].std()
flagged = employee_data[abs(employee_data['residual']) > threshold]
return {
'raw_gap_pct': round(raw_gap * 100, 1),
'adjusted_gap_usd': round(adjusted_gap, 0),
'model_r_squared': round(model.rsquared, 3),
'employees_flagged': len(flagged),
'flagged_details': flagged[['employee_id', 'salary', 'predicted', 'residual']]
}
Engagement Survey Analysis
- Calculate response rate -- Target 80%+ for statistical validity. Flag departments below 60%.
- Compute category scores -- Average Likert responses by category (Manager, Growth, Culture, Compensation). Compare to prior period.
- Run driver analysis -- Regress category scores against overall engagement to identify which categories have the highest impact on engagement.
- Segment -- Break results by department, level, tenure band, and location. Identify where scores diverge most from company average.
- Prioritize -- Plot categories on a 2x2 matrix (Impact vs Score). "High impact, low score" quadrant = priority action areas.
Checkpoint: Suppress results for any segment with fewer than 5 respondents to protect anonymity.
DEI Metrics Framework
| Domain |
Metrics |
Data Source |
| Representation |
Gender / ethnicity distribution by level |
HRIS |
| Pay equity |
Raw gap, adjusted gap (controlled regression) |
Payroll + HRIS |
| Progression |
Promotion rates by demographic group |
HRIS |
| Hiring |
Offer and accept rates by demographic group |
ATS |
| Inclusion |
Inclusion index, belonging score, psychological safety |
Survey |
Data Governance Checklist
Before starting any people analytics project:
Reference Materials
references/hr_metrics.md - Complete HR metrics guide
references/predictive_models.md - Predictive modeling approaches
references/survey_design.md - Survey methodology
references/data_ethics.md - Ethical analytics practices
Scripts
# Analyze engagement survey results with driver analysis
python scripts/survey_analyzer.py --file survey_results.csv
python scripts/survey_analyzer.py --file survey_results.csv --prior prior_survey.csv --json
# Score attrition risk from employee data
python scripts/attrition_predictor.py --file employees.csv
python scripts/attrition_predictor.py --file employees.csv --threshold 0.7 --json
# Workforce headcount planning calculations
python scripts/headcount_planner.py --file workforce.csv --growth 0.15 --attrition 0.12
python scripts/headcount_planner.py --file workforce.csv --growth 0.15 --attrition 0.12 --json
Troubleshooting
| Problem |
Root Cause |
Resolution |
| Low survey response rate (< 70%) |
Survey fatigue, lack of trust in anonymity, or no visible action from prior surveys |
Shorten survey to 15-20 questions max; communicate anonymity safeguards clearly; publish and act on top 3 findings from prior survey before launching next one |
| Attrition model produces too many false positives |
Overfitting on historical data, missing key features, or class imbalance |
Add regularization; use SMOTE or class weights to handle imbalance; validate with cross-validation not just train/test split; include manager quality and comp-ratio as features |
| Stakeholders distrust analytics findings |
Results contradict lived experience, or methodology is opaque |
Present methodology transparently; validate findings with HRBPs before publishing; use confidence intervals not point estimates; start with descriptive analytics to build trust before predictive |
| Data quality issues across HRIS sources |
Inconsistent coding, missing fields, stale records, or duplicate entries |
Establish data governance council; define data owners per field; run quarterly data quality audits; build automated validation checks at ingestion |
| Privacy concerns block analysis |
Insufficient anonymization, no consent framework, or regulatory gaps |
Apply k-anonymity (minimum group size of 5); conduct privacy impact assessment before each project; engage Legal early; use aggregated data when individual-level is not required |
| Engagement scores are flat despite interventions |
Measuring wrong drivers, action plans not executed, or survey is too generic |
Run driver analysis to identify high-impact low-score areas; assign action owners with quarterly check-ins; customize survey questions by department or function |
| Leadership does not act on insights |
Insights are too academic, lack business framing, or arrive too late |
Lead with business impact (revenue, cost, risk); limit recommendations to 2-3 with clear owners and timelines; deliver insights within 2 weeks of data collection |
Success Criteria
| Dimension |
Metric |
Target |
Measurement |
| Data Quality |
HRIS data completeness |
> 95% of required fields populated |
Quarterly data audit report |
| Data Quality |
Data freshness |
All records updated within 30 days |
HRIS last-modified timestamps |
| Adoption |
Stakeholder usage of dashboards |
> 70% of HRBPs and VPs access monthly |
Dashboard analytics / login tracking |
| Adoption |
Insight-to-action rate |
> 60% of recommendations result in initiatives |
Quarterly tracking of recommendation outcomes |
| Accuracy |
Attrition prediction precision |
> 70% precision at 50% recall |
Model evaluation against actuals (6-month lag) |
| Accuracy |
Survey driver analysis validity |
Top 3 drivers validated by qualitative data |
Cross-reference with exit interviews and focus groups |
| Impact |
Regrettable attrition reduction |
10-20% reduction within 12 months of intervention |
HRIS voluntary termination data, regrettable flag |
| Impact |
Time from question to insight |
< 2 weeks for standard analyses |
Request-to-delivery tracking |
| Compliance |
Privacy incidents |
Zero breaches of anonymity thresholds |
Audit log of all queries; minimum group size enforcement |
| Maturity |
Analytics maturity level progression |
Advance 1 level per 12-18 months |
Self-assessment against the Analytics Maturity Model |
Scope & Limitations
In Scope:
- Workforce descriptive analytics: headcount, turnover, retention, demographics, tenure distribution
- Engagement survey design, analysis, driver identification, and benchmarking
- Attrition risk scoring using rule-based and statistical methods (standard library only)
- Pay equity analysis: raw gap, controlled gap, outlier flagging
- DEI metrics: representation, progression rates, hiring funnel equity
- Workforce planning: headcount forecasting, scenario modeling, gap analysis
- Dashboard design and KPI framework recommendations
Out of Scope:
- Real-time predictive models requiring ML frameworks (scikit-learn, TensorFlow) -- scripts use rule-based scoring for portability
- Sentiment analysis of free-text survey responses (requires NLP libraries)
- Individual employee profiling or surveillance -- all analysis uses aggregated or anonymized data
- HRIS system administration, data pipeline engineering, or ETL development
- Legal interpretation of pay equity findings (requires Employment Law counsel)
- Organizational network analysis requiring email/calendar metadata
Known Limitations:
- Attrition risk scoring in scripts uses weighted heuristics, not trained ML models; accuracy depends on feature quality and weight calibration
- Pay equity analysis in the SKILL.md examples requires statsmodels (external dependency); scripts use standard-library approximations
- Survey analysis assumes Likert scale (1-5) responses; other formats require preprocessing
- Small population segments (< 30) produce unreliable statistical results; flag these in reporting
- Historical data biases (e.g., biased performance ratings) propagate into predictive models if not addressed
Integration Points
| System / Skill |
Integration |
Data Flow |
| HRIS (Workday, BambooHR, HiBob) |
Employee master data, tenure, compensation, performance ratings |
HRIS -> analytics data lake; analytics insights -> HRBP workforce plans |
| ATS (Greenhouse, Lever) |
Hiring funnel data, source-of-hire, time-to-fill |
ATS -> hiring analytics; quality-of-hire scoring feeds back to TA strategy |
| Survey Platform (Culture Amp, Qualtrics, Lattice) |
Engagement survey responses, eNPS, pulse check data |
Survey platform -> survey_analyzer.py; driver analysis -> action planning |
| Talent Acquisition skill |
Hiring funnel metrics, source effectiveness, quality of hire |
TA pipeline data -> analytics models; analytics insights -> sourcing optimization |
| HR Business Partner skill |
Workforce planning inputs, org health scoring, retention strategy |
Analytics insights -> HRBP recommendations; HRBP questions -> analytics projects |
| Operations Manager skill |
Headcount forecasting, capacity planning, productivity metrics |
Ops demand forecast -> headcount_planner.py; workforce metrics -> ops capacity models |
| Finance skill |
Compensation budgets, cost modeling, headcount budget vs actual |
Finance comp data -> pay equity analysis; headcount plan -> Finance budget model |
| Payroll (ADP, Gusto) |
Compensation actuals, bonus payouts, overtime data |
Payroll -> comp analysis; pay equity findings -> comp adjustment recommendations |
| BI Platform (Tableau, Looker, Power BI) |
Dashboard hosting, self-service analytics, scheduled reporting |
Analytics outputs -> BI dashboards; BI usage metrics -> adoption tracking |
1---
2name: people-analytics
3description: >
4 People analytics across workforce metrics, predictive modeling, and employee
5 insights. Use when building turnover models, analyzing engagement surveys,
6 running pay equity regressions, or scoring flight risk.
7license: MIT + Commons Clause
8metadata:
9 version: 1.0.0
10 author: borghei
11 category: hr-operations
12 updated: 2026-03-31
13 tags: [people-analytics, hr-metrics, workforce, insights, predictive]
14---
15
16# People Analytics
17
18The agent operates as a senior people analytics partner, translating workforce data into actionable insights using statistical modeling, segmentation analysis, and data governance best practices.
19
20## Clarify First
21
22Before generating the analysis, confirm these inputs. If any is unknown or vague, ASK — do not assume:
23
24- [ ] **Business question + success metric** — frames the entire analysis (step 1); a vague question yields an unfocused output
25- [ ] **Analysis type (descriptive, attrition risk, pay equity, or engagement driver)** — selects the method and which script applies
26- [ ] **Available data sources + their quality/completeness** — determines which method is even possible (step 2)
27- [ ] **Segments + privacy threshold (minimum group size)** — drives segmentation and the anonymization/aggregation applied
28
29Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
30
31## Workflow
32
331. **Frame the question** -- Clarify the business question with the HR or business stakeholder. Examples: "Why is Sales attrition 2x the company average?" or "Are we paying equitably across gender?" Define the success metric for the analysis.
342. **Assess data readiness** -- Identify required data sources (HRIS, ATS, survey platform, payroll). Check for completeness, recency, and quality. Flag any gaps before proceeding.
353. **Analyze** -- Apply the appropriate method from the analytics toolkit (descriptive stats, regression, classification, segmentation). Document assumptions and limitations.
364. **Validate findings** -- Sense-check results with domain experts (HRBPs, managers). Test for statistical significance and practical significance. Check predictive models for bias across protected groups.
375. **Recommend** -- Translate findings into 2-3 specific, actionable recommendations with expected impact and cost.
386. **Deliver and monitor** -- Present insights using the dashboard framework. Set up ongoing monitoring for key metrics with alert thresholds.
39
40> Checkpoint: After step 2, confirm that all data has been anonymized or aggregated to comply with privacy policy before analysis begins.
41
42## Analytics Maturity Model
43
44| Level | Name | Capabilities | Typical Questions Answered |
45|-------|------|-------------|---------------------------|
46| 1 | Operational Reporting | Headcount, compliance, ad-hoc queries | "How many people do we have?" |
47| 2 | Advanced Reporting | Dashboards, trends, benchmarking, segmentation | "How has attrition changed by quarter?" |
48| 3 | Analytics | Statistical analysis, correlation, root cause | "What drives attrition in Sales?" |
49| 4 | Predictive | Turnover prediction, performance modeling, risk scoring | "Who is likely to leave in the next 6 months?" |
50| 5 | Prescriptive | Automated recommendations, real-time interventions | "What should we do to retain this person?" |
51
52## Core HR Metrics
53
54### Workforce Metrics
55
56| Metric | Formula | Benchmark |
57|--------|---------|-----------|
58| Turnover Rate | (Separations / Avg HC) x 100 | 10-15% |
59| Retention Rate | (Retained / Starting HC) x 100 | 85-90% |
60| Time to Fill | Days from req open to offer accept | 30-45 days |
61| Cost per Hire | Total recruiting cost / Hires | $3-5K |
62| Regrettable Turnover | Regrettable exits / Total exits | < 30% |
63
64### Performance Metrics
65
66| Metric | Formula | Benchmark |
67|--------|---------|-----------|
68| High Performers | % rated top tier | 15-20% |
69| Goal Completion | Goals achieved / Goals set | 80%+ |
70| Promotion Rate | Promotions / Headcount | 8-12% |
71
72### Engagement Metrics
73
74| Metric | Formula | Benchmark |
75|--------|---------|-----------|
76| eNPS | Promoters % - Detractors % | 20-40 |
77| Engagement Score | Survey composite (1-100) | 70%+ |
78| Absenteeism | Absent days / Work days | < 3% |
79
80## Turnover Prediction Model
81
82```python
83import pandas as pd
84from sklearn.ensemble import RandomForestClassifier
85from sklearn.model_selection import train_test_split
86from sklearn.metrics import classification_report
87
88def build_turnover_model(employee_data: pd.DataFrame) -> dict:
89 """
90 Build and evaluate a turnover prediction model.
91
92 Input: DataFrame with columns for features + 'left_company' (0/1).
93 Output: dict with model, feature importance, and evaluation metrics.
94 """
95 features = [
96 'tenure_months', 'salary_ratio_to_market', 'performance_rating',
97 'months_since_last_promotion', 'manager_tenure', 'team_size',
98 'engagement_score', 'training_hours_ytd', 'projects_completed'
99 ]
100
101 X = employee_data[features]
102 y = employee_data['left_company']
103
104 X_train, X_test, y_train, y_test = train_test_split(
105 X, y, test_size=0.2, random_state=42, stratify=y
106 )
107
108 model = RandomForestClassifier(n_estimators=100, random_state=42)
109 model.fit(X_train, y_train)
110
111 y_pred = model.predict(X_test)
112 report = classification_report(y_test, y_pred, output_dict=True)
113
114 importance = (
115 pd.DataFrame({'feature': features, 'importance': model.feature_importances_})
116 .sort_values('importance', ascending=False)
117 )
118
119 return {'model': model, 'importance': importance, 'evaluation': report}
120
121
122def score_flight_risk(model, current_employees: pd.DataFrame) -> pd.DataFrame:
123 """
124 Score current employees for flight risk.
125
126 Returns DataFrame with employee_id, flight_risk_score (0-1), and risk_level.
127 """
128 probabilities = model.predict_proba(current_employees[model.feature_names_in_])[:, 1]
129
130 risk_levels = pd.cut(
131 probabilities,
132 bins=[0, 0.25, 0.50, 0.75, 1.0],
133 labels=['Low', 'Medium', 'High', 'Critical']
134 )
135
136 return pd.DataFrame({
137 'employee_id': current_employees['employee_id'],
138 'flight_risk_score': probabilities.round(3),
139 'risk_level': risk_levels
140 }).sort_values('flight_risk_score', ascending=False)
141```
142
143## Example: Sales Attrition Root-Cause Analysis
144
145```
146QUESTION
147 Sales voluntary turnover is 22% vs 12% company average. Why?
148
149DATA
150 Source: HRIS + engagement survey + exit interviews (n=45 exits, trailing 12 mo)
151
152ANALYSIS
153 Segmentation by tenure band:
154 < 1 yr: 35% of exits (onboarding/ramp issues)
155 1-2 yr: 40% of exits (comp dissatisfaction + career path)
156 2+ yr: 25% of exits (manager relationship)
157
158 Regression on exit survey scores (n=38 respondents):
159 Top drivers of intent-to-leave:
160 1. "I am paid fairly" (beta = -0.42, p < 0.01)
161 2. "I see a career path here" (beta = -0.31, p < 0.01)
162 3. "My manager supports my development" (beta = -0.28, p < 0.05)
163
164 Compensation benchmark:
165 Sales IC3 compa-ratio: 0.88 (12% below midpoint)
166 Sales IC2 compa-ratio: 0.91 (9% below midpoint)
167 Rest of company average: 0.98
168
169FINDINGS
170 1. Sales comp is significantly below market, especially at IC2-IC3
171 2. No defined career ladder for Sales ICs beyond IC3
172 3. New hires (< 1 yr) leaving due to unrealistic ramp expectations
173
174RECOMMENDATIONS
175 1. Market adjustment: Bring Sales IC2-IC3 to 95th percentile compa-ratio ($180K budget)
176 2. Publish a Sales career ladder through IC5 with clear promotion criteria
177 3. Redesign onboarding: extend ramp period from 30 to 90 days with milestone targets
178
179EXPECTED IMPACT
180 Reduce Sales attrition from 22% to 14-16% within 12 months
181 ROI: $180K adjustment saves ~$450K in replacement costs (10 fewer exits x $45K/hire)
182```
183
184## Pay Equity Analysis
185
186```python
187import pandas as pd
188import statsmodels.api as sm
189
190def analyze_pay_equity(employee_data: pd.DataFrame) -> dict:
191 """
192 Conduct pay equity analysis controlling for legitimate pay factors.
193
194 Returns raw gap, adjusted gap, model fit, and employees flagged for review.
195 """
196 # Raw gap
197 avg_by_gender = employee_data.groupby('gender')['salary'].mean()
198 raw_gap = (avg_by_gender['Female'] - avg_by_gender['Male']) / avg_by_gender['Male']
199
200 # Adjusted gap (control for level, tenure, performance, location)
201 controls = pd.get_dummies(
202 employee_data[['job_level', 'tenure_years', 'performance_rating', 'department', 'location']],
203 drop_first=True
204 )
205 controls = sm.add_constant(controls)
206 controls['is_female'] = (employee_data['gender'] == 'Female').astype(int)
207
208 model = sm.OLS(employee_data['salary'], controls).fit()
209 adjusted_gap = model.params['is_female']
210
211 # Flag outliers (residual > 2 std dev)
212 employee_data['predicted'] = model.predict(controls)
213 employee_data['residual'] = employee_data['salary'] - employee_data['predicted']
214 threshold = 2 * employee_data['residual'].std()
215 flagged = employee_data[abs(employee_data['residual']) > threshold]
216
217 return {
218 'raw_gap_pct': round(raw_gap * 100, 1),
219 'adjusted_gap_usd': round(adjusted_gap, 0),
220 'model_r_squared': round(model.rsquared, 3),
221 'employees_flagged': len(flagged),
222 'flagged_details': flagged[['employee_id', 'salary', 'predicted', 'residual']]
223 }
224```
225
226## Engagement Survey Analysis
227
2281. **Calculate response rate** -- Target 80%+ for statistical validity. Flag departments below 60%.
2292. **Compute category scores** -- Average Likert responses by category (Manager, Growth, Culture, Compensation). Compare to prior period.
2303. **Run driver analysis** -- Regress category scores against overall engagement to identify which categories have the highest impact on engagement.
2314. **Segment** -- Break results by department, level, tenure band, and location. Identify where scores diverge most from company average.
2325. **Prioritize** -- Plot categories on a 2x2 matrix (Impact vs Score). "High impact, low score" quadrant = priority action areas.
233
234> Checkpoint: Suppress results for any segment with fewer than 5 respondents to protect anonymity.
235
236## DEI Metrics Framework
237
238| Domain | Metrics | Data Source |
239|--------|---------|-------------|
240| Representation | Gender / ethnicity distribution by level | HRIS |
241| Pay equity | Raw gap, adjusted gap (controlled regression) | Payroll + HRIS |
242| Progression | Promotion rates by demographic group | HRIS |
243| Hiring | Offer and accept rates by demographic group | ATS |
244| Inclusion | Inclusion index, belonging score, psychological safety | Survey |
245
246## Data Governance Checklist
247
248Before starting any people analytics project:
249
250- [ ] Business question and purpose clearly documented
251- [ ] Data minimization applied (only collect what is needed)
252- [ ] Privacy impact assessment completed
253- [ ] Anonymization or aggregation applied where possible
254- [ ] Predictive models tested for bias across protected groups
255- [ ] Role-based access controls implemented
256- [ ] Data retention policy defined
257- [ ] Employee communication planned (transparency principle)
258
259## Reference Materials
260
261- `references/hr_metrics.md` - Complete HR metrics guide
262- `references/predictive_models.md` - Predictive modeling approaches
263- `references/survey_design.md` - Survey methodology
264- `references/data_ethics.md` - Ethical analytics practices
265
266## Scripts
267
268```bash
269# Analyze engagement survey results with driver analysis
270python scripts/survey_analyzer.py --file survey_results.csv
271python scripts/survey_analyzer.py --file survey_results.csv --prior prior_survey.csv --json
272
273# Score attrition risk from employee data
274python scripts/attrition_predictor.py --file employees.csv
275python scripts/attrition_predictor.py --file employees.csv --threshold 0.7 --json
276
277# Workforce headcount planning calculations
278python scripts/headcount_planner.py --file workforce.csv --growth 0.15 --attrition 0.12
279python scripts/headcount_planner.py --file workforce.csv --growth 0.15 --attrition 0.12 --json
280```
281
282## Troubleshooting
283
284| Problem | Root Cause | Resolution |
285|---------|-----------|------------|
286| Low survey response rate (< 70%) | Survey fatigue, lack of trust in anonymity, or no visible action from prior surveys | Shorten survey to 15-20 questions max; communicate anonymity safeguards clearly; publish and act on top 3 findings from prior survey before launching next one |
287| Attrition model produces too many false positives | Overfitting on historical data, missing key features, or class imbalance | Add regularization; use SMOTE or class weights to handle imbalance; validate with cross-validation not just train/test split; include manager quality and comp-ratio as features |
288| Stakeholders distrust analytics findings | Results contradict lived experience, or methodology is opaque | Present methodology transparently; validate findings with HRBPs before publishing; use confidence intervals not point estimates; start with descriptive analytics to build trust before predictive |
289| Data quality issues across HRIS sources | Inconsistent coding, missing fields, stale records, or duplicate entries | Establish data governance council; define data owners per field; run quarterly data quality audits; build automated validation checks at ingestion |
290| Privacy concerns block analysis | Insufficient anonymization, no consent framework, or regulatory gaps | Apply k-anonymity (minimum group size of 5); conduct privacy impact assessment before each project; engage Legal early; use aggregated data when individual-level is not required |
291| Engagement scores are flat despite interventions | Measuring wrong drivers, action plans not executed, or survey is too generic | Run driver analysis to identify high-impact low-score areas; assign action owners with quarterly check-ins; customize survey questions by department or function |
292| Leadership does not act on insights | Insights are too academic, lack business framing, or arrive too late | Lead with business impact (revenue, cost, risk); limit recommendations to 2-3 with clear owners and timelines; deliver insights within 2 weeks of data collection |
293
294## Success Criteria
295
296| Dimension | Metric | Target | Measurement |
297|-----------|--------|--------|-------------|
298| Data Quality | HRIS data completeness | > 95% of required fields populated | Quarterly data audit report |
299| Data Quality | Data freshness | All records updated within 30 days | HRIS last-modified timestamps |
300| Adoption | Stakeholder usage of dashboards | > 70% of HRBPs and VPs access monthly | Dashboard analytics / login tracking |
301| Adoption | Insight-to-action rate | > 60% of recommendations result in initiatives | Quarterly tracking of recommendation outcomes |
302| Accuracy | Attrition prediction precision | > 70% precision at 50% recall | Model evaluation against actuals (6-month lag) |
303| Accuracy | Survey driver analysis validity | Top 3 drivers validated by qualitative data | Cross-reference with exit interviews and focus groups |
304| Impact | Regrettable attrition reduction | 10-20% reduction within 12 months of intervention | HRIS voluntary termination data, regrettable flag |
305| Impact | Time from question to insight | < 2 weeks for standard analyses | Request-to-delivery tracking |
306| Compliance | Privacy incidents | Zero breaches of anonymity thresholds | Audit log of all queries; minimum group size enforcement |
307| Maturity | Analytics maturity level progression | Advance 1 level per 12-18 months | Self-assessment against the Analytics Maturity Model |
308
309## Scope & Limitations
310
311**In Scope:**
312- Workforce descriptive analytics: headcount, turnover, retention, demographics, tenure distribution
313- Engagement survey design, analysis, driver identification, and benchmarking
314- Attrition risk scoring using rule-based and statistical methods (standard library only)
315- Pay equity analysis: raw gap, controlled gap, outlier flagging
316- DEI metrics: representation, progression rates, hiring funnel equity
317- Workforce planning: headcount forecasting, scenario modeling, gap analysis
318- Dashboard design and KPI framework recommendations
319
320**Out of Scope:**
321- Real-time predictive models requiring ML frameworks (scikit-learn, TensorFlow) -- scripts use rule-based scoring for portability
322- Sentiment analysis of free-text survey responses (requires NLP libraries)
323- Individual employee profiling or surveillance -- all analysis uses aggregated or anonymized data
324- HRIS system administration, data pipeline engineering, or ETL development
325- Legal interpretation of pay equity findings (requires Employment Law counsel)
326- Organizational network analysis requiring email/calendar metadata
327
328**Known Limitations:**
329- Attrition risk scoring in scripts uses weighted heuristics, not trained ML models; accuracy depends on feature quality and weight calibration
330- Pay equity analysis in the SKILL.md examples requires statsmodels (external dependency); scripts use standard-library approximations
331- Survey analysis assumes Likert scale (1-5) responses; other formats require preprocessing
332- Small population segments (< 30) produce unreliable statistical results; flag these in reporting
333- Historical data biases (e.g., biased performance ratings) propagate into predictive models if not addressed
334
335## Integration Points
336
337| System / Skill | Integration | Data Flow |
338|----------------|-------------|-----------|
339| **HRIS** (Workday, BambooHR, HiBob) | Employee master data, tenure, compensation, performance ratings | HRIS -> analytics data lake; analytics insights -> HRBP workforce plans |
340| **ATS** (Greenhouse, Lever) | Hiring funnel data, source-of-hire, time-to-fill | ATS -> hiring analytics; quality-of-hire scoring feeds back to TA strategy |
341| **Survey Platform** (Culture Amp, Qualtrics, Lattice) | Engagement survey responses, eNPS, pulse check data | Survey platform -> survey_analyzer.py; driver analysis -> action planning |
342| **Talent Acquisition** skill | Hiring funnel metrics, source effectiveness, quality of hire | TA pipeline data -> analytics models; analytics insights -> sourcing optimization |
343| **HR Business Partner** skill | Workforce planning inputs, org health scoring, retention strategy | Analytics insights -> HRBP recommendations; HRBP questions -> analytics projects |
344| **Operations Manager** skill | Headcount forecasting, capacity planning, productivity metrics | Ops demand forecast -> headcount_planner.py; workforce metrics -> ops capacity models |
345| **Finance** skill | Compensation budgets, cost modeling, headcount budget vs actual | Finance comp data -> pay equity analysis; headcount plan -> Finance budget model |
346| **Payroll** (ADP, Gusto) | Compensation actuals, bonus payouts, overtime data | Payroll -> comp analysis; pay equity findings -> comp adjustment recommendations |
347| **BI Platform** (Tableau, Looker, Power BI) | Dashboard hosting, self-service analytics, scheduled reporting | Analytics outputs -> BI dashboards; BI usage metrics -> adoption tracking |