1
$\begingroup$

I have a data set, have two interval variables and lots of categorical (ordinal and nominal) sociodemographic variables.
Lets say one of may interval variable is $x$ and the other is $y$, I want to test effect of $x$ and a demographic variable such as gender or educational level on $y$. In other words, how can I compare or find a relationship of $x$ scores with different educational levels and $y$ scores (dependent variable)? I want to say that there is a difference between $x$ scores from high school and $y$ scores. Or I want to say that there is a relationship between $x$ scores from high school and $y$ scores. Or I want to say that x scores from university educational level is related to y scores.

$\endgroup$
0

3 Answers 3

1
$\begingroup$

If you only need to see if the continuous variable $Y$ is different across levels of some factors $F_1$, $F_2$ while controlling for the values of the continue variable $X$ then you need ANCOVA.

A sample R code for the above scenario would be

X = c(65, 65, 60, 70, 55, 80, 40, 90, 50, 100, 30, 95)
F1 = as.factor(c(0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0))
F2 = as.factor(c(3, 4, 2, 1, 2, 4, 5, 4, 1, 2, 1, 4))
Y = c(29, 28, 22, 19, 18, 28, 16, 25, 17, 35, 15, 32)
ancova.df = data.frame(X, F1, F2, Y)
library(car)
Anova(lm(Y ~ X + F1 + F2, ancova.df))

If you want to provide also a prediction for $Y$ in terms of $X$ and the factors $F_1$, $F_2$, ..., $F_k$ then regression is the answer. If a factor is nominal or ordinal with 2 values then use it as is. If a factor has more than two values then create the corresponding dummy variables and use that new variables in the linear model instead of the original variable.

Hope the above will help you.

$\endgroup$
0
$\begingroup$

Regression certainly seems like the place to start. It also sounds like you want to do some stratified analysis.

$\endgroup$
0
$\begingroup$

You have one continuous response variable (Y) and and two or more inputs (X and gender/ educational level).

You can use multiple regression using dummy variables.

https://www.researchgate.net/post/how_can_I_run_dummy_variable_regression_model_for_January_effect_is_there_any_guide_on_how_to_use_it

may be useful.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.