Welcome to the AI and Statistics series!
Let’s dive into how AI can transform tabular data into various types of charts.
Today, we will be using a Column Table with paired data structure to generate a Line Plot and Estimation plot. Additionally exploring the paired samples t-test analysis using paired data.
This statistical method can identify differences in treatment effects within related samples, offering advantages over other visualizations by clearly illustrating before-and-after changes in a subject.

Our analysis can provide insights on how treatments affect a group, much like how medical trials may show patient health improvements over time.
Don’t worry about using the AI Agent-driven Bayeslab, all you need is natural language to get the data analysis result.
All content will be explained in the most comprehensible natural language descriptions to help you get started with data analysis from scratch.
We’ll start with a data table featuring three columns: Control, Treated, and Diff.
This paired data sample allows us to test for treatment effects on related data points.
We’ll delve into how these prompts influence the final charts and uncover techniques for effective data visualization.

Our analysis can provide insights on how treatments affect a group, much like how medical trials may show patient health improvements over time.
Don’t worry about using the AI Agent-driven Bayeslab, all you need is natural language to get the data analysis result.
All content will be explained in the most comprehensible natural language descriptions to help you get started with data analysis from scratch.
We’ll start with a data table featuring three columns: Control, Treated, and Diff.
This paired data sample allows us to test for treatment effects on related data points.
We’ll delve into how these prompts influence the final charts and uncover techniques for effective data visualization.

Paired t-test is suitable for two groups of non-independent data, meaning the data should be matched and correlated.
The four possible outcomes of a paired t-test are:
The samples are highly correlated and the difference is significant, indicating that the experiment is effective.
The samples are not highly correlated but the difference is significant, suggesting that the difference may be caused by other factors.
The samples are highly correlated but the difference is not significant, indicating that the correlation makes the difference not apparent.
The samples are not highly correlated, and the difference is not significant, indicating that the experiment did not meet expectations.
In this case, we used measurements of factor X before and after treatment for ten patients to determine if there is a significant change in factor X levels after treatment.
In just 2 minutes, you’ll learn to effectively analyze paired data using visualizations!
Using different prompt inputs, we’ll demonstrate how AI generates insights from paired data analysis, our steps will include:
Step 1 — Perform a Normality test on the difference column.
Step 2 — Execute a Paired samples t-test.
Step 3 — Generate a Paired samples line plot.
Step 4 — Create an initial Paired samples estimation plot.
Step 5 — Optimize the Estimation plot with fine-tuning.
Step 1 — Perform a Normality test on the difference column.
Perform a Normality test on the differences in paired samples.
The prompt is:

Once the above prompt is written, click ‘Run’ to view the distribution test results for normality in “Test for normal distribution.txt”.

Step 2 — Execute a Paired samples t-test.
Carry out a Paired samples t-test on the Control and Treated columns.
The prompt is:

Once the above prompt is written, click ‘Run’ to get the t-test results in “Paired t test.txt”.

Step 3 — Generate a Paired samples line plot.
Create a Paired samples line plot connecting pre- and post-treatment data for subjects.
The prompt is:

Once the above prompt is written, click ‘Run’ to see a line plot with connected pairs.
Step 4- Create an initial Paired samples estimation plot.
Draw an initial Paired samples estimation plot with scatter points.
The prompt is:


Once the above prompt is written, click ‘Run’ to generate a preliminary estimation visualization.
Step 5- Optimize the Estimation plot with fine-tuning.
Optimize the Estimation plot through fine-tuning rounds.
This includes:
Finetuning-1: Adjust the alignment of Y1 and Y2 axes.
Finetuning-2: Correct plotting on the third dimension using “Diff”.
Finetuning-3: Refine differences plotted on Y2.


Once the above prompt is written, click ‘Run’ to see the refined estimation plot.
Thank you for reading this installment of the AI and Statistics series!
We showed how you can effectively use paired samples analyses to visualize and comprehend treatment impacts.
Stay tuned for our upcoming demonstrations to explore more fascinating data visualization.
Using AI Agent and Bayeslab, anyone can organize, analyze, plot data charts, and make business data predictions like a professional data analyst based on previous data.
About Bayeslab
Bayeslab: Website
The AI First Data Workbench
X: @BayeslabAI
Documents:
https://bayeslab.gitbook.io/docs
Blogs:

Bayeslab is a powerful web-based AI code editor and data analysis assistant designed to cater to a diverse group of users, including :
👥 data analysts ,🧑🏼🔬experimental scientists, 📊statisticians, 👨🏿💻 business analysts, 👩🎓university students, 🖍️academic writers, 👩🏽🏫scholars, and ⌨️ Python learners.