Descargar la base de datos de la siguiente

Descargar la base de datos Modelo de Minser

Replicar las siguientes secciones en R-Markdown:

1. Estimación del modelo de Mincer

La ecuación de ingresos propuesto por Mincer (1974), conocida también en la literatura económica como “La Función de Ingresos Minceriana”, es una función en el que los ingresos de los individuos (salarios) varían linealmente con el tiempo invertido en educación, la experiencia laboral y esta última en su forma cuadrática.

El modelo a estimar es el siguiente

wage = beta_0 + (beta_1 * educ) + (beta_2 * exper) + (beta_3 * expersq) + error

donde:

  • wage = salario, medido en pesos mexicanos.

  • educ = educación, medido en número de años

  • exper = experiencia laboral, medido en número de años

  • expersq = experiencia laboral al cuadrado, medido en número de años

2. Análisis estadístico con R

2.1 Instalación de librerías

install.packages('moments')
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
install.packages('lmtest')
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
install.packages('car')
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
install.packages('stargazer')
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)

2.2. Usando las librerías

library(moments)
library(lmtest)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(car)
## Loading required package: carData
library(stargazer)
## 
## Please cite as:
##  Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.3. https://CRAN.R-project.org/package=stargazer

2.3 Utilizando la base de datos:

base <- read.csv("mmincer.csv")
attach(base)

2.4 Seleccionando las variables del modelo

#crear una base
base1=data.frame(wage, educ,exper,expersq)
base1
##      wage educ exper expersq
## 1    3.10   11     2       4
## 2    3.24   12    22     484
## 3    3.00   11     2       4
## 4    6.00    8    44    1936
## 5    5.30   12     7      49
## 6    8.75   16     9      81
## 7   11.25   18    15     225
## 8    5.00   12     5      25
## 9    3.60   12    26     676
## 10  18.18   17    22     484
## 11   6.25   16     8      64
## 12   8.13   13     3       9
## 13   8.77   12    15     225
## 14   5.50   12    18     324
## 15  22.20   12    31     961
## 16  17.33   16    14     196
## 17   7.50   12    10     100
## 18  10.63   13    16     256
## 19   3.60   12    13     169
## 20   4.50   12    36    1296
## 21   6.88   12    11     121
## 22   8.48   12    29     841
## 23   6.33   16     9      81
## 24   0.53   12     3       9
## 25   6.00   11    37    1369
## 26   9.56   16     3       9
## 27   7.78   16    11     121
## 28  12.50   16    31     961
## 29  12.50   15    30     900
## 30   3.25    8     9      81
## 31  13.00   14    23     529
## 32   4.50   14     2       4
## 33   9.68   13    16     256
## 34   5.00   12     7      49
## 35   4.68   12     3       9
## 36   4.27   16    22     484
## 37   6.15   12    15     225
## 38   3.51    4    39    1521
## 39   3.00   14     3       9
## 40   6.25   12    11     121
## 41   7.81   12     3       9
## 42  10.00   12    20     400
## 43   4.50   14    16     256
## 44   4.00   11    45    2025
## 45   6.38   13    11     121
## 46  13.70   15    20     400
## 47   1.67   10     1       1
## 48   2.93   12    36    1296
## 49   3.65   14     9      81
## 50   2.90   12    15     225
## 51   1.63   12    18     324
## 52   8.60   16     3       9
## 53   5.00   12    15     225
## 54   6.00   12     7      49
## 55   2.50   12     2       4
## 56   3.25   15     3       9
## 57   3.40   16     1       1
## 58  10.00    8    13     169
## 59  21.63   18     8      64
## 60   4.38   16     7      49
## 61  11.71   13    40    1600
## 62  12.39   14    42    1764
## 63   6.25   10    36    1296
## 64   3.71   10    13     169
## 65   7.78   14     9      81
## 66  19.98   14    26     676
## 67   6.25   16     7      49
## 68  10.00   12    25     625
## 69   5.71   16    10     100
## 70   2.00   12     3       9
## 71   5.71   16     3       9
## 72  13.08   17    17     289
## 73   4.91   12    17     289
## 74   2.91   12    20     400
## 75   3.75   12     7      49
## 76  11.90   13    24     576
## 77   4.00   12    28     784
## 78   3.10   12     2       4
## 79   8.45   12    19     361
## 80   7.14   18    13     169
## 81   4.50    9    22     484
## 82   4.65   16     3       9
## 83   2.90   10     4      16
## 84   6.67   12     7      49
## 85   3.50   12     6      36
## 86   3.26   12    13     169
## 87   3.25   12    14     196
## 88   8.00   12    14     196
## 89   9.85    8    40    1600
## 90   7.50   12    11     121
## 91   5.91   12    14     196
## 92  11.76   14    40    1600
## 93   3.00   12     1       1
## 94   4.81   12     2       4
## 95   6.50   12     4      16
## 96   4.00    9    19     361
## 97   3.50   13     1       1
## 98  13.16   12    34    1156
## 99   4.25   14     5      25
## 100  3.50   12     3       9
## 101  5.13   15     6      36
## 102  3.75   12    14     196
## 103  4.50   12    35    1225
## 104  7.63   12     8      64
## 105 15.00   14     7      49
## 106  6.85   15    11     121
## 107 13.33   12    14     196
## 108  6.67   12    35    1225
## 109  2.53   12    46    2116
## 110  9.80   17     7      49
## 111  3.37   11    45    2025
## 112 24.98   18    29     841
## 113  5.40   12     6      36
## 114  6.11   14    15     225
## 115  4.20   14    33    1089
## 116  3.75   10    15     225
## 117  3.50   14     5      25
## 118  3.64   12     7      49
## 119  3.80   15     6      36
## 120  3.00    8    33    1089
## 121  5.00   16     2       4
## 122  4.63   14     4      16
## 123  3.00   15     1       1
## 124  3.20   12    29     841
## 125  3.91   18    17     289
## 126  6.43   16    17     289
## 127  5.48   10    36    1296
## 128  1.50    8    31     961
## 129  2.90   10    23     529
## 130  5.00   11    13     169
## 131  8.92   18     3       9
## 132  5.00   15    15     225
## 133  3.52   12    48    2304
## 134  2.90   11     6      36
## 135  4.50   12    12     144
## 136  2.25   12     5      25
## 137  5.00   14    19     361
## 138 10.00   16     9      81
## 139  3.75    2    39    1521
## 140 10.00   14    28     784
## 141 10.95   16    23     529
## 142  7.90   12     2       4
## 143  4.72   12    15     225
## 144  5.84   13     5      25
## 145  3.83   12    18     324
## 146  3.20   15     2       4
## 147  2.00   10     3       9
## 148  4.50   12    31     961
## 149 11.55   16    20     400
## 150  2.14   13    34    1156
## 151  2.38    9     5      25
## 152  3.75   12    11     121
## 153  5.52   13    31     961
## 154  6.50   12     8      64
## 155  3.10   12     2       4
## 156 10.00   14    18     324
## 157  6.63   16     3       9
## 158 10.00   16     3       9
## 159  2.31    9     4      16
## 160  6.88   18     4      16
## 161  2.83   10     1       1
## 162  3.13   10     1       1
## 163  8.00   13    28     784
## 164  4.50   12    47    2209
## 165  8.65   18    13     169
## 166  2.00   13     2       4
## 167  4.75   12    48    2304
## 168  6.25   13     6      36
## 169  6.00   13     8      64
## 170 15.38   13    25     625
## 171 14.58   18    13     169
## 172 12.50   12     8      64
## 173  5.25   12    19     361
## 174  2.17   13     1       1
## 175  7.14   12    43    1849
## 176  6.22   12    19     361
## 177  9.00   12    11     121
## 178 10.00   14    43    1849
## 179  5.77   10    44    1936
## 180  4.00   12    22     484
## 181  8.75   16     3       9
## 182  6.53   16     3       9
## 183  7.60   12    41    1681
## 184  5.00   14     5      25
## 185  5.00   12    14     196
## 186 21.86   12    24     576
## 187  8.64   12    28     784
## 188  3.30   12    25     625
## 189  4.44   12     3       9
## 190  4.55   12    11     121
## 191  3.50   12     7      49
## 192  6.25   16     9      81
## 193  3.85   16     5      25
## 194  6.18   14     9      81
## 195  2.91   11     1       1
## 196  6.25   16     2       4
## 197  6.25   12    13     169
## 198  9.05   12    10     100
## 199 10.00   17     5      25
## 200 11.11   12    30     900
## 201  6.88   12    31     961
## 202  8.75   16     1       1
## 203 10.00    8     9      81
## 204  3.05   12    10     100
## 205  3.00   12    38    1444
## 206  5.80   12    19     361
## 207  4.10   16     5      25
## 208  8.00   12    26     676
## 209  6.15   12    35    1225
## 210  2.70    9     2       4
## 211  2.75   13     1       1
## 212  3.00   16    19     361
## 213  3.00   14     3       9
## 214  7.36    8    36    1296
## 215  7.50   14    29     841
## 216  3.50   13     1       1
## 217  8.10   12    38    1444
## 218  3.75   18     1       1
## 219  3.25    9    29     841
## 220  5.83    8    36    1296
## 221  3.50    8     4      16
## 222  3.33   12    45    2025
## 223  4.00   14    22     484
## 224  3.50   12    20     400
## 225  6.25   16     5      25
## 226  2.95    8    15     225
## 227  5.71   13    10     100
## 228  3.00    9     3       9
## 229 22.86   16    16     256
## 230  9.00   12    38    1444
## 231  8.33   15    33    1089
## 232  3.00   11     2       4
## 233  5.75   14     6      36
## 234  6.76   12    19     361
## 235 10.00   12    29     841
## 236  3.00   12     2       4
## 237  3.50   18     3       9
## 238  3.25   12     4      16
## 239  4.00   12    10     100
## 240  2.92   12     4      16
## 241  3.06   12    14     196
## 242  3.20   12    15     225
## 243  4.75   12    19     361
## 244  3.00   14    17     289
## 245 18.16   16    29     841
## 246  3.50   12     2       4
## 247  4.11   14     5      25
## 248  1.96   11    38    1444
## 249  4.29   12     3       9
## 250  3.00   10    47    2209
## 251  6.45   12     7      49
## 252  5.20    6    47    2209
## 253  4.50   13    23     529
## 254  3.88   12    12     144
## 255  3.45   10    11     121
## 256 10.91   12    25     625
## 257  4.10   14     6      36
## 258  3.00   13     3       9
## 259  5.90   12    14     196
## 260 18.00   18    13     169
## 261  4.00   12     9      81
## 262  3.00   12     1       1
## 263  3.55   12     6      36
## 264  3.00   12    11     121
## 265  8.75   12    47    2209
## 266  2.90    8    49    2401
## 267  6.26   13    37    1369
## 268  3.50   13     2       4
## 269  4.60   14     7      49
## 270  6.00   12    22     484
## 271  2.89   10     8      64
## 272  5.58   16     1       1
## 273  4.00   12    43    1849
## 274  6.00   16     2       4
## 275  4.50   12     2       4
## 276  2.92   14     1       1
## 277  4.33   18     1       1
## 278 18.89   17    26     676
## 279  4.28   13     1       1
## 280  4.57   14    37    1369
## 281  6.25   15    12     144
## 282  2.95   14    41    1681
## 283  8.75   12    24     576
## 284  8.50    8    38    1444
## 285  3.75   12    18     324
## 286  3.15   12    26     676
## 287  5.00    8    45    2025
## 288  6.46   12    27     729
## 289  2.00    9     2       4
## 290  4.79   12    41    1681
## 291  5.78   16    11     121
## 292  3.18   12     5      25
## 293  4.68   16     3       9
## 294  4.10   12     3       9
## 295  2.91   12     4      16
## 296  6.00   13    21     441
## 297  3.60   10    34    1156
## 298  3.95    6    49    2401
## 299  7.00   12     6      36
## 300  3.00   12    26     676
## 301  6.08   16     9      81
## 302  8.63   12    23     529
## 303  3.00    8    33    1089
## 304  3.75   12     5      25
## 305  2.90    6    49    2401
## 306  3.00    4    48    2304
## 307  6.25   11    35    1225
## 308  3.50   11    23     529
## 309  3.00    7    26     676
## 310  3.24   12    16     256
## 311  8.02   18    23     529
## 312  3.33   12    36    1296
## 313  5.25   16     4      16
## 314  6.25   12    10     100
## 315  3.50   14    18     324
## 316  2.95   12     3       9
## 317  3.00   10     7      49
## 318  4.69   10     7      49
## 319  3.73    9    33    1089
## 320  4.00   10    34    1156
## 321  4.00   12     8      64
## 322  2.90   12    17     289
## 323  3.05   12     2       4
## 324  5.05   10     5      25
## 325 13.95   16    41    1681
## 326 18.16   16    35    1225
## 327  6.25   16    11     121
## 328  5.25   12     4      16
## 329  4.79   12    12     144
## 330  3.35    7    35    1225
## 331  3.00    8    33    1089
## 332  8.43   16     8      64
## 333  5.70   16     2       4
## 334 11.98   18     8      64
## 335  3.50   13    29     841
## 336  4.24   10    14     196
## 337  7.00   16    26     676
## 338  6.00   14    11     121
## 339 12.22   16    10     100
## 340  4.50   12    13     169
## 341  3.00    9    23     529
## 342  2.90   11     1       1
## 343 15.00   11    35    1225
## 344  4.00   12     5      25
## 345  5.25   11    13     169
## 346  4.00   12    22     484
## 347  3.30   12    21     441
## 348  5.05   12    19     361
## 349  3.58   12    13     169
## 350  5.00   14    15     225
## 351  4.57   14     3       9
## 352 12.50   18     6      36
## 353  3.45   12     6      36
## 354  4.63   12    16     256
## 355 10.00   12    31     961
## 356  2.92   11     1       1
## 357  4.51   12     5      25
## 358  6.50   17     3       9
## 359  7.50   16    11     121
## 360  3.54   13     6      36
## 361  4.20   13    11     121
## 362  3.51   12     7      49
## 363  4.50   14     5      25
## 364  3.35   14     5      25
## 365  2.91   11     2       4
## 366  5.25   10    44    1936
## 367  4.05    8    44    1936
## 368  3.75   14    13     169
## 369  3.40   12    26     676
## 370  3.00   10     2       4
## 371  6.29   17    10     100
## 372  2.54    9     2       4
## 373  4.50   12    35    1225
## 374  3.13   12     6      36
## 375  6.36   14     8      64
## 376  4.68   16     1       1
## 377  6.80   12    14     196
## 378  8.53   10    14     196
## 379  4.17    0    22     484
## 380  3.75   14     8      64
## 381 11.10   15     1       1
## 382  3.26   16    15     225
## 383  9.13   12    14     196
## 384  4.50   11    37    1369
## 385  3.00   11     1       1
## 386  8.75   12     4      16
## 387  4.14   13    29     841
## 388  2.87   12    45    2025
## 389  3.35   13    22     484
## 390  6.08   16    42    1764
## 391  3.00   15     9      81
## 392  4.20   16     8      64
## 393  5.60   15    31     961
## 394 10.00   12    24     576
## 395 12.50   18    16     256
## 396  3.76    6     6      36
## 397  3.10    6    14     196
## 398  4.29   12    47    2209
## 399 10.92   12    34    1156
## 400  7.50   16     6      36
## 401  4.05    9     7      49
## 402  4.65   12    27     729
## 403  5.00   11    24     576
## 404  2.90   10    18     324
## 405  8.00   12    12     144
## 406  8.43    8    27     729
## 407  2.92    9    49    2401
## 408  6.25   17     4      16
## 409  6.25   16    24     576
## 410  5.11   11     3       9
## 411  4.00   10     2       4
## 412  4.44    8    29     841
## 413  6.88   13    34    1156
## 414  5.43   14    10     100
## 415  3.00   13     5      25
## 416  2.90   11     2       4
## 417  6.25    7    39    1521
## 418  4.34   16     5      25
## 419  3.25   12    14     196
## 420  7.26   13     8      64
## 421  6.35   14    10     100
## 422  5.63   16     2       4
## 423  8.75   14     9      81
## 424  3.20   11     1       1
## 425  3.00    8    45    2025
## 426  3.00   14    33    1089
## 427 12.50   17    21     441
## 428  2.88   10     2       4
## 429  3.35   12     9      81
## 430  6.50   12    33    1089
## 431 10.38   18    16     256
## 432  4.50   14    10     100
## 433 10.00   18     9      81
## 434  3.81   12     8      64
## 435  8.80   16     9      81
## 436  9.42   14    23     529
## 437  6.33   12    23     529
## 438  4.00    9    22     484
## 439  2.90   12    37    1369
## 440 20.00   12    22     484
## 441 11.25   17    28     784
## 442  3.50   12    14     196
## 443  6.00   15    19     361
## 444 14.38   17    10     100
## 445  6.36   16    25     625
## 446  3.55   12    21     441
## 447  3.00   15    32    1024
## 448  4.50   16    21     441
## 449  6.63   12    36    1296
## 450  9.30   15     2       4
## 451  3.00   12    11     121
## 452  3.25   12    40    1600
## 453  1.50   12    11     121
## 454  5.90   12     9      81
## 455  8.00   16    23     529
## 456  2.90   11     1       1
## 457  3.29   14    30     900
## 458  6.50   14    41    1681
## 459  4.00   13     6      36
## 460  6.00   14    11     121
## 461  4.08   12    43    1849
## 462  3.75   12    39    1521
## 463  3.05    8    50    2500
## 464  3.50   12    26     676
## 465  2.92    3    51    2601
## 466  4.50   11     3       9
## 467  3.35   15     3       9
## 468  5.95   11    15     225
## 469  8.00   12    17     289
## 470  3.00    4    36    1296
## 471  5.00    9    31     961
## 472  5.50   12     9      81
## 473  2.65   12    42    1764
## 474  3.00   11     3       9
## 475  4.50   12    37    1369
## 476 17.50   16    23     529
## 477  8.18   13    21     441
## 478  9.09   15    11     121
## 479 11.82   16    35    1225
## 480  3.25   12    42    1764
## 481  4.50   12     3       9
## 482  4.50   12    13     169
## 483  3.71    9    14     196
## 484  6.50   10    14     196
## 485  2.90   12    39    1521
## 486  5.60   11    11     121
## 487  2.23    8    28     784
## 488  5.00    6    18     324
## 489  8.33   16     6      36
## 490  2.90   12    26     676
## 491  6.25   12    21     441
## 492  4.55   16    34    1156
## 493  3.28   12    17     289
## 494  2.30   10     2       4
## 495  3.30   13     5      25
## 496  3.15   13     1       1
## 497 12.50   14    40    1600
## 498  5.15   16    39    1521
## 499  3.13   10     1       1
## 500  7.25   12    14     196
## 501  2.90   12     2       4
## 502  1.75   11     2       4
## 503  2.89    0    42    1764
## 504  2.90    5    34    1156
## 505 17.71   16    10     100
## 506  6.25   16     4      16
## 507  2.60    9     4      16
## 508  6.63   15    21     441
## 509  3.50   12    31     961
## 510  6.50   12    20     400
## 511  3.00   12    36    1296
## 512  4.38   13     7      49
## 513 10.00   12    15     225
## 514  4.95    7    25     625
## 515  9.00   17     7      49
## 516  1.43   12    17     289
## 517  3.08   12     3       9
## 518  9.33   14    12     144
## 519  7.50   12    18     324
## 520  4.75   13    47    2209
## 521  5.65   12     2       4
## 522 15.00   16    14     196
## 523  2.27   10     2       4
## 524  4.67   15    13     169
## 525 11.56   16     5      25
## 526  3.50   14     5      25

2.5 Gráfica de correlación

plot(base1)

(Desarrollar la interpretación de la Gráfica de correlación)

2.6 Tabla de correlación

mcor<-round(cor(base1),2)
upper<-mcor
upper[upper.tri(mcor)]<-""
upper<-as.data.frame(upper)
upper
##         wage  educ exper expersq
## wage       1                    
## educ    0.41     1              
## exper   0.11  -0.3     1        
## expersq 0.03 -0.33  0.96       1

(Desarrollar la interpretación de la Tabla de correlación

2.7 Regresiones

reg1<- lm ( wage ~ educ + exper + expersq, base)
stargazer( reg1,type = 'text')
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                wage            
## -----------------------------------------------
## educ                         0.595***          
##                               (0.053)          
##                                                
## exper                        0.268***          
##                               (0.037)          
##                                                
## expersq                      -0.005***         
##                               (0.001)          
##                                                
## Constant                     -3.965***         
##                               (0.752)          
##                                                
## -----------------------------------------------
## Observations                    526            
## R2                             0.269           
## Adjusted R2                    0.265           
## Residual Std. Error      3.166 (df = 522)      
## F Statistic           64.109*** (df = 3; 522)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

(Desarrollar la interpretación de los coeficientes)

(Desarrollar la interpretación del R2 )

2.8 Análisis de la forma funcional o especificación del modelo: Prueba LM

resettest(reg1)
## 
##  RESET test
## 
## data:  reg1
## RESET = 18.056, df1 = 2, df2 = 520, p-value = 2.622e-08

(Desarrollar la interpretación de la Prueba LM)

2.9 Multicolinealidad: VIF

vif(reg1)
##      educ     exper   expersq 
##  1.129103 13.133957 13.429089

(Desarrollar la interpretación del VIF)

2.10 Heteroscedasticidad: Prueba de Breusch-Pagan

bptest(reg1)
## 
##  studentized Breusch-Pagan test
## 
## data:  reg1
## BP = 46.353, df = 3, p-value = 4.77e-10

(Desarrollar la interpretación de la Prueba de Breusch-Pagan)

2.11 Autocorrelación: Prueba de Durbin Watson

dwtest(reg1)
## 
##  Durbin-Watson test
## 
## data:  reg1
## DW = 1.8211, p-value = 0.01952
## alternative hypothesis: true autocorrelation is greater than 0

(Desarrollar la interpretación de la Prueba de Durbin Watson)

2.12 Normalidad: Prueba de Shapiro

resid = reg1$residuals
shapiro.test(resid)
## 
##  Shapiro-Wilk normality test
## 
## data:  resid
## W = 0.89304, p-value < 2.2e-16

(Desarrollar la interpretación de la Prueba de Shapiro )

Con base en los resultados, llenar el cuestionario en FORMS.

NOTA ADICIONAL: Utilizando las demás variables de la base, estimar un nuevo modelo Mincer que pueda pasar todas las pruebas