summaryrefslogtreecommitdiff
path: root/macros/yulewalker.sci
blob: 40fcadb174d370a5c0cca918d4cc5ef4bf3b0c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function [A,V]= yulewalker(C)
// Fit an AR (p)-model with Yule-Walker estimates given a vector C of autocovariances '[gamma_0, ..., gamma_p]'.
//Calling Sequence
//A    = yulewalker(C)
//[A,V]= yulewalker(C)
//Parameters 
//C: Autocovariances
//Description
//Fit an AR (p)-model with Yule-Walker estimates given a vector C of autocovariances '[gamma_0, ..., gamma_p]'.
//Returns the AR coefficients, A, and the variance of white noise, V.
funcprot(0);
lhs=argn(1);
rhs= argn(2);

if(rhs<1 | rhs>1)
	error("Wrong number of input arguments");
end

if(lhs<1 | lhs>2)
	error("Wrong number of output arguments");
end

select(lhs)

	case 1 then
		A= callOctave("yulewalker", C);
	case 2 then
		[A,V]= callOctave("yulewalker", C);
end
endfunction