Skip to content

Nutrition questionnaire data

1 message · Doug Adams

#
Hello,

It's been a while since I've posted, although I've been using R
sig-mixed-models as a reference a lot lately.

I've got some data from a questionnaire that I'd like to analyze, and
I want to make sure my syntax is right. ?There were multiple groups of
subjects (residents, medical students...) being surveyed, and the
questions were also grouped into subscales. ?So basically, I have the
"response" for each question & for each subject, and questions &
subjects are crossed. ?Further, questions are nested within subscales,
while subjects are nested within groups -- and groups & subscales are
crossed.

So here's kind of what it looks like:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?subscale 1
subscale 2 ? ? ? ? ? ? ? ? ? ? ?subscale 3
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?q1 ? ? ?q2 ? ? ?q3 ? ? ?q4 ? ? ?q5
q6 ? ? ?q7 ? ? ?q8 ? ? ?q9 ? ? ?q10 ? ? q11 ? ? q12
Attending ? ? ? ? s1 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
 ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
? ? ? ? ? ? ? ? ? ? ? ?s2 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? #
# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
? ? ? ? ? ? ? ? ? ? ? ?s3 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? #
# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
Student ?    ? ? ? s4 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
? ? ? ? ? ? ? ? ? ? ? ?s5 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? #
# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
? ? ? ? ? ? ? ? ? ? ? ?s6 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? #
# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
Resident ? ? ? ? ?s7 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
 ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
? ? ? ? ? ? ? ? ? ? ? ?s8 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? #
# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #
? ? ? ? ? ? ? ? ? ? ? ?s9 ? ? ?# ? ? ? # ? ? ? # ? ? ? # ? ? ? #
# ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? # ? ? ? #


I hope that comes out right ASCII-wise in this post! ? : ) ? Anyway,
there are more subjects and questions and such than in this little
visual of course. ?Is this correct?

lmer(response ~ group + (1|subject) + (1|question), data=NL, REML=TRUE)

Thanks so much,
Doug Adams


P.S. - If there's a reference for the modeling syntax used in R -- or
in lme4 specifically if need be -- and how each operator works, please
let me know. ?For example, if there were a help document that says
things like " A\B means A is nested within B ," or " the | symbol
denotes the the following factor is at a higher level in the model, "
etc., that would be so helpful. ?I've learned a lot from context, from
Pinheiro & Bates (though that's for nlme), and from this forum, but I
haven't been able to find something like a formula syntax reference
like that.