[R] help: convert lmer.coef to matrix

2006-08-11 Thread Simon Pickett
Hi all,
I am trying to coerce the coeficients from a REML using lmer() to a matrix
of numbers which I can then write into excel. I have looked in the archive
and read around in the (Matrix) documentation but havent found anything of
use.
Any suggestions much appreciated,
Thankyou, S.



Simon Pickett
PhD student
Centre For Ecology and Conservation
Tremough Campus
University of Exeter in Cornwall
TR109EZ
Tel 01326371852

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help: convert lmer.coef to matrix

2006-08-11 Thread Bernd Weiss
On 11 Aug 2006 at 10:33, Simon Pickett wrote:

Date sent:  Fri, 11 Aug 2006 10:33:46 +0100 (BST)
From:   Simon Pickett [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] help: convert lmer.coef to matrix

 Hi all,
 I am trying to coerce the coeficients from a REML using lmer() to a
 matrix
 of numbers which I can then write into excel. I have looked in the
 archive
 and read around in the (Matrix) documentation but havent found
 anything of
 use.
 Any suggestions much appreciated,
 Thankyou, S.
 

I would suggest something like this:

library(lme4)
data(sleepstudy)
(fm1 - lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
lmer.coef - fixef(fm1)

# save coefficients columnwise
# keep in mind that dec=, is needed to fulfil the requirements of 
my German version of MS-Excel
lmer.out.mat-matrix(lmer.coef,ncol=length(lmer.coef))
write.table(lmer.out.mat,file=d:/lmer_out.csv,sep=;,dec=,,col.na
mes=names(lmer.coef),row.names=F)

# save coefficients rowwise
lmer.out.df-as.data.frame(lmer.coef)
write.table(lmer.out.df,file=d:/lmer_out.csv,sep=;,dec=,,row.nam
es=T,col.names=F)

Is that what you are looking for?   

Bernd

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.