How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

Sorkin, John
Windows 10 64-bit, R-Studio, R version 3.4.3


Several questions relating to groupedData:

(1) I am trying to create a groupedData object that can be used to run an analysis that I have been able to urn using lmer. When I include the interaction terms in the groupedData opbject I get an error message stating that + is not meaningful for factors. How do I include factors in my model? See code and error below.

(2) I have read the help file for groupedData multiple times. I am unable to understand the meaning or, or the use for the inner= and outer= parameters in the call to groupedData. Can someone either explain the meaning of these parameters or refer me to a source that give a clear explanation?


> fit0 <- lmer(THmean~INTRVNTN+factor(TimePtID)+INTRVNTN*factor(TimePtID)+(1|PatientID),data=smalldata)
> sdgd <- groupedData(THmean~INTRVNTN+TimePtID+INTRVNTN*TimePtID|PatientID,data=smalldata)
Warning messages:
1: In Ops.factor(INTRVNTN, TimePtID) : �+� not meaningful for factors
2: In Ops.factor(INTRVNTN, TimePtID) : �*� not meaningful for factors


Thank you,

John


John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)


        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

Michael Dewey-3
Dear John

You are only allowed to have the primary covariate on the left hand side
of the vertical bar. Other covariates go in inner or outer.

Michael

On 22/03/2018 12:59, Sorkin, John wrote:

> Windows 10 64-bit, R-Studio, R version 3.4.3
>
>
> Several questions relating to groupedData:
>
> (1) I am trying to create a groupedData object that can be used to run an analysis that I have been able to urn using lmer. When I include the interaction terms in the groupedData opbject I get an error message stating that + is not meaningful for factors. How do I include factors in my model? See code and error below.
>
> (2) I have read the help file for groupedData multiple times. I am unable to understand the meaning or, or the use for the inner= and outer= parameters in the call to groupedData. Can someone either explain the meaning of these parameters or refer me to a source that give a clear explanation?
>
>
>> fit0 <- lmer(THmean~INTRVNTN+factor(TimePtID)+INTRVNTN*factor(TimePtID)+(1|PatientID),data=smalldata)
>> sdgd <- groupedData(THmean~INTRVNTN+TimePtID+INTRVNTN*TimePtID|PatientID,data=smalldata)
> Warning messages:
> 1: In Ops.factor(INTRVNTN, TimePtID) : �+� not meaningful for factors
> 2: In Ops.factor(INTRVNTN, TimePtID) : �*� not meaningful for factors
>
>
> Thank you,
>
> John
>
>
> John David Sorkin M.D., Ph.D.
> Professor of Medicine
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
>
> [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

Bert Gunter-2
In reply to this post by Sorkin, John
r-sig-mixed-models is likely to be a better list for such queries.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Thu, Mar 22, 2018 at 5:59 AM, Sorkin, John <[hidden email]>
wrote:

> Windows 10 64-bit, R-Studio, R version 3.4.3
>
>
> Several questions relating to groupedData:
>
> (1) I am trying to create a groupedData object that can be used to run an
> analysis that I have been able to urn using lmer. When I include the
> interaction terms in the groupedData opbject I get an error message stating
> that + is not meaningful for factors. How do I include factors in my model?
> See code and error below.
>
> (2) I have read the help file for groupedData multiple times. I am unable
> to understand the meaning or, or the use for the inner= and outer=
> parameters in the call to groupedData. Can someone either explain the
> meaning of these parameters or refer me to a source that give a clear
> explanation?
>
>
> > fit0 <- lmer(THmean~INTRVNTN+factor(TimePtID)+INTRVNTN*factor(
> TimePtID)+(1|PatientID),data=smalldata)
> > sdgd <- groupedData(THmean~INTRVNTN+TimePtID+INTRVNTN*TimePtID|
> PatientID,data=smalldata)
> Warning messages:
> 1: In Ops.factor(INTRVNTN, TimePtID) : ‘+’ not meaningful for factors
> 2: In Ops.factor(INTRVNTN, TimePtID) : ‘*’ not meaningful for factors
>
>
> Thank you,
>
> John
>
>
> John David Sorkin M.D., Ph.D.
> Professor of Medicine
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology and
> Geriatric Medicine
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
>
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

Sorkin, John
In reply to this post by Michael Dewey-3
Michael,

I apprecate your response. The inner and outer parameters to do not affect the results produced by lme. I am still left with the same questions I had before;

(1) How does one include factors in groupData

(2) What is the meaning and use of the outer and inner parameters in groupData?

Thank you again,

John


John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)



________________________________
From: Michael Dewey <[hidden email]>
Sent: Thursday, March 22, 2018 10:30 AM
To: Sorkin, John; RHELP <[hidden email]>
Subject: Re: [R] How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

CAUTION: This message originated from a non UMB, UMSOM, FPI, or UMMS email system. Whether the sender is known or not known, hover over any links before clicking and use caution opening attachments.



Dear John

You are only allowed to have the primary covariate on the left hand side
of the vertical bar. Other covariates go in inner or outer.

Michael

On 22/03/2018 12:59, Sorkin, John wrote:

> Windows 10 64-bit, R-Studio, R version 3.4.3
>
>
> Several questions relating to groupedData:
>
> (1) I am trying to create a groupedData object that can be used to run an analysis that I have been able to urn using lmer. When I include the interaction terms in the groupedData opbject I get an error message stating that + is not meaningful for factors. How do I include factors in my model? See code and error below.
>
> (2) I have read the help file for groupedData multiple times. I am unable to understand the meaning or, or the use for the inner= and outer= parameters in the call to groupedData. Can someone either explain the meaning of these parameters or refer me to a source that give a clear explanation?
>
>
>> fit0 <- lmer(THmean~INTRVNTN+factor(TimePtID)+INTRVNTN*factor(TimePtID)+(1|PatientID),data=smalldata)
>> sdgd <- groupedData(THmean~INTRVNTN+TimePtID+INTRVNTN*TimePtID|PatientID,data=smalldata)
> Warning messages:
> 1: In Ops.factor(INTRVNTN, TimePtID) : �+� not meaningful for factors
> 2: In Ops.factor(INTRVNTN, TimePtID) : �*� not meaningful for factors
>
>
> Thank you,
>
> John
>
>
> John David Sorkin M.D., Ph.D.
> Professor of Medicine
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
>
>       [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.