Exercise 2. Look at the prescrip time series dataset in the TSA package by running li- brary(TSA) and data(prescrip). Th

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Exercise 2. Look at the prescrip time series dataset in the TSA package by running li- brary(TSA) and data(prescrip). Th

Post by answerhappygod »

Exercise 2 Look At The Prescrip Time Series Dataset In The Tsa Package By Running Li Brary Tsa And Data Prescrip Th 1
Exercise 2 Look At The Prescrip Time Series Dataset In The Tsa Package By Running Li Brary Tsa And Data Prescrip Th 1 (27.36 KiB) Viewed 92 times
this needs to be solved in R. please provide R code
Exercise 2. Look at the prescrip time series dataset in the TSA package by running li- brary(TSA) and data(prescrip). This is monthly U.S. average prescription costs for 68 months from August 1986.
(b) We'd also like to find the o, test statistic for the test whether (a,3,0) = (0,0,1) in the model given by: X, = a + Bt+oX -1 + Et where X, is the average prescription cost in month t. This model can be re-written as AX, = a + Bt +wX2-1 + Et. (where w=0-1). To do this you first fit a linear model to the time series to estimate the coefficients: n=length(prescrip) tt-2:n # convenience vector of time indices y=diff (prescrip) # first difference of the series fit=lm(yºtt+prescrip[-n]) # estimate alpha, omega x[t-1], beta yhat=fitted (fit) Once this is done, 02 (equivalent to an F statistic) will be given by the ratio of explained to unexplained variance. This in turn is equal to the ratio of the sum of squares of the model divided by the degrees of freedom of the model to the sum of squares of the errors divided by the degrees of freedom of the errors: SSM/dofm Ф, SSE/dofe where SSM = Ej and SSE = 2(y-9.)? Hint: you can for example use SSE=sum((y-yhat)^2) for the sum or squared errors and the degrees of freedom are p for the model and n-p-1 for the errors, where p = 3 is the number of parameters. [5]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply