[RESOLVED] lm(), manova(), mancova() - what's the differenc?

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
SCurle
Posts: 2
Joined: Sat Dec 09, 2017 8:46 am

[RESOLVED] lm(), manova(), mancova() - what's the differenc?

Post by SCurle »

Hello,

I'm wondering what the difference is between a few functions in R:

manova(outcome ~ predictor+predictor)

lm(outcome ~ predictor+predictor)

then your package

mancova(data, deps, factors = NULL, covs = NULL, multivar = list("pillai",
"wilks", "hotel", "roy"), boxM = FALSE, shapiro = FALSE, qqPlot = FALSE)

I Googled - how to do a MANCOVA In R
and there was one answer:

manova(outcome ~ predictor+predictor)

Your package does not even use the ~ operator.
But is it doing the same thing behind the scenes?

It seems the llm amd manova functions somehow use the cumulative sum (using +) of variables
- whereas your package does not do this same thing? - it operationalises the variables using a comma ,

Does this make a difference?

I noticed that the Mulitple Regression (lm function) only gives me the output comparable to your 'Univariate' output. And there are differences in terms of which variables are significant for which latents compared to the mancova function.

Are these not using the same Least Square estimator?
Why would the results be different?

Many thanks for your time in helping me to understand all of this.
User avatar
Ravi
Posts: 194
Joined: Sat Jan 28, 2017 11:18 am

Re: lm(), manova(), mancova() - what's the difference?

Post by Ravi »

Hi,

So manova() and lm() use formula notation to define the models, while mancova() emulates the way things are done in jamovi and thus uses a different format. You can read up on formula notation over here: https://science.nature.nps.gov/im/datam ... /formulas/.

Under the hood though, jmv::mancova takes the input arguments turns them into formula notation and fits the model using the manova function. So in the end they have the same results.

The lm() function is a the general function to fit linear models, and you can use that to fit the manova too. However, by itself it will only output the model coefficients for the dependent variables individually, but not the MANOVA and univariate ANOVA results. To do this you still need the manova function.

Here's some example R code:

Code: Select all

# Data
npk2 <- within(npk, foo <- rnorm(24))

# Fit model using only manova function
result1 <- manova(cbind(yield, foo) ~ block + N*P*K, npk2)

# Fit model using lm + manova
model <- lm(cbind(yield, foo) ~ block + N*P*K, npk2)
result2 <- manova(model)

# Extract MANOVA test results
summary(result1)

# Extract univariate ANOVA results
summary.aov(result1)
Hope that makes things a bit clearer for you.

Cheers,
Ravi
SCurle
Posts: 2
Joined: Sat Dec 09, 2017 8:46 am

Re: lm(), manova(), mancova() - what's the difference?

Post by SCurle »

Hi Ravi,

Aha! I thought so .. thank you so much. This makes things much clearer.

Thank you for the sample code as well. :)

Cheers.
Post Reply