The name is absent



24


Stata Technical Bulletin


STB-57


Figure 2. Reference splines at 4 with unit reference points.

Example

In Stata’s auto data, we can use frencurv and regress (with the noconstant option) to fit a cubic spline for miles per
gallon with respect to weight:

. frencurv,xvar(weight) refpts(1760(770)4840) gen(cs) power(3)

. describe cs*

13. csl

float

7.8.4f

Spline at 990 (INCOMPLETE)

14. cs2

float

7.8.4f

Spline at 1,760

15. cs3

float

7.8.4f

Spline at 2,530

16. cs4

float

7.8.4f

Spline at 3,300

17. cs5

float

7.8.4f

Spline at 4,070

18. cs6

float

7.8.4f

Spline at 4,840

19. cs7        float 7.8.4f

. regress mpg cs*,noconst robust

Spline at 5,610 (INCOMPLETE)

Regression with

robust

standard errors

Number of obs = 74
F( 7, 67) = 618.91
Prob > F = 0.0000
R-Squared = 0.9792
Root MSE = 3.3469

I

≡pg I

Coef.

Robust

Std. Err.

t

p>t

[957. Conf.

Interval]

csl I

11.82559

15.56642

0.760

0.450

-19.24512

42.89629

cs2 I

29.21133

1.761704

16.581

0.000

25.69495

32.72771

cs3 I

22.65796

.7625134

29.715

0.000

21.13597

24.17994

cs4 I

19.4749

.610094

31.921

0.000

18.25715

20.69266

cs5 I

15.51593

.8409023

18.452

0.000

13.83748

17.19437

cs6 I

10.60747

1.585487

6.690

0.000

7.442828

13.77212

cs7 I

-28.19347

21.59599

-1.305

0.196

-71.29924

14.91229

We have arbitrarily chosen the reference points to be equally spaced from the minimum of weight (1,760 pounds) to
the maximum of weight (4,840 pounds). By default, frencurv ensures that the spline is complete in the range of X-values
spanned by the original reference points provided by the user. The describe command lists the reference splines with their
labels. Note that frencurv has added two extra reference points outside the spline’s completeness region (at weights of 990 and
5,610 pounds) and indicated this incompleteness in the variable labels. The coefficients fitted by regress (with the noconstant
option) are simply the fitted values of mpg at the reference points. Note that the ones corresponding to the splines cs2 to
cs6 have “sensible” values, corresponding to the expected levels of mpg at the appropriate value of weight, whereas the ones
corresponding to csl and cs7 have “nonsense” values because they correspond to reference “weights” extrapolated off the edge
of the range of sensible weight values. This is the price we pay for making all reference points equal to knots of the cubic
spline. Figure 3 shows observed and fitted values of mpg plotted against weight. The fitted curve is calculated using predict
(see [R]
predict) and is interpolated cubically between the reference points.

Figure 3. Mileage plotted against weight (points) with fitted cubic spline (line).


The f rencurv parameterization allows us to use Iincom to calculate confidence intervals for differences (or other contrasts)



More intriguing information

1. Word searches: on the use of verbal and non-verbal resources during classroom talk
2. The problem of anglophone squint
3. Feature type effects in semantic memory: An event related potentials study
4. The name is absent
5. Strengthening civil society from the outside? Donor driven consultation and participation processes in Poverty Reduction Strategies (PRSP): the Bolivian case
6. Why unwinding preferences is not the same as liberalisation: the case of sugar
7. Insecure Property Rights and Growth: The Roles of Appropriation Costs, Wealth Effects, and Heterogeneity
8. Institutions, Social Norms, and Bargaining Power: An Analysis of Individual Leisure Time in Couple Households
9. Putting Globalization and Concentration in the Agri-food Sector into Context
10. The name is absent
11. The name is absent
12. Education as a Moral Concept
13. The name is absent
14. Outline of a new approach to the nature of mind
15. Pass-through of external shocks along the pricing chain: A panel estimation approach for the euro area
16. The name is absent
17. Neighborhood Effects, Public Housing and Unemployment in France
18. The name is absent
19. The geography of collaborative knowledge production: entropy techniques and results for the European Union
20. Multimedia as a Cognitive Tool