这是一篇来自加拿大的关于创建一个交互变量,使用估计系数来形成一个线性函数,预测任何年龄的任何性别的残疾概率。解决以下病例概率的作业代写
Creating Dummy (or Indicator or Binary) Variables:
Find the variable sex of respondent (ecsex99). Note that it is coded 1=male and 2=female. It is much easier to interpret regression results for binary variables if they are coded 1 and 0. Let’s create a new variable called “male” for which 1=male and 0=female.
Click on Data (at top left side of window), then on “Create or change data”, then on “Other variablecreation commands”, and finally on “Create indicator variables”
Select Sex of Respondent (ecsex99) and type “male” asthe “New variables’ stub.
Check your work by looking at the “Variables” panel (scroll down to the bottom). Note that you have created two dummy variables. “male1” is equal to 1 for males and 0 for females; “male2” is the reverse. You can check this by entering “tabulate male1 ecsex99” and “tabulate male2 ecsex99” in the Command area at the bottom of the screen. Note that “tab” can be used as short for “tabulate”.
Now do the same transformation for Disability Status (disabs26); name the new variable “disability”.
Note that you have created two dummy variables. disability1 is equal to 1 for disabled and 0 for not disabled; disability2 is the reverse. You can check this by entering “tab disability1 disabs26” and “tab disability2 disabs26”.
Creating an interaction variable.
Now create a new variable that will allow you to see if the effect of age depends on sex and vice-versa.
For this we need to create a new variable that stands for the interaction between “male” and “age”.
Click on Data (at top left side of window), then on “Create or change data”, and finally on “Create a new variable” Enter the name “MaleAge” asthe Variable name.
In the “Contents of variable” window, enter ecage26*male1 (in the blank box under ‘Specify a value or an expression).
Then click OK. Check the interaction variable in the list of Variables (go to end of the variables list). This new variable should take on a value = ecage26 for males and a value = 0 for females. Check by typing “summarize MaleAge if male1==1” and then “summarize MaleAge if male1==0”. Note that “sum” can be used as short for “summarize”.1. (5 points total) Estimate the following linear regression by clicking on Statistics >> Linear Models and
related >>Linear regression:
Dependent Variable: disability1
Independent Variables: (1) Constant (this is included automatically – you do not need to do anything);
(2) Person’s age in refyear (ecage26), (3) male1
1.1 (1 point) Provide a copy of the output (either screenshot the output or ‘Copy as Picture’ and crop/edit the image accordingly).
1.2 (2 points) Explain the meaning of the coefficients (including the constant) in the following two senses:
- What do the coefficients mean mathematically? Use the estimated values in your answer.
- What are some economic reasons why the coefficients might take on the values that they do?
1.3 (2 points) You can use your estimated coefficients to form a linear function predicting the probability of a disability for either sex at any age. Solve for this probability for the following cases:
- A 25-year-old male
- A 40-year-old female
- A 65-year-old male
- A 62-year-old female
- (3 points total) Estimate the following regression:
Again, click on Statistics >> Linear Models and related >>Linear regression:
Dependent Variable: After Tax Income (atinc42)
Independent Variables: (1) Constant; (2) Person’s age in refyear (ecage26), (3) male1, (4) MaleAge
2.1 (1 point) Provide a copy of the output (either screenshot the output or ‘Copy as Picture’ and crop/edit the image accordingly).
2.2 (2 points) Explain the meaning of the coefficients (including the constant) in the following two senses:
- What do the coefficients mean mathematically? Use the estimated values in your answer.
- What are some economic reasons why the coefficients might take on the values that they do?