Dear List, How do I pick the p-value out of the urppTest result? For adfTest the p-value can be extracted by A2 at test$p.value following A2 <- adfTest(myData[,i], lags=2, type=c("c")) What do I do for urppTest? The above doesn't seem to work. There is a slot @test with $output, which is a list of various test results that didn't want to give away only the p-value (I'm fairly new to R, so this might well be my fault). I thought I had found a way around this by # dissolve testresult into lines listasvectors <- unlist(P1 at test$output) # pick the line containing p-value getpvalue <- unlist(strsplit(listasvectors[17], " ")) # isolate the p-value (number only) getpvalue[14] However, I'm doing this in a loop and it seems for each test result there is a different number of entries or seperators " ". For example, "<" sometimes ends up being displayed as the p-value. I'd be very happy about any help on how to extract the p-value. Thanks, Katrin
If you would still like a reply to this post, please provide a simple, self-contained example illustrating the problem you want to solve (as suggested in the posting guide "www.R-project.org/posting-guide.html"). I didn't find one in your email nor in the 'urppTest' help file nor in another place I looked. Please also include the output of "sessionInfo". Also, please confirm (or correct) the impression that you are trying to use the "urppTest" in the fSeries package; without that information, it is not immediately obvious what you are talking about. Sorry I couldn't help more. Spencer Graves Anne Katrin Heinrichs wrote:> Dear List, > > How do I pick the p-value out of the urppTest result? > > For adfTest the p-value can be extracted by > > A2 at test$p.value > > following > > A2 <- adfTest(myData[,i], lags=2, type=c("c")) > > What do I do for urppTest? The above doesn't seem to work. There is a slot @test with > $output, which is a list of various test results that didn't want to give away only the > p-value (I'm fairly new to R, so this might well be my fault). > > I thought I had found a way around this by > > # dissolve testresult into lines > listasvectors <- unlist(P1 at test$output) > > # pick the line containing p-value > getpvalue <- unlist(strsplit(listasvectors[17], " ")) > > # isolate the p-value (number only) > getpvalue[14] > > However, I'm doing this in a loop and it seems for each test result there is a different > number of entries or seperators " ". For example, "<" sometimes ends up being displayed as > the p-value. > > I'd be very happy about any help on how to extract the p-value. > > Thanks, > Katrin > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Hello Anne, the function 'ur.pp' contained in the package 'urca' has been ported into the package 'fSeries' (see the documentaion of ?urppTest). help("ur.pp-class", package="urca") will tell you that p-values are not part of this class, i.e., these are not computed but critical values are returned. Now, inside of the function 'urppTest', 'ur.pp' is called and an object of class 'fHTEST' is returned (you can see this, by simply typing 'urppTest'). The class 'fHTEST' does contain the slot 'test' (it is a list). You can see this by spotting at getClass("fHTEST"). However, what is stored into test is the outcome of 'show(your ur.pp-object)', i.e. the print-out of the test statistic. In contrast, by typing 'adfTest' you will easily see, that the p-values are calculated within this function and are part of the slot 'test'. Best, Bernhard>Dear List, > >How do I pick the p-value out of the urppTest result? > >For adfTest the p-value can be extracted by > > A2 at test$p.value > >following > > A2 <- adfTest(myData[,i], lags=2, type=c("c")) > >What do I do for urppTest? The above doesn't seem to work. >There is a slot @test with >$output, which is a list of various test results that didn't >want to give away only the >p-value (I'm fairly new to R, so this might well be my fault). > >I thought I had found a way around this by > > # dissolve testresult into lines > listasvectors <- unlist(P1 at test$output) > > # pick the line containing p-value > getpvalue <- unlist(strsplit(listasvectors[17], " ")) > > # isolate the p-value (number only) > getpvalue[14] > >However, I'm doing this in a loop and it seems for each test >result there is a different >number of entries or seperators " ". For example, "<" >sometimes ends up being displayed as >the p-value. > >I'd be very happy about any help on how to extract the p-value. > >Thanks, >Katrin > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! >http://www.R-project.org/posting-guide.html >***************************************************************** Confidentiality Note: The information contained in this mess...{{dropped}}