Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for custom contrasts #253

Closed
srk7774 opened this issue May 28, 2024 · 5 comments
Closed

Request for custom contrasts #253

srk7774 opened this issue May 28, 2024 · 5 comments

Comments

@srk7774
Copy link

srk7774 commented May 28, 2024

Hello, this package is one of the best with all possible options required. However, if a factor has three levels, is there any way to specify a customer contrast like this: factor_A{1, -1, 0}#factb in simple effects?

@mcfanda
Copy link
Collaborator

mcfanda commented May 29, 2024

custom contrasts are not implemented in the module. However, it is not clear to me what is the contrast that you need. if you elaborate the example, maybe it can be achieved with the contrasts available in the module.

@srk7774
Copy link
Author

srk7774 commented Jun 12, 2024

Say I am running a 3 x 2 x 2 between subject factorial design. These factors are facta, factb, factc. Now I want to check the interaction between facta{0 1 -1} and factb at different levels of factc. Suppose, facta has three types of coaching (no coaching, inhouse coaching, outcampus coaching). Now I want to test interaction between two coching levels and factb at the levels of factc.
table21.1_keppel_3way_pg466.txt

I am also attaching the datafile.

library(phia)
fit = aov(dv ~ facta*factb*factc, data = data)
custom1 <- list(facta=c(0, -.5, 0.5))
testInteractions(fit, custom=custom1, fixed="factb", adjustment="none", across="factc")

Refer to this excellent article:
https://bcdudek.net/3wayanova/3way_factorial_Rmarkdown.html#way-factorial-design.-a-completely-randomized-between-subjects-factorial-design

Refer to this part:
6.4 Contrast Analyses in factorial designs using phia

@mcfanda
Copy link
Collaborator

mcfanda commented Jun 12, 2024

Hi
Even though gamlj is not meant to estimate custom contrast, you can get the results you want using non-custom contrasts.

As for the problem you mentioned: Assume facta levels are a1, a2, a3, factb levels are b1,b2,b3 and fatc levels are c1 and c2. You want to estimate the custom contrast c(0, -.5, 0.5), which is simply the difference between a2 and a3. So, you need to select a coding that gives you that contrast. You can choose "Repeated" in Factor Coding for facta.

You will see that in the parameter estimates table there will be a line with "Effect" equal to "a3-a2". That is your contrast of interest.

If you now want to check the interaction between facta{0 1 -1} and factb at different levels of factc, go to simple effects, set facta as simple effect variable, factc and facb as moderators (in this order to replicate your R code) and look at the Simple Interaction - Parameter Estimates. You get the test and the p.value for the interaction contrast facta*factc. The ones with (a3-a2) labels are the tests you are interested in.

In general, here is a help page that shows how to exactly replicate the results in Dudek's page in jamovi GAMLj. I always try to test the module against some reproducible methods.

@mcfanda
Copy link
Collaborator

mcfanda commented Jun 19, 2024

At the end I decided to implement custom contrasts in GAMLj3 after all. Now (since version 3.3.2) one can specify custom codes for contrasts and do all sort of analyses with them. See an example here. The new version is coming out next week (preview here

@srk7774
Copy link
Author

srk7774 commented Jun 19, 2024

This is an amazing feature and thanks for taking the time to implement it. I would test this feature once the update is released.

@mcfanda mcfanda closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants