Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Instruction: This is the last exam in BMB 620. Complete the following questions in RMarkdown and submitted the generated PDF on Classes by the deadline. Make sure to show both the input and output. 1....

1 answer below »

Instruction: This is the last exam in BMB 620. Complete the following questions in RMarkdown and submitted the generated PDF on Classes by the deadline. Make sure to show both the input and output.
1. Use the gas time series data from the forecast package to answer the following questions. The gas data include the Australian monthly gas production from 1956 to 1995.
a. Extract the starting month, ending month, and frequency of the time series.
. Visualize the time series and interpret its components.
c. Smoothen the time series with different smoothing factor k.
d. Decompose the time series and interpret the decomposition.
2. Use the taylor time series data from the forecast package to answer the following questions. The taylor data contain half-hourly electricity demand in England and Wales from Monday 5 June 2000 to Sunday 27 August 2000.
a. Visualize the time series and interpret its components.
. Use single exponential forecasting to fit the time series. Interpret the results.
c. Make forecast using the model in b.
d. Use Holt exponential smoothing to fit the time series. Interpret the results.
3. Use the woolyrnq time series data from the forecast package to answer the following questions. The woolyrnq data contain quarterly production of woollen yarn in Australia: tonnes. Mar 1965 – Sep 1994.
a. Visualize the time series.
. Estimate the number of differences required to make the time series stationary
c. Use Acf() and Pacf() to identify and fit an ARIMA model. Interpret the result.
d. Make forecast using the model in c.
e. Create an automated ARIMA forecasting model and make forecast.
4. Use the birth data from the flexclust package to answer the following questions. The birth data contain birth and death rates of 70 countries.
a. Perform a hierarchical clustering of the birth data. Your solutions should contain the full procedure of hierarchical cluster analysis. Interpret your results.
. Use K-means clustering on the birth data. Your solutions should contain the full procedure of K-means clustering. Interpret your results.
c. Compare the results between a and b.
5. Use the bcancer data from the VIM package to answer the following questions. The bcancer data contain the original Wisconsin
east cancer data with 699 observations on 11 variables.
a. Identify the missing values using ma.pattern() function from the mice package. Interpret the result.
. Conduct a complete-case analysis to retain the non-missing values.
c. Conduct a simple imputation on the data.
Answered Same Day Dec 21, 2021

Solution

Subhanbasha answered on Dec 21 2021
111 Votes
BMB 620
BMB 620
## calling packages
li
ary(dplyr)
##
## Attaching package: ’dplyr’
## The following objects are masked from ’package:stats’:
##
## filter, lag
## The following objects are masked from ’package:base’:
##
## intersect, setdiff, setequal, union
li
ary(stringr)
li
ary(tidyr)
li
ary(lu
idate)
##
## Attaching package: ’lu
idate’
## The following objects are masked from ’package:base’:
##
## date, intersect, setdiff, union
li
ary(ggplot2)
li
ary(pwr)
## Warning: package ’pwr’ was built under R version 4.1.2
Question 1
a)
li
ary(forecast)
## Registered S3 method overwritten by ’quantmod’:
## method from
## as.zoo.data.frame zoo
1
## Reading data into R
gg <- gas
# Starting Month data
gg[seq(1, length(gg), by = 12)]
## [1] 1709 1751 1773 1730 1762 1804 1868 1910 1889 1962 1910 1994
## [13] 1994 2057 3345 5919 7778 11569 11704 12354 13260 15117 17243 18839
## [25] 21433 27730 30715 26138 28801 32494 31239 32791 35567 37541 40459 35592
## [37] 38963 37059 39975 41600
# Ending Month data
gg[seq(12, length(gg), by = 12)]
## [1] 1825 1878 1910 1910 2026 1984 2015 2057 2142 2110 2205 2247
## [13] 2384 3461 6288 8154 10829 12253 13116 14312 16498 18488 19795 21930
## [25] 25248 32445 28729 30234 34514 32142 34879 37958 39995 42528 36016 38698
## [37] 39606 43736 38410
# Frequency of data
frequency(gg)
## [1] 12
).
# Plotting time series data
plot(gas)
2
Time
ga
s
1960 1970 1980 1990
0
20
00
0
40
00
0
60
00
0
#By observing the above plot of time series there it presents the trend component there is no seasonality in
the data and also cyclic variations.
c).
# Smoothing the time series data
plot(smooth(gas,kind = c("3RS3R")))
3
Time
sm
oo
th
(g
as
, k
in
d
=
c
("
3R
S
3R
")
)
1960 1970 1980 1990
0
20
00
0
40
00
0
60
00
0
d).
# Decomposing the data
plot(decompose(gas))
4
0
30
00
0
o
se
v
ed
10
00
0
40
00
0
t
en
d
−
40
00
0
40
00
se
as
on
al
−
10
00
0
0
10
00
0
1960 1970 1980 1990
a
nd
om
Time
Decomposition of additive time series
From the decomposition of the time series data there is present the trend which is from some
year it has going up. There is also presence of random fluctuations as well
Question 2
a)
tay_dat <- taylo
# Plotting the time series data
plot(taylor)
5
Time
ta
yl
o
2 4 6 8 10 12
20
00
0
25
00
0
30
00
0
35
00
0
By observing the above plot of time series there it presents the trend, seasonality and random
component there is no cyclical variation in the data need to normalize the data that means
difference the data as to get the formatted data.
).
# single exponential smoothing
ses.goog <- ses(tay_dat, h = 100)
# printing result
plot(ses.goog)
6
Forecasts from Simple exponential smoothing
2 4 6 8 10 12
10
00
0
20
00
0
30
00
0
40
00
0
#The single exponential method is used here and from the above plot the model was builed and forsacted fo
the future but those are not actual predictions it is giving single line of forecast need to go advance methods.
c).
# forecasting the data
fore <- forecast(ses.goog,10)
plot(fore)
7
Forecasts from Simple exponential smoothing
2 4 6 8 10 12
10
00
0
20
00
0
30
00
0
40
00
0
d)
# holtwinters method
taylorforecasts <- HoltWinters(tay_dat, beta=FALSE, gamma=FALSE)
print(taylorforecasts)
## Holt-Winters exponential smoothing without trend and without seasonal component.
##
## Call:
## HoltWinters(x = tay_dat, beta = FALSE,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here