Displaying 3 results from an estimated 3 matches for "xmpldata".
2024 Feb 27
1
Interactions in regression
...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.991...
2024 Feb 28
1
Interactions in regression
...an 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 T...
2024 Feb 25
1
Interactions in regression
Hi,
I do not want to make a plot, I try to make an output table in R, (in GUI
like Stata this is trivially easy task)
with regard to SO OP question. As I mentioned, in paper I would not do
this, but out of curiosity I use R this time trying to create it.
If in R this is trivial task as well, could you please show how to do it ?
After googling a lot I did not find solution.
regards,
Jacek
niedz.,