mercredi 3 juin 2015

How do I loop the sctest function for different breakpoints in strucchange package in R?

Im very new to programming

So this is the code Ive created till now

nrow(nifty.dummy)
a = as.integer(nrow(nifty.dummy))
x = as.vector(c(1:a))
n = as.vector(x/a)

for (i in n)
{

sctest(investors~opening, type = "Chow", point = i, data = nifty.dummy)

}

So the objective is to get Chow values for "point" values of every month of the year (or for every row value of the data) automatically. point values are a fraction of the total dataset from what Ive gathered for example, if i consider the year of 2014, and if my breakpoint is January, my point will be 1/12. I want to be able to do this for every month and get me 12 Chow test statistics (or how many months are under consideration).

whenever I run this code I get an error saying "inadmissable change point"

Thank you. sorry if i wasnt clear enough

Aucun commentaire:

Enregistrer un commentaire