Question

In: Statistics and Probability

Generate data of length n=100 from a Gaussian AR(2) model with phi1=0.5 and phi2=0.2 and input...

  • Generate data of length n=100 from a Gaussian AR(2) model with phi1=0.5 and phi2=0.2 and input variance sigma^2=1. Afterwards, pretend the values of phi1, phi2 and sigma^2 are unknown.
    i. Use the R function ar() to fit an AR(p) model to your data. As options for the ar() function, first use aic = TRUE. What estimated order did aic minimization give for your data? Try three different fitting methods, method="yule-walker", method="ols"and also method="mle". Do you see significant differences between the methods?
    ii. Repeat the above by setting aic = FALSE and method="yule-walker". First select order p=1; what do you observe in your estimates? Now select order p=3 and then p=5; what do you observe?
    iii. Fit an ARMA(p,q) model to your data using the R function arima(). Specify the orders (p,q) to be fitted as either (2,0) or (1,1) or (2,1). Compare your results under these three specifications. [Note that ARMA(p,q) is the same as ARIMA(p,0,q) so in R function arima() you need to select the middle order to be 0.]

Solutions

Expert Solution

ANSWER: I have attached the below code. I have added the observations in the last.

##################### R CODE ####################################

rm(list=ls(all=TRUE))

set.seed(12345)

X = arima.sim(n=100,model=list(ar=c(0.5,0.2)))
summary(X)

ar(X,aic=TRUE) # AR2 as a result
ar(X,aic=TRUE,method = "mle") # AR2 as a result
ar(X,aic=TRUE,method = "ols") # AR17 as a result
ar(X,aic=TRUE,method = "yule-walker") # AR2 as a result

ar(X,aic=FALSE,order.max = 1)
ar(X,aic=FALSE,method = "mle",order.max = 1)
ar(X,aic=FALSE,method = "ols",order.max = 1)
ar(X,aic=FALSE,method = "yule-walker",order.max = 1)

ar(X,aic=FALSE,order.max = 3)
ar(X,aic=FALSE,method = "mle",order.max = 3)
ar(X,aic=FALSE,method = "ols",order.max = 3)
ar(X,aic=FALSE,method = "yule-walker",order.max = 3)

ar(X,aic=FALSE,order.max = 5)
ar(X,aic=FALSE,method = "mle",order.max = 5)
ar(X,aic=FALSE,method = "ols",order.max = 5)
ar(X,aic=FALSE,method = "yule-walker",order.max = 5)

arima(X,order=c(2,0,0))
arima(X,order=c(1,0,1))
arima(X,order=c(2,0,1))

############## END OF R CODE #############################################

OBSERVATIONS:

(1)

Method Used Order Selected
Default 2
MLE 2
OLS 17
Yule Walker 2

(3)

Order Selected AIC
p=2, q=0 312.36
p=1, q=1 312.21
p=2, q=1 314.18

Related Solutions

Generate data of length n=100 from a Gaussian AR(2) model with phi1=0.5 and phi2=0.2 and input...
Generate data of length n=100 from a Gaussian AR(2) model with phi1=0.5 and phi2=0.2 and input variance sigma^2=1. Afterwards, pretend the values of phi1, phi2 and sigma^2 are unknown. i. Use the R function ar() to fit an AR(p) model to your data. As options for the ar() function, first use aic = TRUE. What estimated order did aic minimization give for your data? Try three different fitting methods, method="yule-walker", method="ols"and also method="mle". Do you see significant differences between the...
Implement an application that will read data from an input file, interpret the data, and generate...
Implement an application that will read data from an input file, interpret the data, and generate the output to the screen. - The application will have two classes, Rectangle and Lab2ADriver. - Name your Eclipse project, Lab2A. Implement the Rectangle class with the following description. Rectangle Data fields -numRows: int -numCols: int -filled: Boolean Store the number of rows in the Rectangle Store the number of columns in the Rectangle Will define either a filled or unfilled rectangle True =...
Generate a simulated data set with 100 observations based on the following model. Each data point...
Generate a simulated data set with 100 observations based on the following model. Each data point is a vector Z= (X, Y) where X describes the age of a machine New, FiveYearsOld, and TenYearsOld and Y describes whether the quality of output from the machine Normal or Abnormal. The probabilities of a machine being in the three states are P(X = New) = 1/4 P(X = FiveYearsOld) = 1/3 P(X = TenYearsOld) = 5/12 The probabilities of Normal output conditioned...
r programming generate 100 samples of size n= 5 from a normal random variable with u=2,...
r programming generate 100 samples of size n= 5 from a normal random variable with u=2, o= 3 in r
Write the R code First, generate 1000 observations from a binomial distribution with n=30 and p=0.2...
Write the R code First, generate 1000 observations from a binomial distribution with n=30 and p=0.2 Use the 1000 observations you generated: a) Generate poisson, binomial, negative binomial Diagnostic Distribution Plots using distplot. b) Generate a histogram and overlay a kernel estimator of the density (You can use: binom <- rbinom(n=1000,size=30, prob=0.2))
Generate n = 100 observations from each of the three models. - ARMA (1,1) - ARMA...
Generate n = 100 observations from each of the three models. - ARMA (1,1) - ARMA (1,0) -ARMA (0,1) Compute the sample ACF for each model and compare it to the theoretical values. Compute the sample PACF for each of the generated series and compare the Sample ACFs and PACFs
Using R: 1. Generate AR(1), AR(2), MA(1), MA(2), and ARMA(1,1) processes with different parameter values, and...
Using R: 1. Generate AR(1), AR(2), MA(1), MA(2), and ARMA(1,1) processes with different parameter values, and draw ACF and PACF. Discuss the characteristics of ACF snd PACF for these processes. 2. Generate AR(1) process {X_t}. Compute the first difference Y_t = X_t - X_(t-1). Draw ACF and PACF of {Y_t}. What can you say about this process? Is it again a AR(1) process? What can you say in general? 3.For the AR(2) processes with the following parameters, determine if AR(2)...
Using a sample of 50 quarters of inflation data, you carry out an AR(2) model regression,...
Using a sample of 50 quarters of inflation data, you carry out an AR(2) model regression, and produce the following results: Coefficient Standard error Intercept 1.77 0 Inflation t-1 0.12 0.01 Inflation t-2 0.12 0.02 The two most recent quarterly annualized inflation observations in your data are 2.03 (second to last observation) and 2.18 (latest observation). Based on these results, what is your prediction for the rate of inflation at time 52 (two quarters in the future from your latest...
Question 7. Suppose titration of 100 ml 0.2 M Fe2+ with 0.5 M Ce4+   and indicator...
Question 7. Suppose titration of 100 ml 0.2 M Fe2+ with 0.5 M Ce4+   and indicator electrode is saturated calomel electrode Formal potential for Fe3+ reduction:0.767, formal potential for reduction of Ce4+: 1.70, potential for saturated calomel electrode: 0.241 (3 pts) Write a balanced titration reaction (3 pts) Write two different half reactions for the indicator electrode (3 pts) Write two different Nernst equation for the cell voltage (3 pts) Calculate the E for the addition of 20 ml Ce4+...
Consider the following Markov chain: 0 1 2 3 0 0.3 0.5 0 0.2 1 0.5...
Consider the following Markov chain: 0 1 2 3 0 0.3 0.5 0 0.2 1 0.5 0.2 0.2 0.1 2 0.2 0.3 0.4 0.1 3 0.1 0.2 0.4 0.3 What is the probability that the first passage time from 2 to 1 is 3? What is the expected first passage time from 2 to 1? What is the expected first passage time from 2 to 2 (recurrence time for 2)? What is the relation between this expectation and the steady-state...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT