• Home
  • Swinburne University of Technology
  • Data Mining
  • Installing and Using R, RStudio, and Rattle for Data Mining

Installing and Using R, RStudio, and Rattle for Data Mining

STA30004: Data Mining Tutorial Week 7 a) Installing R, then RStudio and finally rattle R and RStudio have already been installed in the computer lab but you may need to install them at home. We recommend the Melbourne(1) CRAN. (See https://www.r-project.org/ and https://www.rstudio.com/products/rstudio/download/). Now instructions for loading rattle. This has to be done in the computer lab and at home after entering RStudio. It does not work for me if I do not have RStudio open. Choose the appropriate platform. In the lab we are using Windows. Use the Melbourne(1) CRAN mirror when prompted. You may be prompted to load additional packages. The previous problem with Rattle has been fixed so the following should now work on any Windows platform. Windows > install. packages ("rattle") b) In RStudio command line enter the following one line at a time. > library(rattle) rattle() c) Click on Execute in the GUI and ask for weather.csv i) Check that Rattle has correctly guessed the data type for each variable. ii) Use the View button to see the worksheet. iii) Be careful with the Edit button. Document any changes. d) Assign appropriate roles i) RainTomorrow is the Target Variable. ii) Risk_MM=amount of rain tomorrow identified as a RISK variable by name iii) Date has an Identity role. iv) Location must be ignored because there is no useful information in this variable. Always set equal to "Canberra". v) All other variables should have an Input role vi) Ignore the categorical variable (WindDir and WindGustDir) 1 vii) Use a 70/15/15 partition for the data. 2 e) Run a linear regression model with Rain Tomorrow as target using a logit link function. Is this model overfitted? Why? What is the AIC? This answers are based on my sample selection you may have slightly different coefficients Yes- Non significant variables present in the model which will make the model more complex 138.4 (AIC-Akaike information criterion Gives an estimate of information loss of the built model. It trade-off between the goodness of fit and complexity parameter of the model.) f) Refit this model using only the significant predictors (p <. 05). What is the AIC? Smaller is better. AIC-128.56 This model is better g) Calculate and interpret the odds ratios for the predictors in this new model. Variable Sunshine WindGustSpeed 0.08837 WindSpeed3pm -0.10909 Pressure9am Pressure3pm Coefficient (B) -0.45820 0.77492 -1.04419 Exp(B ) 0.632 1.092 0.897 2.170 0.352 Interpret odds ratios 37% reduction in the odds of the event on average of the event when sunshine is increased by 1, when other predictors are controlled. 9% increase in the odds of the event on average of the event when windgustspeed is increased by 1, when other predictors are controlled. 10.3% reduction in the odds of the event on average of the event when windspeed3pm is increased by 1, when other predictors are controlled. 117% increase in the odds of the event on average of the event when Pressure9am is increased by 1, when other predictors are controlled. 64.8% reduction in the