YDao - 11 months ago 57

R Question

I am trying to compute the predicted/adjusted mean value of an outcome for a given simple linear regression model with both categorical and continuous variables. A quick example would be similar to the following.

`dat <- data.frame(value = c(5,8,41,25,23,56,58,54,51,52,56,59),`

x = c("A","A","A","A","A","A", "B","B","B", "B","B","G"),

y=c("C","C","C","D","D","D", "D","D","D", "D","E","E"),

z = c(34,56,25,35,54,67,43,73,52,78,15,38))

m <- lm(value ~ x + y + z, dat)

How can I compute the adjusted mean value of the output given that x = "A", as well as the confidence interval of that value. Especially when there is another categorical variable in the model.

Thank you!!