Dear Pat,
I tried your suggestion:
for(i in 1:N1){
for(j in 1:N2){
co<-tryCatch(ca.jo <http://ca.jo>(data.frame(cbind(y2[
i,j,],y1[i,j,])),type="trace", K=2,
spec="transitory",ecdet="const",season=NULL,dumvar=NULL),error=function(e)
NaN)
}}
and the earlier error does not show up. However, when I try to extract some
results from the "co.jo" function, it does not work the way it does
without
the "tryCatch" thing and there appears another error. For example:
for(i in 1:N1){
for(j in 1:N2){
co<-tryCatch(ca.jo <http://ca.jo>(data.frame(cbind(y2[
i,j,],y1[i,j,])),type="trace", K=2,
spec="transitory",ecdet="const",season=NULL,dumvar=NULL),error=function(e)
NaN)
cor1<-cajorls(co,r=1)
}}
Error in cajorls(vecm, r = 1) :
Please, provide object of class 'ca.jo' or 'cajo.test' as
'z'.
So it seems "tryCatch" is disabling "ca.jo" from running
properly. My
intention is to run this function ("ca.jo") and extract some estimates
for
further computation.
regards
Bukana
On Mon, Dec 23, 2013 at 5:09 PM, Patrick Burns
<pburns@pburns.seanet.com>wrote:
> There is a fundamental problem with your
> code, and there is the problem that you
> have (sort of) identified.
>
> The fundamental problem is that you are
> only going to get the results of the last
> call to 'ca.jo' that is done -- assuming
> it were to run. You presumably want to
> save some information from each of the
> computations.
>
> You can get the loops to run even when you
> run into an error with some combinations
> by using 'try' or 'tryCatch'. There is an
> example in Circle 8.3.13 of 'The R Inferno'.
>
> http://www.burns-stat.com/documents/books/the-r-inferno/
>
> If you have a question related to the actual
> function as opposed to general problems with
> R, then the r-sig-finance mailing list would
> be appropriate (you need to subscribe before
> posting).
>
> I'm not sure if this is enough of a hint for
> you or not. If not, then trying to formulate
> a more explicit question might help. (There
> are some suggestions in Circle 9 of 'The R
> Inferno'.)
>
> Pat
>
>
>
> On 23/12/2013 17:07, mamush bukana wrote:
>
>> Dear all,
>> I fit co-integration function between two integrated variables(y1 and
y2)
>> over different grid points:
>>
>> for(i in 1:N1){
>> for(j in 1:N2){
>>
co<-ca.jo(data.frame(cbind(y2[i,j,],y1[i,j,])),type="trace", K=2,
>>
spec="transitory",ecdet="const",season=NULL,dumvar=NULL)
>> }}
>>
>> I have already extracted grid points with integrated time series.
However,
>> when I run the above function, there happens an error
>>
>> Error in solve.default(t(V) %*% SKK %*% V) :
>> system is computationally singular: reciprocal condition number
>> 1.10221e-35
>>
>> May you suggest me how to fix this problem please?
>>
>> Thanks in advance
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/
>> posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
> --
> Patrick Burns
> pburns@pburns.seanet.com
> twitter: @burnsstat @portfolioprobe
> http://www.portfolioprobe.com/blog
> http://www.burns-stat.com
> (home of:
> 'Impatient R'
> 'The R Inferno'
> 'Tao Te Programming')
>
[[alternative HTML version deleted]]