[R] Specifying non-linear mixed effects models in R (non-linear DV)
Bert Gunter
bgunter@4567 @end|ng |rom gm@||@com
Wed Aug 25 00:11:42 CEST 2021
Per the posting guide, statistics issues are generally off topic on this list:
"Questions about statistics: The R mailing lists are primarily
intended for questions and discussion about the R software. However,
questions about statistical methodology are sometimes posted. If the
question is well-asked and of interest to someone on the list, it may
elicit an informative up-to-date answer. See also the Usenet groups
sci.stat.consult (applied statistics and consulting) and sci.stat.math
(mathematical stat and probability)."
stats.stackexchange.com is also a possible venue for statistics questions.
Questions on mixed effects models -- including how to set them up
using nlme or lmer (in the lme4 package) -- are almost always better
posted on r-sig-mixed-models .
That said, the best advice may be to to find expert local help, as an
answer to your query may depend on questions of design,
interpretation, and use that are best explored in direct dialogue.
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 Tue, Aug 24, 2021 at 2:23 PM Patzelt, Edward <patzelt using g.harvard.edu> wrote:
>
> Hi R-Help,
>
> Data is below. I used a Kruskal Wallis to compare across 4 study groups for
> my DV (beta - this is highly non-normal). Now I want to add a covariate
> (cpz).
>
> 1) What package do I use and how do I specify the model? (I tried T.aov
> from fANCOVA but received a lot of simpleLoess errors)
>
> 2) Can I specify "subject" as a random effect like in lme?
>
> structure(list(subject = c("C5B1001", "C5B1002", "C5B1003", "C5B1004",
> "C5B1005", "C5B1007", "C5B1008", "C5B1009", "C5B1010", "C5B1011",
> "C5B1012", "C5B1013", "C5B1014", "C5B1015", "C5B1016", "C5B1017",
> "C5B1018", "C5B1019", "C5B1020", "C5B1021", "C5B1022", "C5B1023",
> "C5B1024", "C5B1025", "C5B1026", "C5B1027", "C5B1029", "C5B1030",
> "C5B1031", "C5B1032", "C5B1033", "C5B1034", "C5B1035", "C5B1036",
> "C5B1037", "C5B1038", "C5B1039", "C5B1040", "C5B1041", "C5B1042",
> "C5B1043", "C5B1044", "C5B1045", "C5B1046", "C5B1047", "C5B1048",
> "C5B1049", "C5D2002", "C5D2003", "C5D2005", "C5D2006", "C5D2007",
> "C5D2009", "C5D2010", "C5D2011", "C5D2012", "C5D2013", "C5D2014",
> "C5D2017", "C5D2021", "C5D2022", "C5D2023", "C5D2024", "C5D2025",
> "C5D2026", "C5D2027", "C5D2028", "C5D2029", "C5D2030", "C5D2031",
> "C5D2032", "C5D2035", "C5D2036", "C5D2037", "C5D2039", "C5D2040",
> "C5D2042", "C5D2043", "C5D2044", "C5D2045", "C5D2046", "C5D2047",
> "C5D2048", "C5D2049", "C5D2051", "C5D2052", "C5D2053", "C5D2054",
> "C5D2055", "C5M3001", "C5M3003", "C5M3004", "C5M3005", "C5M3006",
> "C5M3007", "C5M3008", "C5M3009", "C5M3010", "C5M3011", "C5M3013",
> "C5M3014", "C5M3015", "C5M3016", "C5M3017", "C5M3019", "C5M3020",
> "C5M3021", "C5M3022", "C5M3023", "C5M3024", "C5M3029", "C5M3030",
> "C5M3031", "C5M3032", "C5M3033", "C5M3034", "C5M3035", "C5M3036",
> "C5M3038", "C5M3039", "C5M3042", "C5M3043", "C5M3044", "C5M3046",
> "C5M3047", "C5M3048", "C5M3049", "C5M3050", "C5M3051", "C5M3054",
> "C5M3055", "C5M3056", "C5M3057", "C5M3058", "C5R4001", "C5R4004",
> "C5R4005", "C5R4008", "C5R4009", "C5R4010", "C5R4011", "C5R4012",
> "C5R4013", "C5R4014", "C5R4015", "C5R4016", "C5R4017", "C5R4019",
> "C5R4020", "C5R4021", "C5R4022", "C5R4024", "C5R4025", "C5R4026",
> "C5R4027", "C5R4028", "C5R4031", "C5R4032", "C5R4034", "C5R4037",
> "C5R4038", "C5R4040", "C5R4041", "C5R4043", "C5R4048", "C5R4050",
> "C5R4053", "C5R4056", "C5W5001", "C5W5002", "C5W5003", "C5W5004",
> "C5W5005", "C5W5006", "C5W5007", "C5W5008", "C5W5012", "C5W5013",
> "C5W5014", "C5W5015", "C5W5016", "C5W5017", "C5W5018", "C5W5019",
> "C5W5020", "C5W5021", "C5W5022", "C5W5023", "C5W5024", "C5W5025",
> "C5W5028", "C5W5029", "C5W5030", "C5W5031", "C5W5033", "C5W5035",
> "C5W5037", "C5W5038", "C5W5039", "C5W5042", "C5W5043", "C5W5044",
> "C5W5045", "C5W5046", "C5W5047", "C5W5048", "C5W5049", "C5W5050",
> "C5W5051", "C5W5053", "C5W5054", "C5W5055", "C5W5057", "C5W5058",
> "C5W5060"), beta = c(5, 5, 5, 4.84951578282477, 5, 1.75435411010482,
> 2.59653537897755, 4.58343041388045, 1.19813289503568, 5, 4.41030503473763,
> 3.48886522319213, 5, 3.69347465973804, 5, 3.61341511433856, 5,
> 5, 5, 5, 2.82540030433712, 5, 2.01269174411245, 5, 5, 5, 5,
> 3.66605514409922,
> 5, 5, 1.20492768779028, 5, 5, 5, 5, 4.71051510737403, 0.973607667104191,
> 2.13320899798223, 3.55527726960037, 5, 3.13840519694586, 5,
> 4.33164972914231,
> 3.2716034981509, 5, 3.59865983897491, 5, 5, 2.98982117172486,
> 3.15884653708899, 5, 1.21006283114433, 1.88594293315325, 2.37248899411035,
> 2.40289344741545, 0.262839947401338, 2.89061041570249, 2.98573373614306,
> 2.82385009686039, 1.78295361666595, 4.27268021897288, 5, 5, 5,
> 2.52131830224533, 5, 2.32463450150955, 5, 5, 2.18297518836912,
> 5, 2.53256388646574, 5, 5, 5, 1.11901989122708, 1.56266936421015,
> 5, 2.1480772866684, 1.03201411339444, 3.22476904165877, 5,
> 2.23963439946338,
> 5, 3.85477002456212, 5, 5, 3.15602152904957, 4.81306354520538,
> 1.20566795082516, 5, 5, 5, 5, 3.04288106123443, 5, 4.06490230904187,
> 3.06547070051755, 5, 2.5258266208828, 3.52552152448218, 0.0968896467078101,
> 5, 5, 5, 5, 5, 5, 5, 4.99152057373263, 5, 5, 5, 1.1311501363613,
> 1.28951722667904, 0.001, 5, 4.58718394461838, 1.22231984982818,
> 5, 5, 3.35873683772968, 5, 3.87156907439221, 4.8859664986002,
> 5, 5, 0.976932521703834, 5, 4.50479324287729, 4.65093425894735,
> 4.22173593981599, 3.15590632469025, 4.86144574792365, 3.39926845337078,
> 1.24825519695535, 5, 3.27167737085564, 2.2107731064995, 0.187339326704238,
> 5, 5, 2.78773672362584, 0.977242332964066, 1.05162966383033,
> 4.24031503174416, 1.9558880208883, 4.01331863994726, 5, 5,
> 4.50553723427244,
> 4.03830955873134, 0.0731678404955063, 0.326005643499137, 1.48169477386196,
> 5, 5, 2.1217771592687, 1.55381162571676, 5, 0.388739153131157,
> 5, 5, 1.22549904356884, 4.30605773910623, 5, 5, 3.90617032103214,
> 0.884096418271427, 1.7166358084411, 4.26908188373059, 1.97226101693004,
> 5, 0.831616239014777, 0.001, 4.15065454327444, 5, 5, 2.6582186770924,
> 4.69752970800906, 4.50106281557844, 4.21353152726281, 5, 0.620184007188853,
> 5, 3.86897558241413, 3.63483407688021, 3.18900423687508, 1.24002620770954,
> 5, 5, 5, 5, 5, 1.20112016323594, 1.99534703415304, 5, 2.13269987318149,
> 3.76529884137316, 2.88523566628984, 1.93828880175044, 5, 1.04561250178734,
> 3.74875347444577, 5, 5, 2.48460418075441, 5, 4.55602711347155,
> 3.97926864514993, 3.59636722716411, 5, 2.95039073432615, 4.82668935707021,
> 3.70517802450053), group = structure(c(1L, 1L, 1L, 1L, 2L, 3L,
> 3L, 2L, 3L, 2L, 3L, 4L, 4L, 4L, 2L, 2L, 1L, 3L, 3L, 1L, 3L, 1L,
> 3L, 2L, 3L, 3L, 3L, 2L, 4L, 2L, 3L, 4L, 1L, 2L, 1L, 1L, 2L, 1L,
> 2L, 4L, 2L, 1L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 3L, 2L, 4L, 4L, 4L,
> 2L, 2L, 2L, 2L, 2L, 4L, 4L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 4L, 3L,
> 1L, 4L, 2L, 4L, 3L, 4L, 3L, 4L, 3L, 4L, 3L, 2L, 4L, 1L, 3L, 1L,
> 2L, 2L, 3L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 3L, 3L, 3L, 4L, 3L, 2L,
> 3L, 2L, 3L, 2L, 3L, 1L, 1L, 1L, 4L, 1L, 4L, 4L, 3L, 3L, 3L, 2L,
> 4L, 2L, 4L, 3L, 4L, 2L, 2L, 3L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 2L,
> 3L, 1L, 4L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 4L,
> 2L, 2L, 3L, 2L, 1L, 1L, 3L, 2L, 2L, 1L, 3L, 4L, 1L, 1L, 4L, 1L,
> 3L, 3L, 3L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 2L, 3L, 4L, 4L, 2L, 3L,
> 2L, 2L, 3L, 4L, 3L, 1L, 1L, 1L, 1L, 3L, 1L, 2L, 3L, 2L, 3L, 2L,
> 2L, 4L, 2L, 4L, 4L, 1L, 1L, 1L, 3L, 1L, 1L, 4L, 4L, 1L, 1L, 4L,
> 4L), .Label = c("1", "2", "3", "4"), class = "factor"), cpz = c(0,
> 0, 0, 0, 200, 220, 262.5, 1200, 519.6, 450, 400, 0, 780, 0, 960,
> 750, 0, 450, 262.5, 0, 910, 0, 236.156156156156, 400, 1120, 300,
> 599.8, 820, 300, 89.5, 266.6, 200, 0, 262.5, 0, 0, 640, 0, 302.4,
> 600, 600, 0, 750, 200, 149.925037481259, 0, 100, 0, 0, 788.666666666667,
> 500, 560, 0, 300, 350, 0, 700, 600, 100, 0, 200, 0, 0, 0, 240,
> 0, 0, 520, 0, 0, 0, 286.666666666667, 160, 0, 320, 360, 720,
> 16, 0, 200, 680, 200, 50, 0, 900, 0, 150, 300, 400, 0, 0, 4714.2,
> 0, 0, 0, 100, 300, 0, 480, 600, 300, 0, 450, 450, 1000, 300,
> 899.850074962519, 0, 0, 0, 300, 0, 0, 0, 600, 0, 120, 1574.76,
> 400, 1200, 0, 1240, 10, 0, 450, 300, 0, 450, 0, 0, 0, 0, 0, 600,
> 300, 0, 600, 346.666666666667, 320, 1050, 0, 0, 450, 6000, 300,
> 400, 0, 1050, 300, 200, 300, 1050.24, 450, 450, 0, 0, 225, 400,
> 500, 0, 6000, 750, 0, 0, 300, 0, 2140, 300, 320, 400, 800,
> 766.666666666667,
> 0, 2960, 1200, 200, 640, 640, 198, 600, 600, 0, 600, 666.666666666667,
> 80, 150, 200, 0, 0, 0, 0, 299.850074962519, 0, 0, 200, 400, 600,
> 800, 0, 0, 1342.66666666667, 0, 0, 0, 0, 0, 640, 0, 0, 120, 280,
> 0, 0, 0, 200)), class = "data.frame", row.names = c(NA, -215L
> ))
>
>
>
> --
> Edward Patzelt, PhD
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org 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.
More information about the R-help
mailing list