Tableau 8.1: Predictive Analytics with R



hello and welcome to the Thorogood associates video on predictive analytics using our integration in tableau 8.1 my name is Meir Newton and I am a business intelligence consultant with Thorogood Associates Thorogood is a strategic alliance partner with tableau the release of tableau 8.1 included capability for connecting tableau to our for performing complex statistical analysis right within tableau today we'll focus on predictive analytics specifically multivariate regression for information on getting started with our or for examples of other use cases please check out the other videos in this series in this video I'll explain how R can be used in conjunction with tableau to expand upon the native regression capability that's present in tableau I'll show you how you can build expressions to perform regression using multiple variables for better predictive modeling and then I'll also demonstrate how you can begin to test and analyze the model that you put together to show you how this all works I'll first open up tableau and start a new worksheet I'm connected to tableau superstore sample data and I've actually added in some extra customer information for use in this demonstration so I've just joined that in with my overall order stable now I've already created a calculated field called predicted sales within my data source so I'll open up that calculation and I'll show it to you now I'm using the script real function here which will pass my R script from tableau back to R and then return real numbers as a result I'm passing a basic linear regression back to R using sales as my dependent variable here and then several customer inputs including age income number of months as a customer number of orders and days since last order as my independent variables this is a basic linear model but I could expand on this such as by converting my number of months as customer input from linear to logarithmic to do that I'll simply wrap that number of months as customer field in a log function I also could utilize other models entirely if they happen to better fit my data now that I have my equation set I can click OK and begin to do some analysis on my model let's say I want to use my prediction model based on customer variables to predict sales at a state level I can pull state onto my rows and then I can pull my sales measure over to my columns and then I'll also bring my new predicted sales measure over to my columns now I have two bar charts but I want to be able to compare these so I'm going to switch this to dual access and then I'll synchronize my axes so that the scale is the same my default here is showing each mark as a circle but I'd rather see my sales figures as a bar so I'll use my marks card to change my sales from a circle to a bar and then lastly I'd rather up coloring that corresponds to the variance between my actual sales and my predicted sales so that I can better highlight where there are differences so I've created another calculated field here that calculates my prediction variance in this case my prediction variance is just a subtraction of my actual sales from my predicted sales so I'll switch over to my predicted sales marks card and I'll pull prediction variance over onto my color based on this view it looks like my model is OK at a state level to better quantify my model accuracy I'm going to pull open a new worksheet and do a little bit more analysis this time rather than creating a bar chart I'm gonna pull sales onto my x-axis and predicted sales onto my y-axis I'm interested in my state level detail so I'll pull State onto my marks card as the detail and now initially since my predicted sales is a table calculation it's defaulting to calculating across my table however I actually want to calculate my predictions at the state level so I'll adjust my predicted sales calculation to do just that now this looks a little bit more realistic now I can utilize some if tableaus native capability to get a better understanding of my model accuracy I can right click and I can add in a trendline I can bring region on to my colors and I can break out my model a bit further I can also go back and change the level of detail that I'm looking at to see how accurate my model is for predicting sales against other dimensions like product category or product subcategory that concludes this demonstration on complex regression analysis in tableau using our thanks for watching if you have any questions please feel free to email me at mayer dot Newton at Thorogood comm you can also visit our website at www.archives.gov/calendar

6 Comments

  1. Nicolò Franchini said:

    I get an error message "IPC_SocketConnection::Read(len=16, connection=127.0.0.1:53039->127.0.0.1:6311): The connection was closed by the peer in IPC_Socket::Recv(len=16)". Tried to find multiple ways to troubleshoot this but couldn't. Appreciate if you could assist me. Thanks!

    June 29, 2019
    Reply
  2. Julibeth Tinoco said:

    Hi , this it my code """"""SCRIPT_REAL("
    [PROMEDIO DIARIO PM25 DETALLE MES]<- .arg1;
    [Fecha]<- .arg2;

    fit <- lm([PROMEDIO DIARIO PM25 DETALLE MES]~[Fecha])

    fit$fitted",

    SUM([PROMEDIO DIARIO PM25 DETALLE MES])
    )"""""""""

    but tableau show "error conection"…my conection is it good . i dont now what happens! help me please!

    June 29, 2019
    Reply
  3. 12GrootYungHers said:

    Advanced Predictive Modelling in R – Self-Paced
    https://twitter.com/schwenzltwt/status/820091445788823552

    June 29, 2019
    Reply
  4. Srini A said:

    Error – R Serve – 6311 No Connection could be made because the target machine actively refused it
    how should I over come this ?
    This video is an awesome demo
    Can I download the workbook you have it in this video ?

    June 29, 2019
    Reply
  5. chandra bhatt said:

    @Andrew Scotchmer: Agreed that we can do entire analysis in R. Tableau is adding a flexibility of drag and drop visualization. To draw similar visualization I find R code would look bit complex. For me Tableau saves a lot of time which would require a steep learning curve in R otherwise.

    June 29, 2019
    Reply
  6. Mr. Scotchpie said:

    Surely you can do the same analysis entirely in R?  In which case why use yet another layer, namely Tableau?

    June 29, 2019
    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *