[R-sig-ME] Help needed: Fitting and Simulating multilevel model in R.
Joshua Wiley
jwiley.psych at gmail.com
Sat Jun 30 21:14:37 CEST 2012
Hi Justice,
If this is for your dissertation, why not take the opportunity to
learn how to use R? If you want someone else to figure out how to do
it on your behalf or just provide the solutions, how much are you
offering to pay as a reward?
If you want to learn how to do it on your own, you may also check out
this page I wrote, which is basically just the code for a multilevel
dataset I simulated. I was not doing it many times, because my goal
there was just to have a dataset for demonstrative purposes at the
consulting office where I work. Nevertheless, I created various
(normal, count, binary) outcomes, and fit mixed effects models
accordingly using the lme4 package, so it may help you.
http://www.ats.ucla.edu/stat/r/pages/mesimulation.htm
Again, I think if you just want the solution to be given you, you will
probably need to hire someone.
Cheers,
Josh
On Sat, Jun 30, 2012 at 12:05 PM, Justice Moses K. Aheto
<justiceaheto at yahoo.com> wrote:
> Hi Greg, Raquel and All,
> Many thanks for the help so far but I am very new to R and can hardly fit the model with those recipe given in my problem.
> I can fit multilevel models using the raw data in R but not as given me in this case and that really is my major problem.
> Also, I can simulate simple linear regression model from normal distribution in R but not as above.
> I will try to read on what Greg suggested and see if I can understand anything from there.
> I am really in need of someone to provide me with the solutions and I am happy to see Raquel trying to figure things out on my behalf.
> Thanks to everyone so far trying hard to help me out of this and I do appreciate that effort.
> Best regards.
>
>
> Kind regards.
>
>
>
> Justice Moses K. Aheto
> (Chief Executive Officer)
> Statistics & Analytics Consultancy Services Ltd.
> E-mail: justiceaheto at yahoo.com
> Mobile:00447417589148
>
>
>
>>________________________________
>> From: Greg Snow <538280 at gmail.com>
>>To: Justice Moses K. Aheto <justiceaheto at yahoo.com>
>>Cc: R EXPERTS USA <r-sig-mixed-models at r-project.org>
>>Sent: Saturday, June 30, 2012 7:05 PM
>>Subject: Re: [R-sig-ME] Help needed: Fitting and Simulating multilevel model in R.
>>
>>The version of the TeachingDemos package that is on R-forge (not the
>>CRAN version yet) has a function called "simfun" that could be helpful
>>in setting up the simulation. You can get the R-forge version with
>>the command: install.packages("TeachingDemos", repos=
>>c("http://R-Forge.R-project.org", getOption("repos")))
>>
>>Look through the help for "simfun" to see how to use it and ideas for
>>simulating with it.
>>
>>For doing the analysis you can use the lme4 package (others as well,
>>but that is one place to start).
>>
>>On Sat, Jun 30, 2012 at 6:36 AM, Justice Moses K. Aheto
>><justiceaheto at yahoo.com> wrote:
>>> Dear All,
>>> I am a new R user but currently working on my dissertation which request that I fit multilevel model to a given situation that can be located below and then simulate the fitted model 10000 times.
>>>
>>> Set up a simulation model according to the following recipe in R:
>>> n=number of observation=1000,
>>> xi~N(0,1), is a predictor.
>>> Wi~N(0,1), links to birth weight.
>>> Ni~Poisson(mean=variance=2), number of children per woman.
>>> Vij~N(0,1), child predictor
>>> Zij~N(0,1), is an error term.
>>> Yij(birthweight)=a+bxi+cvij+d(ρwi+(√1-ρ2)zij)
>>> Where,
>>> a=3.1, b=0.2, c=0.3, d=0.3, ρ=(0,1)
>>> Note: use the interval for ρ on 0, 0.01, 0.02, 0.03, …0.99, 1)
>>> 1) Fit multilevel model for the above.
>>> 2) Calculate the standard errors of the estimates, t-values, p-values and store them.
>>> 3) Run this recipe 10000 times in a loop.
>>> 4) How many times is p-value<0.05
>>> 5) How does this vary according to ρ?
>>>
>>> I am available to provide further clarification on the task should you request for.
>>> Could someone help me in this regards.
>>> I do appreciate any assistance given me.
>>> Many thanks in advance.
>>>
>>>
>>> Kind regards.
>>>
>>> Justice Moses K. Aheto
>>> (Chief Executive Officer)
>>> Statistics & Analytics Consultancy Services Ltd.
>>> E-mail: justiceaheto at yahoo.com
>>> Mobile:00447417589148
>>> [[alternative HTML version deleted]]
>>>
>>>
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>
>>
>>
>>--
>>Gregory (Greg) L. Snow Ph.D.
>>538280 at gmail.com
>>
>>
>>
> [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/
More information about the R-sig-mixed-models
mailing list