
			Advice to Those Installing REBayes

The REBayes package is available from CRAN.  However, unlike most R packages
it requires some further installation actions.  In an ideal world, CRAN would
automagically install the Rmosek package as well.  Installation of dependencies
usually works fine, but Rmosek requires some tweaking at install time.  Rmosek
is an interface to the Mosek environment of Erling Andersen and collaborators.  
You should install Mosek first, along with its license file before trying to use REBayes.
Rmosek is now available from CRAN so it can be installed with the usual 
invocation of install.packages("Rmosek"), however the version of the Rmosek
package available on CRAN is really just a skeleton intended to facilitate
installation of the real Rmosek package from the Mosek website; the advantage
of this over prior schemes is that it automates the configuration and ensures
that the Rmosek setup is compatible with the installed version of Mosek.

After installing Rmosek from CRAN the following steps should be taken:

library(Rmosek)
mosek_attachbuilder()
install.rmosek() #this installs a version of rmosek replacing the CRAN  one

then it is recommended to quit the R session, restart R and try

library(Rmosek)
example(mosek)

This should produce output for a trivial example.


The academic license for Mosek is freely downloadable from 
https://www.mosek.com/products/academic-license and is good for one year.
Just fill in the form and then via email you get a license file (mosek.lic) 
that needs to be moved to  the appropriate place in the mosek directory.
This used to be into the subdirectory licenses, but since version 7 it belongs
in MOSEKHOME.  Of course you need to verify that the mosek executable is in
your path:  try mosek from the shell command line to check this.  It used to
be necessary to define the location of the license file as a shell variable
but this no longer seems necessary either.  Once mosek is installed, the next
step is to install the R package Rmosek.  

Now install REBayes also from CRAN (or source) and all should be well, 
to test you might try as an initial step:

require(REBayes)
demo(GLmix1)

Considerable further detail is available from the mosek and Rmosek documentation.
And the vignettes for the REBayes package. 

These instructions should work for any installed version of Mosek, in
particular most of the REBayes code was developed for Mosek V8, however
Mosek V9 is now available and limited testing has confirmed
that this is typically more efficient.
See https://themosekblog.blogspot.co.uk/2018/01/version-9-roadmap_31.html
Mosek V9 constituted a fairly dramatic reformulation of the problems
appearing in REBayes, nonlinear terms in the objective function are
transformed into convex cone constraints.  Some notes about this
transformation focused primarily on the implications for the fitting function
medde() in the REBayes package are available 
here:  http://www.econ.uiuc.edu/~roger/research/ebayes/kwdual9.pdf
and http://www.econ.uiuc.edu/~roger/research/ebayes/Mosek9.pdf
