


To perform simple linear regression, select Analyze, Regression, and Linear…įind policeconf1 in the variable list on the left and move it to the Dependent box at the top of the dialogue box. Now, let’s run our first linear regression, exploring the relationship between policeconf1 and sex1. You should see your new dummy variable sex1 at the end of the list, as it’s the last variable to be created. Scroll down to the very end of the variables list in Variable View.

Click Add, and then Continue.įinally, click OK in the original Recode into Different Variables dialogue box. Now enter 2 under the Old Value header and 1 under the New Value header. You should see 1 -> 0 in the Old -> New text box. We’ve chosen to call this new variable sex1 and label it Sex Dummy Variable.Ĭlick Change, to move your new output variable into the Numeric Variable -> Output Variable text box in the centre of the dialogue box.Įnter 1 under the Old Value header and 0 under the New Value header. Next, under the Output Variable header on the left, enter in the name and label for the new sex variable we’re creating. To begin, select Transform and Recode into Different Variables.įind our variable sex in the variable list on the left and move it to the Numeric Variable -> Output Variable text box. This way, if you make an error while building the dummy variables, you haven’t altered your original variable and can always start again. (We will see later that creating dummy variables for categorical variables with multiple levels takes just a little more work.) However, it’s good practice to create a new variable altogether when you are creating dummy variables. (Remember, these numbers are just indicators.)īecause our sex variable only has two categories, turning it into a dummy variable is as simple as recoding the values of Male and Female from 1=Male and 2=Female to 0=Male and 1=Female. This allows us to enter in the sex values as numerical. For example, in the dummy variable for Female, all cases in which the respondent is female are coded as 1 and all other cases, in which the respondent is Male, are coded as 0. Each dummy variable represents one category of the explanatory variable and is coded with 1 if the case falls in that category and with 0 if not. Dummy VariablesĪ dummy variable is a variable created to assign numerical value to levels of categorical variables. We can avoid this error in analysis by creating dummy variables. This would provide us with results that would not make sense, because for example, the sex Female does not have a value of 2. So, if we were to enter the variable sex into a linear regression model, the coded values of the two gender categories would be interpreted as the numerical values of each category. However, linear regression assumes that the numerical amounts in all independent, or explanatory, variables are meaningful data points. The codes 1 and 2 are assigned to each gender simply to represent which distinct place each category occupies in the variable sex. However, before we begin our linear regression, we need to recode the values of Male and Female. We want to perform linear regression of the police confidence score against sex, which is a binary categorical variable with two possible values (which we can see are 1= Male and 2= Female if we check the Values cell in the sex row in Variable View). Does sex influence confidence in the police?
