#### Overview of this book

Tableau and R offer accessible analytics by allowing a combination of easy-to-use data visualization along with industry-standard, robust statistical computation. Moving from data visualization into deeper, more advanced analytics? This book will intensify data skills for data viz-savvy users who want to move into analytics and data science in order to enhance their businesses by harnessing the analytical power of R and the stunning visualization capabilities of Tableau. Readers will come across a wide range of machine learning algorithms and learn how descriptive, prescriptive, predictive, and visually appealing analytical solutions can be designed with R and Tableau. In order to maximize learning, hands-on examples will ease the transition from being a data-savvy user to a data analyst using sound statistical tools to perform advanced analytics. By the end of this book, you will get to grips with advanced calculations in R and Tableau for analytics and prediction with the help of use cases and hands-on examples.
Advanced Analytics with R and Tableau
Credits
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
Advanced Analytics with R and Tableau
The Power of R
A Methodology for Advanced Analytics Using Tableau and R
Prediction with R and Tableau Using Regression
Classifying Data with Tableau
Index

## Building a simple decision system-based Bayesian theory

In this section, we build a simple decision system using Bayesian theory. A smart water system is a smart system that controls water. In general, you can see the system architecture in the following figure:

After using a sensing process on water to obtain the water quality, you can make a decision. If the water quality is good, we can transfer the water to customers. Otherwise, we purify the water.

To implement a decision system-based Bayesian theory, firstly we define the state of nature. In this case, we define two states of nature:

• ω1: Water is ready for drinking

• ω2: Water should be cleaned (kotor)

For inputs, we can declare x1 and x2 as negative and positive as the observation results. We define prior values and class conditional probabilities as follows:

To build a decision, we should make a loss function. The following is a loss function for our program: