0
|
17813 Views
|
11 Replies
|
7 Total Likes
View groups...
Share

# How to estimate Variance Components in a mixed linear model ?

Posted 10 years ago
 Hello, How do I fit a mixed linear model to my data using Mathematica? The model contains random and fixed effects. In addition, I am interested in estimating variance components for each random effect used in my model! Any hints that steer me into the right direct are appreciated!Martin
11 Replies
Sort By:
Posted 4 years ago
 Wondering if M12.1 will have anything in it for these mixed linear models.
Posted 3 years ago
 How about mixed models in M12.2?
Posted 10 years ago
 Wondering if M10 will have anything in it for these mixed linear models.
Posted 10 years ago
 As Asim suggested, I used R via RLink to estimate variance componets. The sample data set "Example_DataSet1.csv" is availalbe here: https://dl.dropboxusercontent.com/u/15488405/Example_DataSet1.csv. All factors in the model are regarded as random effects.I used the following code: Needs["RLink`"] InstallR[ ]  REvaluate["   {   FAC1=as.factor(example$Fac1) FAC2=as.factor(example$Fac2)   FAC3=as.factor(example$Fac3) FAC4=as.factor(example$Fac4)  VAR1=as.numeric(example\$Var1)  }  "];REvaluate["hist(VAR1)"]StringJoin@Riffle[#, "\n"] &@ REvaluate["   {  library(lme4)  fit2 = lmer(formula= VAR1 ~ (1|FAC1) + (1|FAC2%in%FAC1) + (1|FAC4) + (1|FAC1:FAC4))  summary.text = capture.output(print( summary(fit2)))  }  "]
Posted 10 years ago
 Blog Post: Jon McLoone, Why Would a Mathematica User Care about R?http://blog.wolfram.com/2013/05/22/why-would-a-mathematica-user-care-about-r/CRAN package repositoryhttp://cran.cnr.berkeley.edu/web/packages/
Posted 10 years ago
 Hi MartinIt would be great for the community if you can post the details of a small working example, i.e, some simple data and code. Asim
Posted 10 years ago
 I started to work with RLink and this is actually the way to go! So far it works flawlessly running mixed linear models and estimating variance components using R package "lme4" within Mathematica.
Posted 10 years ago
 RLink seems to be very promissing!
Posted 10 years ago
 Bruce and Asim, many thanks for your advice and suggestions! I hope that in the future the Mathematica staff addresses this gap!
Posted 10 years ago
 I don't think that Mathematica has built in functionality for mixed linear models. You may have to program this yourself. Alternatively, you could use R to do so. If you want to do it via Mathematica, you have RLink that may come in useful.
Posted 10 years ago