[R] error in "ca.jo"

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue Dec 24 23:51:37 CET 2013


I am sorry you have chosen to interpret my response as unfriendly. I do not expect you or anyone posting here to be an expert before posting. However, the context here is that you have to read our responses anyway, so both Pat and I have recommended higher-quality reading material than we can write off the cuff. If you do read the recommended materials, you will be able to communicate in this forum effectively. If you do not, we will be guessing at problems we cannot know clearly about unless you tell us about them. You also need to read the Posting Guide to know what is on topic here, and what is not. When you start generating a lot of inputs to a function and getting errors then you may need to learn more about the theory behind that function... and this is not really the right place for that. So, please read the recommended materials and think about them before posting.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

mamush bukana <mamushbukana at gmail.com> wrote:
>Hi Jeff,
>>From your words (if our words really describe us), I hope you don't
>expect
>me to teach you that this is "r-help" room. I don't expect you to tell
>me
>that I am a layman. I already know it and that is why I am here seeking
>a
>help. If I am an expert of things I asked here, there is no need for me
>to
>come here with such "stupid (in your understanding)" question. I know
>there
>are people on this planet who consider themselves advanced only when
>they
>meet stupid people like me - you may be one of them. It is always
>helpful
>for others if you could write a single line with a helping mind than
>writing tones of useless junk words. R is applied statistical language,
>to
>be used in different professions. So, don't expect all R users to be
>"experts" like you are. If you can't help people, at least keep
>yourself
>away from helping environment.
>
>Cheers
>
>Bukana
>
>
>On Tue, Dec 24, 2013 at 5:23 PM, Jeff Newmiller
><jdnewmil at dcn.davis.ca.us>wrote:
>
>> Once you start describing your code in language that indicates you
>have
>> read some of the recommended materials, we can make some progress.
>For
>> example, you are still posting in HTML format so your code is getting
>> mangled (see Posting Guide). You don't seem to understand what
>tryCatch
>> does (see ?tryCatch; hint... it does not alter the result returned by
>> ca.jo, nor does it guarantee that any result will be returned). For
>that
>> matter, you don't seem to understand how to give valid inputs to
>ca.jo,
>> but then you don't seem to understand how to provide a reproducible
>example
>> either (see for example
>>
>http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>> ).
>>
>> In short, if you ask us why one divided by zero doesn't give 3, we
>have to
>> wonder if you don't belong in some other educational forum, because
>this is
>> not a mathematics theory support group... it is about R. Please read
>or
>> otherwise absorb the recommended background materials mentioned here
>and
>> then ask clear questions here about R, or find some one-on-one help
>offline.
>>
>---------------------------------------------------------------------------
>> Jeff Newmiller                        The     .....       .....  Go
>Live...
>> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
>> Go...
>>                                       Live:   OO#.. Dead: OO#.. 
>Playing
>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>> /Software/Embedded Controllers)               .OO#.       .OO#. 
>rocks...1k
>>
>---------------------------------------------------------------------------
>> Sent from my phone. Please excuse my brevity.
>>
>> mamush bukana <mamushbukana at gmail.com> wrote:
>> >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 at 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 at 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 at 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]]
>> >
>> >______________________________________________
>> >R-help at 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.
>>
>>



More information about the R-help mailing list