# SIT718 Using aggregation functions for data analysis

**The provided zip file contains the data file [***Energy20.txt ***] and the R code [***AggWaFit718.R ***] to use with the following tasks, include these in your R working directory. **

## Energy Prediction of Domestic Appliances Dataset

The given dataset, {"Energy20.txt"}, can be used to create models of energy use of appliances in a energy-efficient house. The dataset provides the Energy use of appliances (denoted as Y) using 671 samples. It is a modified version of data used in the study [1]. The dataset includes 5 variables, denoted as X1, X2, X3, X4, X5, and Y, described as follows:

**X1**: Temperature in kitchen area, in Celsius

**X2**: Humidity in kitchen area, given as a percentage

**X3**: Temperature outside (from weather station), in Celsius

**X4**: Humidity outside (from weather station), given as a percentage

**X5**: Visibility (from weather station), in km

**Y**: Energy use of appliances, in Wh

**Assignment Tasks **

## 1. Understand the data [20 marks]

- Download the txt file (Energy20.txt) from Future Learn and save it to your R working directory.
- Assign the data to a matrix, e.g. using data <- as.matrix(read.table({"Energy20.txt "}))
- The
is Energy use of appliances (Y). To investigate Y, generate a subset of 320 data, e.g. using:*variable of interest*

my.data <- the.data[sample(1:671,320),c(1:6)]

- Using scatter plots and histograms, report on the general relationship between each of the variables X1, X2, X3, X4, X5 and the
*variable of interest*Include 5 scatter plots, 6 histograms, and 1 or 2 sentences for each of the variables, including the variable of interest Y.

## 2. Transform the data [10 marks]

- Choose any
**four**from the five variables (X1, X2,..,X5). Make appropriate transformations to the chosen four variables and the variable of interest Y individually, so that the values can be aggregated in order to predict the*variable of interest*. Assign your*transformed*data along with your*transformed*variable of interest to an array (it should be 320 rows and 5 columns). Save it to a txt file titled {"name- transformed.txt"} using table(your.data,{"name-transformed.txt"}) where βnameβ is replaced with your name - you can use your surname or first name. [__All the following tasks are based on the transformed data sample__] - Briefly explain the transformations applied for the selected four variables and the
*variable of interest*. (1- 2 sentences each)

## 3. Build models and investigate the importance of each variable [30 marks]

Put the AggWaFit718.R file to your working directory and load into the R workspace using, source({"AggWaFit718.R"})- Use the fitting functions to learn the parameters for
- A weighted arithmetic mean (WAM)
- Weighted power means (WPM) with
*p*= 0.1, and*p*= 10 [__Define your own generator____in your script rather than change the AggWaFit718.R__] An ordered weighted averaging function (OWA), and - A Choquet integral.

- Include two tables in your report - one with the error measures and correlation coefficients, and one summarising the weights/parameters and any other useful information learned for your data.
- Compare and interpret the data in your tables. Comment on
- How good the model is,
- The importance of each of the variables (the four variables that you have selected),
- Any interaction between any of those variables (are they complementary or redundant?) and
- Better models favour higher or lower inputs.

(1-3 paragraphs for part 3(iv))

## 4. Use your model for prediction [20 marks]

- Choose your best fitting model based on Q3(iv). Using your best fitting model, predict the Energy use of appliances for the following input

X1=16; X2=38; X3=4; X4=77; X5=31. Briefly describe the result. [You should use the same pre-process as in Q2]

- Give your comment on whether you think it is reasonable. (1-2 sentences).
- Comment on the best conditions (in terms of your chosen four variables) under which a low Energy use of appliances will occur. (1-2 sentences).

## 5. Comparing with a linear regression model [20 marks]

Linear regression is used to predict the value of an outcome variable Y based on one or more input predictor variables X. The equation is π = π_{π }+ π_{π}πΏ_{π }+ π_{π}πΏ_{π }+ β― π_{π§}πΏ_{π }+ πΊ. The builtin function lm() is used to fit linear models in R.

- Build your linear model using the same dataset in Question 3 and describe the summary statistics for your model using the function summary().
- Compare the performance of the linear model you got with your best fitting model in Question 4. Visualise the predicted Y values of both models on the 320 data and compare them with the true Y values.
- Give your comment on the differences between the linear model and your best fitting model. (2-4 sentences).

All supporting information should be presented in the pdf report. It will be assessed for style and grammar, professional presentation of figures, tables and references. List and quote in the text the

references used, including books, articles and web resources.

Use the Harvard style: https://www.deakin.edu.au/students/studying/study-support/referencing/harvard

Your final submission must include the following **three** files:

- A report, "
**name-report.pdf**", in pdf format (created in any word processor), covering all of the items in above (where βnameβ is replaced with your name -you can use your surname or first name). The total report must be**up to 8 pages**, only excluding a cover page which contains your full name and student ID. - A data file named "
**name-transformed.txt**" - just to help us distinguish them!). - The R code file (that you have written to produce your results) named "
**name- code.R**" (where βnameβ is replaced with your surname or first name).

References:

- Luis M. Candanedo, Veronique Feldheim, Dominique Deramaix. Data driven prediction models of energy use of appliances in a low-energy house, Energy and Buildings, Volume 140, 1 April 2017, Pages 81-97, ISSN 0378-7788. http://archive.ics.uci.edu/ml/datasets/Appliances+energy+prediction