# With two related variables, eg, religion and religiosity, how do I transform them into one variable for regression?

Say I have the nominal variables of religion (0=Athiest; 1=Christian; 2=Jewish; 3=Muslim; 4=Other)

And then a scale variable of religiosity from 1-10

If I want just one scale variable, so that I can plug the value into a regression modeling something DV that is either on a scale of 1-10, or is binary, is the solution to this to create a dummy variable for religion and then compute all new variables of

'Atheist-ness' = Religion_Athiest*Religiosity

'Christian-ness' = Religion_Christian*Religiosity

'Jewish-ness' = Religion_Jewish*Religiosity

'Muslim-ness' = Religion_Muslim*Religiosity

'OtherReligious-ness' = Religion_Other*Religiosity

?

Because then my regression model will look like:

Constant + (factor* value) + (factor* value) + (factor* value) + (Atheist-ness* value) + (Christian-ness* value) + (Jewish-ness* value) + (Muslim-ness* value) + (OtherReligious-ness* value)

All of these religions are discrete variables, so will it not matter, because any new individual plugged in will have 0 for all values related to religion, other than the one that they apply to?

My first question is: Is there a more correct and efficient way to do this? I am using SPSS. This seems like the intuitive way to do it but I am not sure if there is another way I am missing.

My second question is: Can someone explain to me in layman's terms what I've done and more importantly why I've done it?

• @DaveHarris you could explain this in a nicer tone and actually provide some constructive feedback. As far as categorical variables go, it is very common to represent them as zero-or-one dummy codes, so you very much can multiply them together. If what they are trying to do doesn’t make sense, explain in an answer and in a way that makes people feel as if they want to actually return to this forum for help in the future. Apr 24, 2018 at 23:38
• @DaveHarris The OP specifically mentioned dummy-coding the categorical variable, which would not treat Muslim as literally three times as much as Christianity. Please follow the guidelines for not being rude and moreover very much unhelpful to the OP. Apr 24, 2018 at 23:50
• @DaveHarris I am with MarkWhite: your tone is reading hostile. Your comment "I am trying to be helpful. I am not trying to be rude. I am being matter of fact. There is no emotional content involved on my side. It is how you are reading it." suggests you might benefit from today's xkcd. You tone is coming through in your imputations of meanings the OP has not written. Apr 25, 2018 at 0:20

First, if you could add a few things in an edit to your question, I think we could help more:

• What is the goal of your analysis?
• What are you trying to predict from this model?
• How was "religiosity" measured?

I will assume that "religiosity" means how dedicated they are to whatever their religious belief is: a 5 means they are moderately committed, a 10 means they are very committed, etc.

Since someone can only select one religion, what dummy-coding the religious affiliation and then multiplying each by religiosity does is make everyone have a score of zero for everything and then a score that is equal to their religiosity score for whatever religion they subscribe to (since their score for that dummy-coded variable is 1).

So, if I was an atheist who selected 8 on "religiosity" (here, I'm assuming it is how committed one is to their religion), my dummy-coded variable for atheism would be "1", so the scores for me resulting from multiplication would be:

• Athiestness: 8
• Christianness:0
• Jewishness: 0
• Muslimness: 0
• Otherness: 0

On their own, these scores might not be helpful. So in the model you specified with only these multiplicative terms present, I would have a hard time finding that model useful or very interpretable.

However, if you include the dummy codes, the religiosity score, and all of the multiplicative effects together in a model, you have an interaction you are testing. What this model could do is help answer the question: "Does religiosity relate to my DV for different religious groups?"

For example, let's say you had the hypothesis that religiosity is related to capitalistic beliefs, but only for Christians. You might make this hypothesis due to research on Protestant work ethic, for example.

A model that looks like:

capitalistic_beliefs ~ all_religion_dummies + religiosity + all_religion_dummies * religiosity


Could answer that question. (Where all_religion_dummies refers to all of the 0-or-1 variables for if they are Atheist, Christian, Jewish, etc.)

If you were to get a significant interaction, you could them probe it with simple slopes analyses to see if the slope for religiousness is significant only for Christians.

Again, it is difficult to tell if what you are doing makes sense or is helpful to your research goal without knowing the dependent variable. I'd be happy to take a look at the question again if you edit it with more detail or need to know anything further.

To demonstrate, I simulated data where there was a relationship between religiosity and capitalistic beliefs for Christians, but not for other religions. I simulated these data in R using the following code, then ran a model and tested for the interaction:

set.seed(1839) # set seed for replicability
n <- 5000 # set number of participants
religiosity <- rnorm(n) # generate religiosity as normally distributed variable
# make it so that capitalistic beliefs (cb) is only related to religiosity
# for christians
cb_other <- rnorm(1000) # just predicted by error
cb_muslim <- rnorm(1000) # just predicted by error
cb_jewish <- rnorm(1000) # just predicted by error
cb_christian <- religiosity[3001:4000] + rnorm(1000) # by religiosity and error
cb_atheist <- rnorm(1000) # just predicted by error
# make into data set
dat <- data.frame(
religiosity = religiosity,
capitalistic_beliefs = c(
cb_other, cb_muslim, cb_jewish, cb_christian, cb_atheist
),
religious_affiliation = factor(c(
rep("other", 1000), rep("muslim", 1000), rep("jewish", 1000),
rep("christian", 1000), rep("atheist", 1000)
))
)

# run regression with interactions you speak of—the interaction terms are where
# religiosity is multipled by their affiliation
# I do not specify dummy-codes explicitly, because R does it on its own
# without me having to do it! one of the reasons I would suggest using R
# instead of SPSS!
# compare model without interactions (just plus sign) to those with interactions
# (including multiplication)
model_without_ints <- lm(capitalistic_beliefs ~ religiosity + religious_affiliation, dat)
model_with_ints <- lm(capitalistic_beliefs ~ religiosity + religious_affiliation +
religiosity * religious_affiliation, dat)
anova(model_without_ints, model_with_ints) # interaction is significant!


That last call gives us this result, showing the interaction was significant:

Model 1: capitalistic_beliefs ~ religiosity + religious_affiliation
Model 2: capitalistic_beliefs ~ religiosity + religious_affiliation +
religiosity * religious_affiliation
Res.Df    RSS Df Sum of Sq      F    Pr(>F)
1   4994 5711.1
2   4990 4949.2  4    761.93 192.05 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Then we can graph it!

library(ggplot2)
ggplot(dat, aes(x = religiosity, y = capitalistic_beliefs, color = religious_affiliation)) +
geom_smooth(method = "lm", se = FALSE)


Which looks like:

In short: Those scores of dummy-codes multiplied by religiosity don't mean much alone. But when you include them as interaction terms in a regression context, they can test interesting moderation hypotheses.

Note: I know the R code above is somewhat inefficient, but I wanted to make it so that one could follow along if they were only familiar with SPSS, per the OP mentioned in their post.

• I read it several times but not really sure. Why 8 times 0 is 8?? The answer is unclear to me. Apr 25, 2018 at 0:13
• @SmallChess I updated my answer for clarity. It is 8 * 1, because since I identify as an atheist, my dummy-coded variable would be 1 for atheist and 0 for everything else, leading to those scores. Apr 25, 2018 at 0:18
• Thank you for your answer, Mark, this made a lot of sense to me up until about halfway through where my lack of technical language knowledge started making it difficult, but all of the first part made sense. My data is literally just a list of characteristics (height, eye colour, religion, religiosity, political affiliation, political interest, level of education etc) about a group of individuals, there are some DVs such as average perceived attractiveness, career satisfaction, level of charity giving, fitness etc. Apr 25, 2018 at 0:28
• It's just a dataset with no real research question in mind, but I'm using it as practice data and religion and religiousness seemed like a good opportunity to look at a categorical and scale measure that are related, and how they can help model an equation. So, can I model how generous someone is likely to be? Or how attractive they report themselves to be found by people they date? Apr 25, 2018 at 0:30
• @Sophie I updated my answer including a sample data set, analyses, and visualization that I just simulated. You could look at, for instance, of religiosity is related to generosity differently for people across different religious groups. I would suggest looking into the literature on "moderation" and "moderators" to get a feel for what those interaction terms could tell you. Apr 25, 2018 at 0:33

You cannot transform them together. There is an illusion that they are similar because they both involve religion. They are very different. Consider the following set of categorical variables, $\{cow, apple, house\}.$ We will denote them $\{1,2,3\}$. Basically, if there is a relationship, it is hidden, although one might exist. They may all be on the same parcel of land. Now consider a scaling variable, their mass. Let us assume we have various weights of cows, apples, and houses and we rank each 1,2,3$\dots$10. Now assume that you pick up one cow of rank 3 mass and one house of rank 1 mass. $1\times{3}=3\times{1}$ but you cannot really say what that three means. These are separate dimensions.

Although it is true that you can sometimes multiply dummy variables, this is not one of those cases. Multiplication implies that there is an interaction between the dimensions.

There are also serious problems with your categories. They have to be mutually exclusive. Your categories are not. Buddhism doesn't have a god, although Buddhists can optionally have gods. So a Buddhist could be an atheist or an other. Some relgious groups, such as Mormon's are not considered Christian by other religious groups. If this is self-report then you can get a misclassification. Mormons and members of the Oriental Orthodox Church do not accept the council of Nicaea's statement of faith, which to most Christian groups implies they cannot be Christian. Finally, you can be Jewish and Christian at the same time or Jewish and Muslim or Jewish and atheist and Jewish and other.

Categorical variables must be mutually exclusive. People who use religion in research usually go around the categorical labels if there is some risk of misclassification unless self-classification is of interest in and of itself. For example, Barrack Obama self-classifies as black but there was a significant issue at the beginning of his campaign as to whether others considered him black or white. If you are studying classification, then the labels matter, but if the correctness of the label matters then you ask questions that get you to the label.

To give an example, the Orthodox do not accept the filioque in the Nicene Creed. If you were trying to identify Christians you could not ask if they accept the creed as the Orthodox read it without the filioque while Catholics and Protestants read it with the filioque. Simply asking if you believe the Nicene creed would lump the Orthodox in with Protestants and Catholics, which the Orthodox would tell you is an error as a strictly partisan Orthodox would tell you there are Christians and heretics and the Orthodox are the Christians.

You need to figure out what your actual dependent variable is and figure out what your research question is and your available variables. After that, you can work out your form and collect your data.

There is also a wording issue. Religiosity does not apply to atheists as atheists have no belief in the divine, by definition. They are a non-group. To use a famous phrase, atheists are a religion as non-stamp collecting is a hobby. You would be better off including atheists as "others" unless religiosity matters to you. If it does, then atheists will be a confounding variable and you need a way to separate them out. You may seek some set of behaviors that parallel religiosity such as passion for things people believe in.

If you have two dimensions then you are stuck with two dimensions.

EDIT

So let's assume you can construct mutually exclusive groups. Then you need to be very careful on what your religiosity and your religiosity times group dummy would mean.

If you are assuming that there is a cluster of behaviors called religiosity that is common to all humans, then you are going to have be very careful by adding an interaction term.

Consider a different variable, such as walking speed. A religious group shouldn't impact walking speed unless one of the "other" groups happens to engage in some behavior that is known to impact walking speed. Imagine a religion built around track and field events, then you can see it could be the case.

Religiosity is going to be very difficult to measure because if you include groups like atheists, then if one of your scale questions is "prays every day," then you are going to get zeros in that question.

That is a valid interaction effect and the multiplication would mean something. But it begs the question of "did you not know that before you asked the research question?"

The multiplication component will imply that there is a unique relationship between the group and religiosity that is not common to other humans. There is a reason I find this concerning.

The F-test checks to see if all slopes are equal to zero. Normally this isn't an issue. Now let us imagine one of your variables was the velocity of a falling bowling ball. We know due to gravity that the object will have a positive velocity. That one slope cannot have a zero, so the F-test will automatically show up as "significant."

By including atheists in a religiosity question, you may get a case where no matter what you ask, all F-tests will show up as "significant."

It is a psychometrically difficult question because it may be that there are atheists who would score high on religiosity if religiosity were instead a measure of passion or devotion to something believed in or amount of time spent working on it.

I would look at some scale such as the Work Environment Scale which is an unbelievably careful instrument to measure the work environment. You are also going to have to be very careful with language use. I can remember a young woman who converted from being a Baptist to being a Catholic. Her sole reason for converting, and I did get to know her pretty well, was that Catholics looked up at the cross when they prayed and Baptists looked down. She felt one might be right while the other one wrong. This led her to investigate and she chose Catholicism.

This very small difference altered her life and her definitions of right and wrong. You have to be super careful with language and religion. Very small things can have deep or profound meanings to some that you do not intend.

If one is realistic rather than theoretical regarding a psychometric instrument, an interaction effect would likely really imply that members of a group are understanding the wording of your questions differently from the people in other groups, rather than that there is an actual behavioral, emotional or deep cognitive difference.

• The data is example data and I am just trying to get to grips with how to analyse data before I do any data collection, so for the purposes of the example, religion is mutually exclusive for simplicity's sake. Instead of asking these two questions I could have asked 'how often do you pray/go to a religious service/engage in religious community etc' for each of the religion groups and only allowed an answer to one with all other answers defaulting to 0, which would have given me a measure of 'how Muslim-ish' a Muslim which is directly comparable to 'how Jewish-ish a Jew is' Apr 25, 2018 at 0:43
• but as I only have religion and religiousness as variables, I'm trying to see if I can get scale data for Jewish-ness, Muslim-ness etc in a model that predicts a DV by making a new binary IV for each religion and combining this with religiousity to end up with measures of how Muslim, Christian etc people are. Apr 25, 2018 at 0:46
• @Sophie This is an interesting measurement conundrum because probably someone's religion is mutually exclusive for most people. (If you want strictly religious beliefs, I would avoid asking a question that could get people answering for secular/cultural/ethnic reasons). I do not think you necessarily need a continuous variable for "how Muslim a Muslim is." You could just ask them their religion. All of this depends on your research question, though, as I discussed in my answer. Apr 25, 2018 at 0:50
• I think religiosity is an important measure, though, because within my data, I have a Christian who is very devout, and a Christian who believes in Jesus and goes to Church once a year, for example. I might have an Atheist who doesn't really care much about their beliefs, and one likes to engage in this belief a lot. At the end of the day I am not too worried about the measures, more about how to deal with related variables. Apr 25, 2018 at 1:06
• @Sophie can you create multiple scales of "religiosity?" For example, can you separate out belief from behavior? Am I allowed to attend church every day but have no belief? Can I have fanatical belief but don't attend services? Apr 25, 2018 at 1:12