Skip to main content
changed due to DBR's answer (which should have been a comment)
Source Link
John
  • 23.6k
  • 9
  • 59
  • 93

You're specifying ifIncongruent as both an effect and the grouping for the multi-level model. When you put ifIncongruent after the "|" that was telling it that your data is nested within it's interaction with subj. I doubt that's what you want. Even if it is, you can't also have it as an effect as well. Maybe you meant?

model <- lmer( rtln ~ ifIncongruent + gender + ifIncongruent:gender + (1 + ifIncongruent|subj), data=dataset )

or shorterEDIT: Looking at your Stata output you may have meant

model <- lmer( rtln ~ ifIncongruent *+ gender + ifIncongruent:gender + (11|subj) + (0 + ifIncongruent|subj), data=dataset )

?? or shorter

model <- lmer( rtln ~ gender * ifIncongruent + (1|subj) + (0 + ifIncongruent|subj), data=dataset )

At least it's allowedYou DO NOT have separate intercepts for your random effects in the output shown here for your Stata model. What you'll see there though is You'd need to print the random effects for that (in R that works out correlations across subjects between their intercept effectranef(model)). You do have seperate estimates of the standard deviation of random subject and ifIncongruent effects. Maybe that's what you want?

You should really try to specify in regular language... not lmer... what you're trying to accomplish if this isn't it. Describe the complete model you're trying to test.

EDIT: OK, now you're provided something else that STILL isn't a real description of what you're trying to model but perhaps one can get a little closer. You see... you are modeling random intercepts of subject, true, but inIncongruent... you've never specified what the heck it is. It doesn't seem like a nesting factor at all. You're not describing At least describe the structure of your data or the model you want at all. You can have fixed and random interceptssomething. The fact that you have two is kind All of orthogonal to that fact.

Nevertheless, this gets closer to whatthese arbitrary variables you seem to be implyingkeep posting in your questions don't mean anything.

model <- lmer( rtln ~ ifIncongruent + gender + (1|subj) + (1|ifIncongruent), data=dataset )

This allows nesting within both ifIncongruent and subj Craft a proper question and allows for two estimates of intercepts for each... asyou can get a random effect (ranef(model))proper answer.

You're specifying ifIncongruent as both an effect and the grouping for the multi-level model. When you put ifIncongruent after the "|" that was telling it that your data is nested within it's interaction with subj. I doubt that's what you want. Even if it is, you can't also have it as an effect as well. Maybe you meant?

model <- lmer( rtln ~ ifIncongruent + gender + ifIncongruent:gender + (1 + ifIncongruent|subj), data=dataset )

or shorter

model <- lmer( rtln ~ ifIncongruent * gender + (1 + ifIncongruent|subj), data=dataset )

??

At least it's allowed. What you'll see there though is that that works out correlations across subjects between their intercept effect and ifIncongruent. Maybe that's what you want?

You should really try to specify in regular language... not lmer... what you're trying to accomplish if this isn't it. Describe the complete model you're trying to test.

EDIT: OK, now you're provided something else that STILL isn't a real description of what you're trying to model but perhaps one can get a little closer. You see... you are modeling random intercepts of subject, true, but inIncongruent... you've never specified what the heck it is. It doesn't seem like a nesting factor at all. You're not describing the structure of your data or the model you want at all. You can have fixed and random intercepts. The fact that you have two is kind of orthogonal to that fact.

Nevertheless, this gets closer to what you seem to be implying.

model <- lmer( rtln ~ ifIncongruent + gender + (1|subj) + (1|ifIncongruent), data=dataset )

This allows nesting within both ifIncongruent and subj and allows for two estimates of intercepts for each... as a random effect (ranef(model)).

You're specifying ifIncongruent as both an effect and the grouping for the multi-level model. When you put ifIncongruent after the "|" that was telling it that your data is nested within it's interaction with subj. I doubt that's what you want. Even if it is, you can't also have it as an effect as well. Maybe you meant?

model <- lmer( rtln ~ ifIncongruent + gender + ifIncongruent:gender + (1 + ifIncongruent|subj), data=dataset )

EDIT: Looking at your Stata output you may have meant

model <- lmer( rtln ~ ifIncongruent + gender + ifIncongruent:gender + (1|subj) + (0 + ifIncongruent|subj), data=dataset )

or shorter

model <- lmer( rtln ~ gender * ifIncongruent + (1|subj) + (0 + ifIncongruent|subj), data=dataset )

You DO NOT have separate intercepts for your random effects in the output shown here for your Stata model. You'd need to print the random effects for that (in R that ranef(model)). You do have seperate estimates of the standard deviation of random subject and ifIncongruent effects.

You should really try to specify in regular language... not lmer... what you're trying to accomplish if this isn't it. Describe the complete model you're trying to test. At least describe the structure of your data or something. All of these arbitrary variables you keep posting in your questions don't mean anything. Craft a proper question and you can get a proper answer.

changed due to DBR's answer (which should have been a comment)
Source Link
John
  • 23.6k
  • 9
  • 59
  • 93

You're specifying ifIncongruent as both an effect and the grouping for the multi-level model. When you put ifIncongruent after the "|" that was telling it that your data is nested within it's interaction with subj. I doubt that's what you want. Even if it is, you can't also have it as an effect as well. Maybe you meant?

model <- lmer( rtln ~ ifIncongruent + gender + ifIncongruent:gender + (1 + ifIncongruent|subj), data=dataset )

or shorter

model <- lmer( rtln ~ ifIncongruent * gender + (1 + ifIncongruent|subj), data=dataset )

??

At least it's allowed. What you'll see there though is that that works out correlations across subjects between their intercept effect and ifIncongruent. Maybe that's what you want?

You should really try to specify in regular language... not lmer... what you're trying to accomplish if this isn't it. Describe the complete model you're trying to test.

EDIT: OK, now you're provided something else that STILL isn't a real description of what you're trying to model but perhaps one can get a little closer. You see... you are modeling random intercepts of subject, true, but inIncongruent... you've never specified what the heck it is. It doesn't seem like a nesting factor at all. You're not describing the structure of your data or the model you want at all. You can have fixed and random intercepts. The fact that you have two is kind of orthogonal to that fact.

Nevertheless, this gets closer to what you seem to be implying.

model <- lmer( rtln ~ ifIncongruent + gender + (1|subj) + (1|ifIncongruent), data=dataset )

This allows nesting within both ifIncongruent and subj and allows for two estimates of intercepts for each... as a random effect (ranef(model)).

You're specifying ifIncongruent as both an effect and the grouping for the multi-level model. When you put ifIncongruent after the "|" that was telling it that your data is nested within it's interaction with subj. I doubt that's what you want. Even if it is, you can't also have it as an effect as well. Maybe you meant?

model <- lmer( rtln ~ ifIncongruent + gender + ifIncongruent:gender + (1 + ifIncongruent|subj), data=dataset )

or shorter

model <- lmer( rtln ~ ifIncongruent * gender + (1 + ifIncongruent|subj), data=dataset )

??

At least it's allowed. What you'll see there though is that that works out correlations across subjects between their intercept effect and ifIncongruent. Maybe that's what you want?

You should really try to specify in regular language... not lmer... what you're trying to accomplish if this isn't it. Describe the complete model you're trying to test.

You're specifying ifIncongruent as both an effect and the grouping for the multi-level model. When you put ifIncongruent after the "|" that was telling it that your data is nested within it's interaction with subj. I doubt that's what you want. Even if it is, you can't also have it as an effect as well. Maybe you meant?

model <- lmer( rtln ~ ifIncongruent + gender + ifIncongruent:gender + (1 + ifIncongruent|subj), data=dataset )

or shorter

model <- lmer( rtln ~ ifIncongruent * gender + (1 + ifIncongruent|subj), data=dataset )

??

At least it's allowed. What you'll see there though is that that works out correlations across subjects between their intercept effect and ifIncongruent. Maybe that's what you want?

You should really try to specify in regular language... not lmer... what you're trying to accomplish if this isn't it. Describe the complete model you're trying to test.

EDIT: OK, now you're provided something else that STILL isn't a real description of what you're trying to model but perhaps one can get a little closer. You see... you are modeling random intercepts of subject, true, but inIncongruent... you've never specified what the heck it is. It doesn't seem like a nesting factor at all. You're not describing the structure of your data or the model you want at all. You can have fixed and random intercepts. The fact that you have two is kind of orthogonal to that fact.

Nevertheless, this gets closer to what you seem to be implying.

model <- lmer( rtln ~ ifIncongruent + gender + (1|subj) + (1|ifIncongruent), data=dataset )

This allows nesting within both ifIncongruent and subj and allows for two estimates of intercepts for each... as a random effect (ranef(model)).

Source Link
John
  • 23.6k
  • 9
  • 59
  • 93

You're specifying ifIncongruent as both an effect and the grouping for the multi-level model. When you put ifIncongruent after the "|" that was telling it that your data is nested within it's interaction with subj. I doubt that's what you want. Even if it is, you can't also have it as an effect as well. Maybe you meant?

model <- lmer( rtln ~ ifIncongruent + gender + ifIncongruent:gender + (1 + ifIncongruent|subj), data=dataset )

or shorter

model <- lmer( rtln ~ ifIncongruent * gender + (1 + ifIncongruent|subj), data=dataset )

??

At least it's allowed. What you'll see there though is that that works out correlations across subjects between their intercept effect and ifIncongruent. Maybe that's what you want?

You should really try to specify in regular language... not lmer... what you're trying to accomplish if this isn't it. Describe the complete model you're trying to test.