[R-sig-ME] mixed effect modeling with imputed data set
Ben Bolker
bbolker at gmail.com
Wed Jun 17 03:21:49 CEST 2015
For convenience, you might want to consider using imputation with
the 'mice' package in order to
stay within R for your analysis (I don't know Stata's capabilities in
this area; I'd expect them to be pretty good,
but it is my impression that 'mice' is also quite well-written/full-featured)
On Tue, Jun 16, 2015 at 12:26 PM, Daniel Fulop <dfulop.ucd at gmail.com> wrote:
> Use one of the apply functions to iterate over your imputed datasets.
>
> If your imputed datasets are in columns 5 through n+4 of "mydata" (i.e.
> assuming that x1, x2, x3, and regioid are in columns 1:4), the you could do
> something like:
>
> model.list <- lapply(1:n, function(i)
>
> glmer(mydata[,i+4] ~ x1+x2 +x3+(1|regiogid),family= binomial("logit"),
> data=mydata) )
>
> The output will then be a list of model objects (i.e. model fits). You can
> then iterated through this results list in order to calculate mean parameter
> values from all your imputed data fits.
>
> Or, likewise:
>
> model.list <- lapply(5:ncol(mydata), function(i) ...
>
> Hope this helps,
> Dan.
>
>
> ali via R-sig-mixed-models wrote:
>>
>> Hi all
>> I imputed my data using multiple imputation procedure in STATA. I would
>> like
>> to conduct mixed effect modeling on the imputed data set in R. I do not
>> know
>> how to write the code over the imputed data set.
>> My code is:
>> fit<- glmer(y ~ x1+x2 +x3+(1|regiogid),family= binomial("logit"), data
>> =mydata)
>>
>> Best Regards
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
> --
> Daniel Fulop, Ph.D.
> Postdoctoral Scholar
> Dept. Plant Biology, UC Davis
> Maloof Lab, Rm. 2220
> Life Sciences Addition, One Shields Ave.
> Davis, CA 95616
>
> 510-253-7462
> dfulop at ucdavis.edu
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list