Lets say I have several glm stored in a list and I want the mean of the results of those glm like the output of summary.glm.
Is there a simple way where I can get an output like the one from the summary.glm function (with the estimate, std error, z value, etc) where the result is the mean of all the models in the list?
Related
Does anyone know how to correctly use the Quantlib CompositeZeroYieldStructure class? I am trying to basically build two curves with different interpolations and 'join' them. So I built a flat forward curve using ql.ForwardCurve to get the shape of the jumps for FOMC/ECB/etc Central Bank meetings but then want to move to a splined curve after the last jump date.
I cannot work out what the Binary Function is that this class is expecting to be passed.
We got several OLAP Cubes in PowerBI Datasets.
One of the cubes has a dimension "dim_location" which contains columns for latitude and longitude. But each dataset has 2 pairs of values, let's call them start_latitude, start_longitude and end_latitude, end_longitude.
I got a fact table connected to that dim_location and want to show some of the measures on a map.
It works perfectly fine with both the map visual and the ArcGIS visual, if I use either the end or the start coordinates. I can show the values as circles with changing size or changing color dependent on the value of a measure. So far so good.
But what I instead want to accomplish is to show a line on the map for each dataset. Each line shall go from start point to end point, color dependent on measure value.
Is there a way to offer the coordinates in the cube dimension in some string syntax that will create a shape, like a polygon with only 2 points, which would result in a line, which can then be shown on the map?
As stated before everything works fine on the map and the ArcGIS visual with one point (lat/lon) per dataset. Tried to find help online for some polygon syntax but came up empty.
I am trying to implement a difference-in-differences estimator with a GLM model with Stata 13.0. The parameter I am interested in is the derivative of the expected value with respect to the interaction of binary treatment group indicator T and binary post-treatment period indicator S only (T#S, rather than the full derivative with respect to T). This approach is explained towards the end of this thread on Statalist. This is my code:
glm y i.T##i.S, exposure(e) cluster(user_id) link(log) family(poisson) robust
preserve
replace e = 30
margins rb0.T#rb0.S
restore
The preserve/replace/restore step is necessary because margins does not allow the at() option to be used with exposure variables.
Two questions.
How would I get a p-value for this effect?
Is it possible to get the effect in semi-elasticity form, perhaps by using margins with eydx() in some way?
What would b the best way to implement a simple shape-matching algorithm to match a plot interpolated from just 8 points (x, y) against a database of similar plots (> 12 000 entries), each plot having >100 nodes. The database has 6 categories of plots (signals measured under 6 different conditions), and the main aim is to find the right category (so for every category there's around 2000 plots to compare against).
The 8-node plot would represent actual data from measurement, but for now I am simulating this by selecting a random plot from the database, then 8 points from it, then smearing it using gaussian random number generator.
What would be the best way to implement non-linear least-squares to compare the shape of the 8-node plot against each plot from the database? Are there any c++ libraries you know of that could help with this?
Is it necessary to find the actual formula (f(x)) of the 8-node plot to use it with least squares, or will it be sufficient to use interpolation in requested points, such as interpolation from the gsl library?
You can certainly use least squares without knowing the actual formula. If all of your plots are measured at the same x value, then this is easy -- you simply compute the sum in the normal way:
where y_i is a point in your 8-node plot, sigma_i is the error on the point and Y(x_i) is the value of the plot from the database at the same x position as y_i. You can see why this is trivial if all your plots are measured at the same x value.
If they're not, you can get Y(x_i) either by fitting the plot from the database with some function (if you know it) or by interpolating between the points (if you don't know it). The simplest interpolation is just to connect the points with straight lines and find the value of the straight lines at the x_i that you want. Other interpolations might do better.
In my field, we use ROOT for these kind of things. However, scipy has a great collections of functions, and it might be easier to get started with -- if you don't mind using Python.
One major problem you could have would be that the two plots are not independent. Wikipedia suggests McNemar's test in this case.
Another problem you could have is that you don't have much information in your test plot, so your results will be affected greatly by statistical fluctuations. In other words, if you only have 8 test points and two plots match, how will you know if the underlying functions are really the same, or if the 8 points simply jumped around (inside their error bars) in such a way that it looks like the plot from the database -- purely by chance! ... I'm afraid you won't really know. So the plots that test well will include false positives (low purity), and some of the plots that don't happen to test well were probably actually good matches (low efficiency).
To solve that, you would need to either use a test plot with more points or else bring in other information. If you can throw away plots from the database that you know can't match for other reasons, that will help a lot.
I want to compute products along each dimension of an OpenCV Mat in C++. Apart from looping through each row or column of the Mat, is there any existing function that already takes care of this? An equivalent to Matlab's prod() function is essentially what I want.
Unfortunately, there is no such function in OpenCV. The closest to your needs is reduce(), which does different operations per row/coloumn, but it only can extract sum, mean, min or max. Not product. So, that's it, you should write your own function.
Or better expand the cv::reduce() function, and send the patch to code.opencv.org Wouldn't it be great?