This is 80% off topic, about interfaces to functions in R, but it is
related to lme4 because I want to cooperate with it and generate example
MLM datasets.  This is the project I asked about here last year when the
predicted values in lmer didn't work right, and Ben said that if I could
make this tight, it might be useful in lme4.

I got pretty far along that path, people started emailing me suggestions
for generalizations and new features, and gradually I accumulated a
too-complicated for most humans function interface.  So now I'm coming back
to it to see if it can be made more pleasant to use.

The thing is in github, you can look it over if you care to advise me.

https://github.com/R-crmda/R-crmda/tree/master/projects/mlmSim

This is the one I suggest.

https://github.com/R-crmda/R-crmda/blob/master/projects/mlmSim/mlm-3.R

I have no idea why github puts the word "blob" in the url of a specific
file.

As it stands now, to use the function

genMLMData

requires the user to specify the number of clusters, the size of the
smallest cluster, the variance in the cluster size, a vector of slopes,
vectors for the means and standard deviations of the X's, the correlations
between them, the standard errors, the random effects, the correlation
between the random effects. I did fiddle the interface so genMLMData will
manufacture vectors or matrices if the users supply just a single value or
a vector when we need a matrix.

Somebody asked me to write a component that generates correlated factor
variables and I stopped working on it.

If you stomp your way from top to bottom in that file, you see I've got
some "working examples" at the end.

This works, but I'm not to encouraged about giving it to students or
others.  And I started to wonder, couldn't one of you teach me how to write
a function that receives a formula, something more obviously
understandable? Or point me at an R package that deals with a similar
problem in a graceful way?

pj

-- 
Paul E. Johnson
Professor, Political Science      Assoc. Director
1541 Lilac Lane, Room 504      Center for Research Methods
University of Kansas                 University of Kansas
http://pj.freefaculty.org               http://quant.ku.edu

	[[alternative HTML version deleted]]

