Does x contribute to y, independent of z?

Hey, I am running into a problem answering the question in the title. All variables are numeric.

lm1 <- lm(y ~ x * z, data = data)

I have tried a pairwise t-test, but am unsure if this is the right approach, but I get an error message:

Error in unique.default(x, nmax = nmax) :
unique() applies only to vectors

Does anyone know how to do this?

Hi, It is a bit hard to tell without seeing the data. Perhaps you could try a reproducible example?

I don't think the lm() function is appropriate for a t-test. This is used for linear models, so for regression analyses. If you do want to run a regression and Z is a control variable, try the below:

lm1 <- lm(y ~ x:z, data = data)

Difficult to tell without a reprex though

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.