8.12.14

Setting up hot corner + expose effect in XFCE on Linux Mint

Setting up hot corner + expose effect in XFCE was already discussed somewhere else here http://forum.xfce.org/viewtopic.php?id=8105, so I could not claim I'm first in that respect.

However I could not find step-by-step solution for Linux Mint, thus I'm sharing the steps here.

1. Install brightside (via Synatic Package Manager or apt-get).

2. Install skippy-xd (https://code.google.com/p/skippy-xd/). You'll need to compile from source for this one.

- Download the source (https://github.com/richardgv/skippy-xd)
- Install required development packages (https://code.google.com/p/skippy-xd/wiki/Installation)

sudo apt-get install libimlib2-dev libfontconfig1-dev libfreetype6-dev libx11-dev libxext-dev libxft-dev libxrender-dev zlib1g-dev libxinerama-dev libxcomposite-dev libxdamage-dev libxfixes-dev libxmu-dev

- Extract the source (unzip).
- cd into the source folder, then

make

followed by

sudo make install

which would install skippy-xd into /usr/bin

3. Run brightside-properties, and set Custom action... > On entering region to skippy-xd.

4. To wrap things up, add brightside to your list of Application Autostart.

7.12.14

How many cows are required per farm so as the probability of getting at least one diseased cow is 70%?

Today I stumbled upon a problem during a student presentation.

How many cows are required per farm so as the probability of getting at least one diseased cow is 70% (acceptable level to us, using area under ROC cutoff point), given that the disease prevalence is 25%?

My solution for this problem is by using binomial distribution. The following is the formula for the distribution,
In our context,

x, number of success
n, sample size
p, prevalence

and to solve our problem

p(1 or more) = 1 - p(0)

Using spreadsheet, we can find the value of n iteratively (I prefer LibreOffice Calc). Just key in the following function (or just put up the formula above)

=1 - BINOMDIST(n, x, p, 1)

thus in our context

=1 - BINOMDIST(n, 0, 0.25, 1)

after playing around with n, I found

for n = 4, p(1 or more) = 1 - 0.316 = 0.684

for n = 5, p(1 or more) = 1 - 0.237 = 0.763

I'd go for 5 cows...

4.12.14

Installing STATA 11 on Linux Mint

I could not manage to run the provided install script to install STATA 11/SE on my Linux Mint LMDE 201403 system, so I went through the script itself and did everything manually.

The steps were as follows:

1. Copy unix/linux.64 contents to local disk, let say to ~/Downloads/stata11. The files are

ls

ado.taz  base.taz  bins.taz  install  setrwxp  utilities.taz

2. Create installation folder /usr/local/stata11

sudo /usr/local/stata11

3. Create symlink to the folder

sudo ln -s /usr/local/stata11 /usr/local/stata

4. Copy all files to /usr/local/stata11

sudo cp ~/Downloads/stata11/* /usr/local/stata11

5. Uncompress all .taz files

cd /usr/local/stata11
sudo uncompress *.taz

would result in:

ls

ado.tar  base.tar  bins.tar  install  setrwxp  utilities.tar

6. Untar all .tar files

tar -xof ado.tar
tar -xof base.tar
tar -xof bins.tar
tar -xof utilities.tar

would result in:

ls

ado     stata  stata.lic  stata_pdf utilities  xstata-se
auto.dta     stata11.png  stata-mp   stata-se xstata
isstata.110  stata_br  stata.msg  stinit xstata-mp

in addition to all our installation files listed above.

7. Remove all .tar files

rm *.tar

8. Set permission using setrwxp script

sudo ./setrwxp

9. Once done, just remove install and setrwxp from the folder

sudo rm install setrwxp

10. Start license authorization

sudo ./stinit

11. Once done with license authorization, try running STATA 11/SE GUI version.

./xstata-se

You will get a number of errors. The following are the errors with solution:

./xstata-se: error while loading shared libraries: libtiff.so.3: cannot open shared object file: No such file or directory

Check whether you have libtiff4. If not install using Synaptic Package Manager or apt-get. Then make symlink to libtiff.so.4

sudo ln -s x86_64-linux-gnu/libtiff.so.4 libtiff.so.3

Followed by

./xstata-se: error while loading shared libraries: libgtksourceview-1.0.so.0: cannot open shared object file: No such file or directory

Install libgtksourceview2.0-0 using Synaptic Package Manager or apt-get

sudo ln -s libgtksourceview-2.0.so.0 libgtksourceview-1.0.so.0

12. Run STATA again

./xstata-se

13. To be able to run directly from Terminal without going to /usr/local/stata11 folder, set your path in ~/.profile

gedit ~/.profile

and edit this line

PATH="$HOME/bin:$PATH"

to

PATH="$HOME/bin:$PATH:/usr/local/stata"

Log out and log in again to apply the change.

8.10.14

Convert variable name list to comma separated variable names

This trick is quite useful for SPSS. Let say I have 50 variables that I want to sum up the values by using SUM(var1,var2, ...) in Transform > Compute variable..., converting the list:
var1
var2
...
var50
to
var1,var2,...,var50
then
SUM(var1,var2,...var50)
is quite tedious.

I found this nice command line from http://www.shellhacks.com/ (in Linux, of course). Save your list in a file, say temp_file, then
echo $(awk 'NR > 1{print line", "}{line=$0;}END{print $0" "}' temp_file) > new_file
Your comma separated variable names are ready in new_file. Thanks, penguin.

Installing SPSS 22 on Linux Mint

  1. My setup: Linux Mint LMDE 201403, wine-1.4.1, PlayOnLinux 4.2.1
  2. Install SPSS as usual from installation folder ("setup.exe") using Playonlinux. 32 bit installation.
  3. After installation is finished, make shortcuts for "stats.exe" (SPSS) and "law.exe" (Licence authorization wizard).
  4. Download "echoid.dat" from IBM website (http://www-01.ibm.com/support/docview.wss?uid=swg21613684). Copy to installation folder in Playonlinux virtual drive.
  5. Run Licence authorization wizard from Playonlinux. Then run SPSS.
  6. After running analysis, table in output cannot be displayed.
  7. Go to Edit > Options > Pivot Tables.
  8. "Render Legacy Tables".