[R] Categorical variables using mle2 and slope comparisions

andmag andmag at umich.edu
Thu Nov 1 18:08:41 CET 2012


I am using the mle2 function to run a simple linear model with a normal
distribution. I have one continuous variable (X) and one factor (treatment)
with 6 levels. I have seen ANCOVA examples similar to this, but my goal is
to compare the differences in the slope parameters (the interaction term)
among groups, not overall group means or anything like that. I want the
intercept to be the same for all groups and it seems that I do not even need
to estimate a parameter for X, the continuous variable, but I am having
trouble understanding the different ways to specify a model like this and
why all of these give me different estimates. Any insight or ideas?


mod1 <- mle2 (Y ~ dnorm (mean = B0 + B1* X, sd = sigma), parameters = list
(B1 ~ X : treatment), start = as.list (coef(mod)), data=data)

mod2 <- mle2 (Y ~ dnorm (mean = B0 + B1 * X, sd = sigma), parameters = list
(B1 ~ X : treatment - 1), start = as.list (coef(mod)), data=data)

mod3 <- mle2 (Y ~ dnorm (mean = B0 + B1, sd = sigma), parameters = list (B1
~ X : treatment), start = as.list (coef(mod)), data=data)

mod4 <- mle2 (Y ~ dnorm (mean = B0 + B1, sd = sigma), parameters = list (B1
~ X : treatment - 1), start = as.list (coef(mod)), data=data)


Thanks,
Andrea



--
View this message in context: http://r.789695.n4.nabble.com/Categorical-variables-using-mle2-and-slope-comparisions-tp4648140.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list