[R] Interactions in regression
Jacek Kownacki
@@m@ungx1298 @end|ng |rom gm@||@com
Thu Feb 29 13:40:19 CET 2024
Hi Rolf,
No it is not.
I don't know to which question did you want to respond ?
I desribed everything in my first email and attached links from SO with
pictures included, which are quite understandable.
Cheers,
Jacek
śr., 28 lut 2024 o 19:42 Jacek Kownacki <samsungx1298 using gmail.com> napisał(a):
> Hi Rolf,
> No it is not.
> I don't know to which question did you want to respond ?
> I desribed everything in my first email and attached links from SO with
> pictures included, which are quite understandable.
>
> Cheers,
> Jacek
>
> wt., 27 lut 2024 o 02:29 Rolf Turner <rolfturner using posteo.net> napisał(a):
>
>>
>> I have no real idea what you are trying to do, but if a table is
>> what you want, you can probably get it using the table() function.
>> Or, more likely, the xtabs() function.
>>
>> Using your example from an earlier post (adjusted to make it
>> comprehensible to the human mind):
>>
>> set.seed(1000)
>> time <- factor(rep(c("Pre","Post"),each=200))
>> treatment <- factor(rep(rep(c("Control","Treatment"),each=100),2))
>> mu <- rep(rep(1:2,each=100),2)
>> response <- rnorm(400,mean=mu)
>> xmpldata <- data.frame(time=time,treatment=treatment,response)
>> mod <- lm(response~time*treatment,data=xmpldata)
>> yhat <- fitted(mod)
>> xtb <- with(xmpldata,xtabs(yhat ~ time+treatment))
>>
>> print(xtb)
>>
>> > treatment
>> > time Control Treatment
>> > Post 94.10501 201.99112
>> > Pre 101.63792 210.04248
>>
>> Is that (something like) what you want?
>>
>> cheers,
>>
>> Rolf Turner
>>
>> P.S. You said: "I usually use GUI software". Now *there* lies your
>> problem. A GUI is a black box that removes all control over what is
>> going on, from your hands.
>>
>> R. T.
>>
>>
>>
>>
>> --
>> Honorary Research Fellow
>> Department of Statistics
>> University of Auckland
>> Stats. Dep't. (secretaries) phone:
>> +64-9-373-7599 ext. 89622
>> Home phone: +64-9-480-4619
>>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list