Stata: Transformation of xtabond to xtabond2 - regression

I wrote my GMM regression for my dynamic panel data set with the xtabond command:
xtabond dependVar var1L(2/2).Var2L(2/2).Var3 L(2/2).Var4 L(2/2).Var5, lags(1) twostep artest(2) vce(robust) noconstant level(90)
Afterwards I wanted to carry out various tests (Sargan, Hansen). Unfortunately, this is not possible with the command in xtabond. So I tried to transform the xtabond into a xtabond2 command (used Roodman D. (2009) "How to do xtabond2: An introduction to
difference and system GMM in Stata" for help). But I couldn't figure out how I can get the same results. My xtabond2 command looks the following:
xtabond2 dependVar L(1/1).dependVar L(2/2).var1 L(2/2).var2 L(2/2).var3 L(2/2).var4 var5, gmmstyle(dependVar , laglimits(1 1 )) gmmstyle(var1 var2 var3 var4, laglimits(2 2)) noleveleq noconstant level(90) twostep robust
Does anyone have a suggestion on how to convert the xtabond command to xtabond2 to get the same results? Or is there a possibility to use the xtabond command (incl. vce(robust)) for other tests (e.g., Sargan or Hansen)?
Best regards

Related

Fuzzing command line arguments [argv]

I have a binary I've been trying to fuzz with AFL, the only thing is AFL only fuzzes STDIN, and File inputs and this binary takes input through its arguments pass_read [input1] [input2]. I was wondering if there are any methods/fuzzers that allow fuzzing in this manner?
I don't not have the source code so making a harness is not really applicable.
Michal Zalewski, the creator of AFL, states in this post:
AFL doesn't support argv fuzzing, because TBH, it's just not horribly useful in
practice. There is an example in experimental/argv_fuzzing/ showing how to do it
in a general case if you really want to.
Link to the mentioned example on GitHub: https://github.com/google/AFL/tree/master/experimental/argv_fuzzing
There are some instructions in the file argv-fuzz-inl.h (haven't tried myself).
Bash only Solution
As an example, lets generate 10 random strings and store them in a file
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 10 > string-file.txt
Next, lets read 2 lines from string-file and pass it into our application
exec handle< string-file.txt
while read string1 <&handle ; do
read string2 <&handle
pass_read $line1 $line2 >> crash_file.txt
done
exec handle<&-
We then have any crashes stored within crash_file.txt for further analysis.
This may not be the most elegant solution, but perhaps you gives you an idea of some other possibilities if no tool necessarily fulfills the current requirements
I looked at the AFLplusplus repo on GitHub. Inside AFLplusplus/utils/argv_fuzzing/, there is a Makefile. If you run it, you will get a .so file (a shared library) that you can use to do argv fuzzing, even if you only have the binary. Obviously, you must use AFL_PRELOAD. You can read more in the README.

Convert sysbench cumulative summary to csv

I'm trying to create graphs with sysbench cumulative output, so that I can compare results of different benchmarks.
So far have been able to generate csv files with intermediate statistics using hooks in lua scripts. I'm not able to do the same with cumulative results, so I'm trying to do it by parsing the results with sed and awk, but it looks very time consuming.
Can anybody help me out with this? I'm using sysbench 1.0.20
thank you very much
Gianluca
You don't have to parse the output. I've done this long ago before sysbench supported CSV reports, and it was difficult and error-prone.
Now, you can make sysbench produce CSV output instead of the formatted "human-readable" summary.
Here's what I do with current versions of sysbench:
Copy one of the sysbench scripts, like oltp_read_only.lua. Open it in an editor.
Add these lines:
function report_noop()
-- do nothing
end
sysbench.hooks.report_intermediate = sysbench.report_csv
sysbench.hooks.report_cumulative = report_noop
Now when I run my customized lua script as the argument to sysbench, it outputs lines of text for each iteration, and no output at the end of the report.

How do I convert one CRS (Coordinate Reference System) value into another using OSGeo4W Shell?

I have QGIS 2.18 (latest version) installed for windows (new users). Along came OSGeo4W Shell. Now using this shell, I want to convert a specific value in one CRS into another. For example, if I know coordinates in WGS84 (say, 91.7362, 26.1445 just to give an example), I would like to know how to convert it to Indian 1954/UTM Zone 46N (which are in meters) using OSGeoShell.
PS: I know there is a way because I once successfully found the way. I had copied the syntax of the command but I deleted the file by mistake and I can't find the way in net again even after long time searches. It was barely a 2 line and simple command.
I think, the command is:
osgeo4w
gdaltransform -s_srs EPSG:4326 -t_srs EPSG:XXXX < input.csv > output.txt
Where the EPSG codes are the codes for the CRS (4326 is for WGS84). You have to find out the epsg code for your target crs and then you can perform the transformation.

Converting Shell Output to json

I want to convert the output of octave execution in shell to json format.
For example if I execute
$ octave --silent --eval 'a=[1,3],b=2'
I get
a =
1 3
b = 2
I want the output to be formatted to a json string as in
"{'a':[1,3], 'b':2}"
How do I achieve this, It would be great if it is in node/js, but anthing is fine. I am looking for any existing solutions to rather than writing my own logic for parsing it. Need suggestion.
I doubt if any such package exists. Its easy to write your own rather thank waiting to find one.

CSV transformation

I have been looking for a way to reformat a CSV (Pipe separator) file with some if parameters, I'm pretty sure this can be done in PHP (strpos and if statements) or using XSLT but wanted to know if this is the best/easiest way to do it before I go and learn my way around a new language. here is a small example of the kind of thing I'm trying to achieve (the real file is about 25000 lines is this changes the answer?)
99407350|Math Book #13 (Random Information)|AB Collings|http:www.abc.com/ABC
497790366|English Book|Harold Herbert|http:www.abc.com/HH
Transform to this:
99407350|Math Book|#13|AB Collings|http:www.abc.com/ABC
497790366|English Book||Harold Herbert|http:www.abc.com/HH
Any advice about which direction I need to look in would be great.
PHP provides getcsv() (PHP 5) and fgetcsv() (PHP 4 and 5) for this, so if you are working in a PHP environment, use that. See e.g. http://www.php.net/manual/en/function.fgetcsv.php
If you do something yourself, remember to cope with "...|..." and/or \| to have | inside a field. Or test to make sure it can't happen - e.g. check the code that exports the database to CSV if that's what's happening.
Note also - on Unix / Solaris / Linux / OS X systems,
awk -F '|' '(NF != 9)' yourfile.csv | wc
will count the number of lines with other than 9 fields; if you are certain | never occurs except as a field delimiter, awk is a perfectly fine language for this too, e.g. with
awk -F '|' '{ gsub(/ [(].*[)]/, "", $1); print}' yourfile.csv
Here, [(] matches ( in a way that works across different versions of awk, and same for [)].