Open dmbates opened 11 years ago
That was really very useful. whos() is now a "must know" for me.
Interesting that my julia version of April 26, was "way too old" and e.g. couldn't get data(.,.) to work... Using the Ubuntu PPAs instead indeed, was sufficient.... and much faster than the 'git pull ; make' ... aah it fails re-building 'make realclean; make' ... dance which would usually take many hours..
Thank you, Doug!
In Julia multiple values are returned from a function as a tuple. You can write
return (a, b)
and extract the values a and b with indexes. A common idiom is to assign the values of a returned function to a tuple of identifiers
n, p = size(X)
On Wed, Apr 20, 2016 at 12:13 AM Daijiang Li notifications@github.com wrote:
How do you return multiple named values so you can extract part of them later? In R, we can use return(list(a = a, b = b)). Thanks!
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/dmbates/MixedModels.jl/issues/1#issuecomment-212259714
Thanks Prof. Bates!
I ended with return a Dict so I can extract values by name later.
I am converting Tony Ives' R code to do phylogenetic mixed models (mixed model with specific phylogenetic var-cov matrix) into Julia. As the R code is too slow and it is unlikely to be included into the lme4
package.
I am new to Julia, even though I attended your Julia workshop two years ago... The code is here. Even now, it is >10 times faster than R. But I wonder can you have a look at them and let me know how to improve/profile it?
Is it possible to let your mixed model to do such kind of analyses?
Thank you for your help! Daijiang
First I would suggest creating a package. Secondly don't pass around a huge number of arguments. If they are related to the same model then create a type for the model.
On Thu, Apr 21, 2016 at 10:31 AM Daijiang Li notifications@github.com wrote:
Thanks Prof. Bates! I ended with return a Dict so I can extract values by name later. I am converting Tony Ives' R code to do phylogenetic mixed models (mixed model with specific phylogenetic var-cov matrix) into Julia. As the R code is too slow and it is unlikely to be included into the lme4 package.
I am new to Julia, even though I attended your Julia workshop two years ago... The code is here https://github.com/daijiang/pglmm.jl. Even now, it is >10 times faster than R. But I wonder can you have a look at them and let me know how to improve/profile it?
Is it possible to let your mixed model to do such kind of analyses?
Thank you for your help!
Daijiang
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/dmbates/MixedModels.jl/issues/1#issuecomment-212975338
In private email Martin Maechler asked me several questions about using Julia and the MixedModels package. Because the answers to which may be of more general interest, I created this issue for them so that others may see the answers and comment on them.
I am assuming that a recent version of Julia 0.2 devel is installed. The easiest way to do that for Ubuntu users is using the julianightlies PPA and the julia-deps PPA. As of today, the "nightlies" version produces
on startup. There have been too many changes since the 0.1.2 release to try using that. Please ensure that your version string starts with 0.2.0
The system for attaching packages has changed in version 0.2.0. To install this package use
After that, attaching this and other packages is done with the
using
directive.More than one package can be listed. For testing I often use
This directive doesn't return instantaneously but the delay is due to the size and complexity of the
DataFrames
package upon which both of these depend.As in
R
, attaching a package also attaches its dependencies but there are distinctions between those packages that are visible from the REPL and those that are visible only inside the package listed inusing
. The equivalent of R'sls()
iswhos()
and it can take an argument which is the name of a Module. (Most packages are organized as a Module - which is a namespace - but you can have Modules that are not separate packages).It happens that
MixedModels
attaches theDataFrames
andDistributions
namespaces in the REPL as well as its own namespace. However is does not theNLopt
namespace in the REPL. I am not sure how to discover this other than by reading the source code or experimenting with names. The directiveusing MixedModels
evaluates the source filewhich, in turn, has several calls to
include
The fact that this driver file has the directive
both before and after the directive
means that these namespaces will be visible in the REPL (because of the first
using
) and withing the module itself, because of the secondusing
.You can always try evaluating a name in the namespace to see if it is visible in the REPL.
The fully qualified name will be accessible
Martin asked about the equivalent of R's
installed.packages()
which iswhich is a hash or Dict
A more readable display is returned by
I will be adding an
lmer()
function soon. Right now the package has two user-defined types for simple linear mixed models,LMMsimple
andLMMsplit
because I was experimenting to see if the complexity of handling the fixed-effects part separately from the random-effects part of the model was warranted (and apparently it is). TheLMMsimple
class throws both into a single sparse matrix andupdatemu()
for that class is only four lines.For
LMMsplit
the random-effects part of the system matrix is stored as a sparse symmetric matrix and the fixed-effects part is a dense matrix.The formula/data interface is slightly more verbose than in R. A formula must be enclosed in
:( )
to retain it as an expression. ThusThe first time you do this the response will seem slow, which is because all the methods are being encountered for the first time and need to be compiled. Subsequent calls to will be much faster.