help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax Problem?


From: Muthiah Annamalai
Subject: Re: Syntax Problem?
Date: Wed, 14 Feb 2007 22:32:49 -0600

On Wed, 2007-02-14 at 11:13 -0200, address@hidden wrote:
> 
> Dear Users, 
> 
> When running the program below, I got the following syntax error: 
> 
> parse error near line 49 of file C:\Arquivos de programas\Octave\share
> \octave\2.9.9+\m\MyFiles\prog.m 
> syntax error 
> >>>               for j = 1:lagdep; 
>                      ^ 
> error: near line 49 of file `C:\Arquivos de programas\Octave\share
> \octave\2.9.9+\m\MyFiles\prog.m' 
> 
> But looking at the code, appears that this is not the case. 
> 
> Any help? 
> 
> Best, Rick. 
> 
> Code: 
> 
> clear; 
> #a=xlsread('sabes_oct.txt'); 
> a=randn(150,50); 
> 
> t=size(a,1); 
> p=a(:,1);       #(target) 
> aa=a(:,2:5);    # resto (regressors) 
> yy=p; 
> tt=size(yy,1); 
> 
> lagdepmin=0; 
> 
> lagmod1min=0; 
> lagmod2min=0; 
> lagmod3min=0; 
> 
> lagdepmax=3;   # lags dependent variable tried 
> lagmod1max=3;  # lags model tried 
> lagmod2max=3; 
> lagmod3max=3; 
> 
> lagmax=max([lagdepmax lagmod1max lagmod2max lagmod3max]); 
> for ahfor = 1:1; 
>     ahmod=1;     # number of periods ahead of model 
>     pseudo=12;   # number of out-of-sample points 
>     ychosen=yy(:,1); 
>     for lagdep=lagdepmin:lagdepmax; 
>       for lagmod1=lagmod1min:lagmod1max; 
>         for lagmod2=lagmod2min:lagmod2max; 
>           for lagmod3=lagmod3min:lagmod3max; 
>             for i=1:pseudo; 
>               # prepare model 
>               aaux=aa(1:tt-i-(ahfor-1),:); 
>               aaux=aaux-(ones(size(aaux,1),1)*mean(aaux)); 
>               aaux=aaux./(ones(size(aaux,1),1)*std(aaux)); 
>               baux=aaux'*aaux; 
>               [vetoraux,valoraux]=eig(baux); 
>               valoraux=diag(valoraux); 
>               xx1=aaux*vetoraux(:,size(vetoraux,2)); 
>               xx2=aaux*vetoraux(:,size(vetoraux,2)-1); 
>               xx3=aaux*vetoraux(:,size(vetoraux,2)-2); 
>               # prepare variables 
>               yreal=yy(2+lagmax+(ahfor-1)+(ahmod-1):tt+1-i,1); 
>               yaux=[yy(1+lagmax+(ahmod-1):tt-i-(ahfor-1),1) xx1(1
> +lagmax+... 
>               (ahmod-1):tt-i-(ahfor-1),1) xx2(1+lagmax
> +(ahmod-1):tt-i-... 
>               (ahfor-1),1) xx3(1+lagmax+(ahmod-1):tt-i-(ahfor-1),1); 
>               xaux=ones(tt-i-(ahfor-1)-(ahmod-1)-(1+lagmax)+1,1) ]; 
You missed a 'end bracket'?
Maybe if you use a good editor (emacs?) that can match braces,
you couldve avoided this whole problem.

~ Muthiah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]