# Research

## pomp

Exploring pomp for examples tomorrow. See pomp-example

• To access help on S4 methods
• print method source code: getMethod("simulate", "pomp")
• access help file on available methods: method?show("pomp")
• pomp simulate method returns object of class pomp with data in object@data, unless user sets either/both of obs=TRUE and state=TRUE to return the observed and true state data (in list objects). Seems to be the only way to get the true state data out of the simulate routine (other than shortcutting the observation method rmeasure). Poor form to change return type based on input options, but oh well.

## prosecutor’s fallacy

• troubleshooting comment runs setup. Some replicates realize their extrema within the first 200 points, causing negative indexing (if not handled) and mismatched length of data objects (if not handled). Improve exception handling and restart runs.

## nonparametric-bayes

Writing writing writing. see repo.

## multiple-uncertainty

Troubleshooting the matlab translation

Cannot seem to pass an array in place of a variable to matlab’s (okay, actually octave’s) applyfun function:

function out = ssum(x,y, a)
out = (x + y);
end
[X, Y] = meshgrid([1:5], [1:5])
b = arrayfun(@ssum, X, Y, 1)  %Works fine

But if the extra argument is a vector this fails.

b = arrayfun(@ssum, X, Y, [1:6])
• Need a convenient way to generate probability densities from continuous distributions in which parameter values and $$x$$ values are restricted to a grid. Matlab translation of this didn’t work.

I want to get the probability density of value $$P$$ from uniform distribution between $$\mu - \mu S$$ and $$\mu + \mu S$$.  If $$S$$ is zero, I want to return unity if $$P$$ is equal to $$\mu$$.  The trick is that I want all values discretized to a grid, so P == mu really means if $$P$$ and $$\mu$$ fall in the same bin of the discrete grid.

I thought this function would do it:

    function out = snap_to_grid(x, grid)
[v,i] = min(abs(grid-x));
out = grid(i);
end

%% generate various sources of noise, or delta fns if noise is zero
function out = pdfn(P, mu, s)
grid = [1:5]; % dumb grid, ideally an argument to pdfn but doesn't work
if mu == 0
out = (P == 0);
elseif s > 0
if mu > 0
out = unifpdf(P, mu * (1 - s), mu * (1 + s));
end
else  % delta spike
P = snap_to_grid(P, grid);
mu = snap_to_grid(mu, grid);
out = (P == mu);
end
end

But clearly I’ve gone wrong somewhere.

## ropensci

• final revisions, reread draft, close outstanding issues.
• troubleshooting SSOAP example. Added checkCircular enables successful parsing, but now no luck generating functions:
library(SSOAP)
wsdl = processWSDL("https://www.nbnws.net/ws_3_5/GatewayWebService?wsdl", checkCircular=FALSE)
iface = genSOAPClientInterface(def = wsdl)