Advanced analytics
Advanced Analytics
Machine learning, regression, and statistical analysis for Viva Insights data, including random forest top-performer models, information value, pairwise chi-square tests, difference-in-differences intervention evaluation, meeting engagement drivers, and collaboration by time of day in R and Python.
Advanced Analytics Scripts
This page covers machine learning, regression models, and statistical analysis techniques for Viva Insights data — from predicting top performance and selecting predictive features, to testing for significant associations, to measuring the real-world impact of a program or intervention.
Pick a card to jump straight to a technique, or read the short intro above each section for guidance on which one fits your question.
Machine Learning & Predictive Modeling
Top Performers Modeling
Understand the drivers behind top performance, where top performance is usually a business outcome metric uploaded into Viva Insights. The scripts below use a random forest model, which handles non-linear relationships, provides feature importance rankings, and is robust to outliers and missing values. The same technique can predict other outcomes too, such as high engagement or likelihood to stay (using sentiment surveys). Random Forest is best when you have sufficient sample size (typically 100+ observations) and want robust predictions with feature importance rankings — for smaller samples or a first pass at feature selection, see Information Value below.
- Purpose: Identify characteristics of top performers using Random Forest
- Format: R Markdown
- Prerequisites: vivainsights R package, randomForest, dplyr
- Key Features: Feature importance analysis, model validation, performance metrics
- 📥 Download
- 🌐 View HTML Output
- Purpose: Identify characteristics of top performers using Random Forest
- Format: Jupyter Notebook
- Prerequisites: vivainsights Python package, scikit-learn, pandas
- Key Features: Feature importance analysis, model validation, performance metrics
- 📥 Download
Statistical Analysis
Information Value Analysis
Feature selection: understand which Viva Insights metrics are most predictive of a categorical outcome variable, identifying variables with strong predictive power while avoiding overfitting. Use Information Value (IV) for initial feature selection, with limited sample sizes, or to understand the univariate predictive power of individual variables before building a more complex model like the Random Forest above — it’s particularly valuable for preprocessing large numbers of potential predictors.
- Purpose: Calculate Information Value (IV) for feature selection and variable importance
- Format: R Markdown
- Prerequisites: vivainsights R package, Information, dplyr
- Key Features: IV calculation, binning strategies, feature ranking
- 📥 Download
- Purpose: Calculate Information Value (IV) for feature selection and variable importance
- Format: Jupyter Notebook
- Prerequisites: vivainsights Python package, pandas, numpy
- Key Features: IV calculation, binning strategies, feature ranking
- 📥 Download
Pairwise Chi-Square Tests
Statistical hypothesis testing for significant associations between categorical variables — typically organizational attributes (department, level, location) or survey attributes — and collaboration patterns or behaviors. Multiple testing corrections control for false discovery rates when running many simultaneous comparisons, keeping the conclusions reliable.
- Purpose: Perform pairwise chi-square tests for categorical variables
- Format: R Markdown
- Prerequisites: vivainsights R package, stats
- Key Features: Multiple testing correction, p-value adjustment, significance testing
- 📥 Download
- 🌐 View HTML Output
- Purpose: Perform pairwise chi-square tests for categorical variables
- Prerequisites: vivainsights Python package, scipy, pandas
- Key Features: Multiple testing correction, p-value adjustment, significance testing
- 📥 Download
Behavioral & Program Analysis
These examples move from modelling attributes to answering practical workplace questions. Because the sample datasets don’t contain the hourly buckets, a real intervention, or enough multi-person meetings needed below, each script generates a small, clearly labelled simulated dataset that shares the column names of a real query — so the same downstream code runs unchanged on your own export.
Collaboration by Time of Day
Estimate a typical start and end of day from hourly collaboration metrics, and show how those hours shift by weekday and by role.
📄 collaboration-by-time-of-day.Rmd
- Purpose: Estimate a typical start and end of day from hourly collaboration metrics
- Format: R Markdown
- Prerequisites: vivainsights R package, tidyverse, lubridate
- Key Features: Hourly activity matrix, two-stage aggregation, cuts by weekday and role
- 📥 Download
- 🌐 View HTML Output
📄 collaboration-by-time-of-day.py
- Purpose: Estimate a typical start and end of day from hourly collaboration metrics
- Prerequisites: vivainsights Python package, pandas, numpy
- Key Features: Hourly activity matrix, two-stage aggregation, cuts by weekday and role
- 📥 Download
Evaluating a Workplace Intervention
Set up a treated-versus-control, difference-in-differences design so a genuine programme effect can be separated from a company-wide or seasonal trend — directly applicable to measuring the impact of a Microsoft 365 Copilot enablement wave.
- Purpose: Measure a workplace intervention with a treated-vs-control difference-in-differences design
- Format: R Markdown
- Prerequisites: vivainsights R package, tidyverse
- Key Features: Before/During/After windows, difference-in-differences, two-stage aggregation, displacement checks
- 📥 Download
- 🌐 View HTML Output
- Purpose: Measure a workplace intervention with a treated-vs-control difference-in-differences design
- Prerequisites: vivainsights Python package, pandas, numpy
- Key Features: Before/During/After windows, difference-in-differences, two-stage aggregation, displacement checks
- 📥 Download
Meeting Engagement Drivers
Model in-meeting messaging as a proxy for disengagement and rank the meeting characteristics that drive it, then take a closer look at meeting duration to separate a real effect from simple exposure.
📄 meeting-engagement-drivers.Rmd
- Purpose: Rank the meeting characteristics that drive in-meeting messaging as a proxy for disengagement
- Format: R Markdown
- Prerequisites: vivainsights R package, tidyverse, randomForest
- Key Features: Meeting-level modelling, random forest permutation importance, rate-vs-exposure duration analysis
- 📥 Download
- 🌐 View HTML Output
📄 meeting-engagement-drivers.py
- Purpose: Rank the meeting characteristics that drive in-meeting messaging as a proxy for disengagement
- Prerequisites: vivainsights Python package, scikit-learn, pandas, numpy
- Key Features: Meeting-level modelling, random forest permutation importance, rate-vs-exposure duration analysis
- 📥 Download
Sample Datasets
Simulated Person Query
- Purpose: Simulated person-level data for analysis
- Format: CSV
- Contents: Weekly collaboration metrics, meeting data, email patterns
Analysis Workflows
1. Feature Selection Workflow
- Load Data: Import your Viva Insights query results
- Information Value: Run IV analysis to identify important variables
- Statistical Testing: Use chi-square tests for categorical relationships
- Model Building: Apply selected features to predictive models
2. Top Performers Analysis Workflow
- Data Preparation: Clean and prepare performance data
- Feature Engineering: Create relevant collaboration metrics
- Model Training: Train Random Forest model
- Interpretation: Analyze feature importance and model results
- Validation: Test model performance on holdout data
3. Statistical Analysis Workflow
- Exploratory Analysis: Understand data distributions
- Hypothesis Testing: Test relationships between variables
- Effect Size: Calculate practical significance
- Reporting: Generate analysis reports
Prerequisites
R Environment
install.packages(c("vivainsights", "dplyr", "tidyr", "ggplot2", "scales", "purrr", "randomForest", "fixest", "Information", "rmarkdown"))
Python Environment
pip install vivainsights pandas numpy scikit-learn linearmodels matplotlib seaborn jupyter
Best Practices
- Data Quality: Always validate your data before analysis
- Feature Selection: Use IV analysis to identify meaningful variables
- Model Validation: Always test models on holdout data
- Statistical Significance: Consider both statistical and practical significance
- Documentation: Document your analysis methodology and assumptions
Related pages
- Causal Inference in Copilot Analytics: move beyond correlation to measure the true impact of an intervention
- Network Analysis: organizational network analysis (ONA) as a complementary advanced technique
- Copilot Analytics: adoption metrics and Power/Habitual user segmentation
- Essentials: utilities and visualizations to prepare your data
- Getting Started: environment setup and first steps
Need Help?
- Machine Learning: Scikit-learn Documentation
- Statistical Analysis: R Stats Documentation
- Viva Insights: Package Documentation
- Sample Data: Example datasets