2 Replies Latest reply on Sep 8, 2016 12:58 PM by Bora Beran

    How to get Adj. R-Squared of Linear Model using the R integration

    Clayton Chapman

      Howdy,

       

      I have ran into a bit of a conundrum. We are using the R integration with our tableau dashboards to better represent our linear models (models used loosely here). An example of one of our R scripts is below:

      SCRIPT_REAL("mydata <- data.frame(cbind(solved=.arg1, mttr=.arg2, avgReplies=.arg3, avgReopen=.arg4));

      fit <-lm(solved[-78] ~ mttr[-78] + avgReplies[-78] + avgReopen[-78], data=mydata);

      mydata$solved[78]<-predict(fit,list(mttr=.arg5[4], avgReplies=.arg6[4], avgReopen=.arg7[4]));

      mydata$solved",count([Solved At]),AVG([Full Resolution Time In Minutes]/60/24),AVG([Replies]),AVG([Reopens]), [What If - MTTR],[What If - Replies],[What If - Reopens])

       

      We fit this model as a line graph and then compare it to actual, use parameters, all sorts of fun stuff.

       

      Now the issue I am having is that I'd like to display some of the summary data from this model (R squared, adj. R-Squared, etc). Usually I grab this from R itself using just: summary(lm(speed~dist, cars))$adj.r.squared (for example). But I am having trouble with getting the calculation to actually spit out any of the values - I'm really only interested in one value.

       

      This is the calculation that I have been trying to get to work:

      SCRIPT_int("mydata <- data.frame(cbind(solved=.arg1, mttr=.arg2, avgReplies=.arg3, avgReopen=.arg4));

      summary(lm(solved[-78] ~ mttr[-78] + avgReplies[-78] + avgReopen[-78], data=mydata)$adj.r.squared"

      ,count([Solved At]),AVG([Full Resolution Time In Minutes]/60/24),AVG([Replies]),AVG([Reopens]))

       

       

      Please let me know where I might have gone wrong.