Pages

Sunday, January 10, 2010

segfault, a pox on both your houses!

I spend the bulk of the productive part of my day wrestling with this segfault in my R program.
"""
*** caught segfault *** address 0x0, cause 'memory not mapped' Traceback: 1: .C("Cbcp", PACKAGE = "bcp", data = as.double(x), mcmcreturn = as.integer(mcmcreturn), n = as.integer(n), burnin = as.integer(burnin), mcmc = as.integer(mcmc), rho = as.integer(rho), rhos = as.integer(rhos), blocks = as.integer(blocks), results = as.double(results), a = as.double(p0), c = as.double(w0), pmean = as.double(pmean), pvar = as.double(pvar), pchange = as.double(pchange)) 2: bcp(validData[validData$validGvkeys == k, "validIndicators"])
"""

Oh! What wailing and gnashing of teeth! Turns out it was caused by too few data points. You'd think that'd be something the authors of the function would anticipate and error-trap. I'm tempted to contact them about it, but I suspect they would just laugh at me for attempting to do breakpoint analysis on three datapoints. The point is: I was running it in a loop over many different firms without awareness of how many points each firm has. Still my fault? Dammit, the function should return an error, not segfault.

Anyway, its working, and its an awesome package (bcp). I've got this awesome method under control less than a week after it was suggested to me. I feel capable. I suppose that balances out with having excitedly sending my adviser a graph that I totally misinterpreted under the obvious influence of confirmation bias; ignoring the generally accepted fact that probabilities cannot be negative.

Edit: a better title for this post would be "Pox, A segfault on both your houses!"

No comments: