[Stata Program] use http://www.gseis.ucla.edu/courses/data/curve generate x2 = x^2 generate x3 = x^3 summarize regress y x predict p1 predict r1, residual plot y x plot r1 x plot r1 p1 regress y x x2 x3 predict p2 predict r2, residual plot r2 x plot r2 p2 regress y x x2 predict p3 predict r3, residual plot r3 x plot r3 p3 [Stata Output] generate x2 = x^2 generate x3 = x^3 summarize Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- y | 43 17.69767 5.841293 3 24 x | 43 14.69767 8.302423 2 28 x2 | 43 283.3488 252.4485 4 784 x3 | 43 6153.674 6964.894 8 21952 regress y x Source | SS df MS Number of obs = 43 ---------+------------------------------ F( 1, 41) = 28.11 Model | 582.915921 1 582.915921 Prob > F = 0.0000 Residual | 850.153846 41 20.7354597 R-squared = 0.4068 ---------+------------------------------ Adj R-squared = 0.3923 Total | 1433.06977 42 34.1207087 Root MSE = 4.5536 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x | .4487179 .0846306 5.302 0.000 .277803 .6196329 _cons | 11.10256 1.424584 7.794 0.000 8.225559 13.97957 ------------------------------------------------------------------------------ predict p1 (option xb assumed; fitted values) predict r1, residual plot y x 24 + | * * * | * * * * * | * * * * * * | * * * * | * * * * | * * * | * * | * * * | * * y | * * | * | | | * | | | * | * | * 3 + * +----------------------------------------------------------------+ 2 x 28 plot r1 x 6.30769 + | * | * | * * | * * * * | * * * * R | * * * * * * * * e | * * s | * * * i | * * d | * * u | a | * l | * s | * | * | * | * * | * * | * * -9 + * * +----------------------------------------------------------------+ 2 x 28 plot r1 p1 6.30769 + | * | * | * * | * * * * | * * * * R | * * * * * * * * e | * * s | * * * i | * * d | * * u | a | * l | * s | * | * | * | * * | * * | * * -9 + * * +----------------------------------------------------------------+ 12 Fitted values 23.6667 regress y x x2 x3 Source | SS df MS Number of obs = 43 ---------+------------------------------ F( 3, 39) = 245.95 Model | 1361.12452 3 453.708175 Prob > F = 0.0000 Residual | 71.9452429 39 1.84474982 R-squared = 0.9498 ---------+------------------------------ Adj R-squared = 0.9459 Total | 1433.06977 42 34.1207087 Root MSE = 1.3582 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x | 2.829993 .2960827 9.558 0.000 2.23111 3.428877 x2 | -.0928338 .0229421 -4.046 0.000 -.1392386 -.046429 x3 | .0004671 .0005088 0.918 0.364 -.000562 .0014962 _cons | -.4667211 1.023599 -0.456 0.651 -2.537145 1.603703 ------------------------------------------------------------------------------ predict p2 (option xb assumed; fitted values) predict r2, residual plot r2 x 4.52898 + | * | | | | R | e | s | * i | * d | * * u | * * * a | * * * * * * * l | * * * * s | * * * * | * * * * * * | * * * | * * * * | * | * * * -2.39781 + * * +----------------------------------------------------------------+ 2 x 28 plot r2 p2 4.52898 + | * | | | | R | e | s | * i | * d | * * u | * * * a | * * ** * * * l | * * * * s | * * ** | * ** * * * | * * * | * * ** | * | * * * -2.39781 + * * +----------------------------------------------------------------+ 4.82567 Fitted values 23.1192 regress y x x2 Source | SS df MS Number of obs = 43 ---------+------------------------------ F( 2, 40) = 369.95 Model | 1359.56964 2 679.784819 Prob > F = 0.0000 Residual | 73.5001293 40 1.83750323 R-squared = 0.9487 ---------+------------------------------ Adj R-squared = 0.9461 Total | 1433.06977 42 34.1207087 Root MSE = 1.3555 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x | 2.576439 .1065162 24.188 0.000 2.361162 2.791717 x2 | -.0720191 .0035031 -20.559 0.000 -.079099 -.0649391 _cons | .2365281 .6776342 0.349 0.729 -1.133022 1.606078 ------------------------------------------------------------------------------ predict p3 (option xb assumed; fitted values) predict r3, residual plot r3 x 4.76118 + | * | | | | R | e | s | i | * * d | * u | * * * a | * * * * * * l | * * * s | * * * * * * * * | * * * | * * * * | * * * * | * * | * -2.38998 + * * * * +----------------------------------------------------------------+ 2 x 28 plot r3 p3 4.76118 + | * | | | | R | e | s | i | * * d | * u | * * * a | * * * ** * l | * * * s | * * * * * * ** | * * * | ** ** | * * ** | * * | * -2.38998 + * * * * +----------------------------------------------------------------+ 5.10133 Fitted values 23.2783