Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function in R to generate a series of length T, i.e. from the model x i = x i-1 + w i .

Write a function in R to generate a series of length T, i.e. from the model xi = image text in transcribedxi-1 + wi. You can enter the parameter image text in transcribed directly and we only have on fixed parameter image text in transcribed. Also, the index i should start from 2.

This will be similar to:

randomwalk=function(sigsq,T){ x=rep(0,T) w=rnorm(T,sd=sqrt(sigsq)) for ( i in 2:T){ x[i]=x[i-1]+w[i] } x }

AND

masim=function(thetas, sigsq, T){ q=length(thetas) noise=rnorm(T+q, sd=sqrt(sigsq)) x=c(noise[1:q],rep(0,T)) #put the initial noise terms in and set the rest to zero for (i in (q+1):(T+q)){ #this loop generates the MA series x[i]=thetas %*% noise[i-(1:q)] +noise[i] } x=x[(q+1):(T+q)] #throw away those initial starting points x }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions