# data-cps71: Canadian High School Graduate Earnings In crs: Categorical Regression Splines

## Description

Canadian cross-section wage data consisting of a random sample taken from the 1971 Canadian Census Public Use Tapes for male individuals having common education (grade 13). There are 205 observations in total.

## Usage

 `1` ```data("cps71") ```

## Format

A data frame with 2 columns, and 205 rows.

logwage

the first column, of type `numeric`

age

the second column, of type `integer`

Aman Ullah

## References

Pagan, A. and A. Ullah (1999), Nonparametric Econometrics, Cambridge University Press.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26``` ```## Example - we compare the nonparametric local linear kernel regression ## method with the regression spline for the cps71 data. Note that there ## are no categorical predictors in this dataset so we are merely ## comparing and contrasting the two nonparametric estimates. data(cps71) attach(cps71) require(np) model.crs <- crs(logwage~age,complexity="degree-knots") model.np <- npreg(logwage~age,regtype="ll") plot(age,logwage,cex=0.25,col="grey", sub=paste("crs-CV = ", formatC(model.crs\$cv.score,format="f",digits=3), ", npreg-CV = ", formatC(model.np\$bws\$fval,format="f",digits=3),sep="")) lines(age,fitted(model.crs),lty=1,col=1) lines(age,fitted(model.np),lty=2,col=2) crs.txt <- paste("crs (R-squared = ",formatC(model.crs\$r.squared,format="f",digits=3),")",sep="") np.txt <- paste("ll-npreg (R-squared = ",formatC(model.np\$R2,format="f",digits=3),")",sep="") legend(22.5,15,c(crs.txt,np.txt),lty=c(1,2),col=c(1,2),bty="n") summary(model.crs) summary(model.np) detach("package:np") ```

### Example output

```Registered S3 method overwritten by 'crs':
method         from
predict.gsl.bs np
Categorical Regression Splines (version 0.15-31)
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'.
Nonparametric Kernel Methods for Mixed Datatypes (version 0.60-10)
[vignette("np",package="np") an overview]
[vignette("entropy_np",package="np") an overview of entropy-based methods]
Working...
1/101, d[1]=0, s[1]=1, cv=0.406892
2/101, 0.01/0.00m, d[1]=1, s[1]=1, cv=0.39111
3/101, 0.01/0.00m, d[1]=2, s[1]=1, cv=0.322175
4/101, 0.01/0.00m, d[1]=3, s[1]=1, cv=0.319665
5/101, 0.01/0.00m, d[1]=4, s[1]=1, cv=0.294984
6/101, 0.01/0.00m, d[1]=5, s[1]=1, cv=0.295883
7/101, 0.01/0.00m, d[1]=6, s[1]=1, cv=0.301604
8/101, 0.01/0.00m, d[1]=7, s[1]=1, cv=0.320802
9/101, 0.01/0.00m, d[1]=8, s[1]=1, cv=0.319564
10/101, 0.01/0.00m, d[1]=9, s[1]=1, cv=0.320517
11/101, 0.00/0.00m, d[1]=10, s[1]=1, cv=0.327647
12/101, 0.00/0.00m, d[1]=1, s[1]=2, cv=0.332637
13/101, 0.00/0.00m, d[1]=2, s[1]=2, cv=0.312969
14/101, 0.00/0.00m, d[1]=3, s[1]=2, cv=0.292779
15/101, 0.00/0.00m, d[1]=4, s[1]=2, cv=0.294617
16/101, 0.00/0.00m, d[1]=5, s[1]=2, cv=0.299124
17/101, 0.00/0.00m, d[1]=6, s[1]=2, cv=0.311768
18/101, 0.00/0.00m, d[1]=7, s[1]=2, cv=0.321582
19/101, 0.00/0.00m, d[1]=8, s[1]=2, cv=0.322449
20/101, 0.00/0.00m, d[1]=9, s[1]=2, cv=0.324965
21/101, 0.00/0.00m, d[1]=10, s[1]=2, cv=0.364333
22/101, 0.00/0.00m, d[1]=1, s[1]=3, cv=0.316037
23/101, 0.00/0.00m, d[1]=2, s[1]=3, cv=0.293462
24/101, 0.00/0.00m, d[1]=3, s[1]=3, cv=0.292497
25/101, 0.00/0.00m, d[1]=4, s[1]=3, cv=0.296949
26/101, 0.00/0.00m, d[1]=5, s[1]=3, cv=0.305706
27/101, 0.00/0.00m, d[1]=6, s[1]=3, cv=0.322314
28/101, 0.00/0.00m, d[1]=7, s[1]=3, cv=0.328449
29/101, 0.00/0.00m, d[1]=8, s[1]=3, cv=0.325644
30/101, 0.00/0.00m, d[1]=9, s[1]=3, cv=0.362927
31/101, 0.00/0.00m, d[1]=10, s[1]=3, cv=0.346823
32/101, 0.00/0.00m, d[1]=1, s[1]=4, cv=0.29707
33/101, 0.00/0.00m, d[1]=2, s[1]=4, cv=0.289811
34/101, 0.00/0.00m, d[1]=3, s[1]=4, cv=0.29569
35/101, 0.00/0.00m, d[1]=4, s[1]=4, cv=0.301927
36/101, 0.00/0.00m, d[1]=5, s[1]=4, cv=0.320594
37/101, 0.00/0.00m, d[1]=6, s[1]=4, cv=0.340682
38/101, 0.00/0.00m, d[1]=7, s[1]=4, cv=0.332416
39/101, 0.00/0.00m, d[1]=8, s[1]=4, cv=0.367082
40/101, 0.00/0.00m, d[1]=9, s[1]=4, cv=0.353865
41/101, 0.00/0.00m, d[1]=10, s[1]=4, cv=0.428145
42/101, 0.00/0.00m, d[1]=1, s[1]=5, cv=0.292869
43/101, 0.00/0.00m, d[1]=2, s[1]=5, cv=0.293627
44/101, 0.00/0.00m, d[1]=3, s[1]=5, cv=0.299169
45/101, 0.00/0.00m, d[1]=4, s[1]=5, cv=0.314637
46/101, 0.00/0.00m, d[1]=5, s[1]=5, cv=0.339987
47/101, 0.00/0.00m, d[1]=6, s[1]=5, cv=0.332409
48/101, 0.00/0.00m, d[1]=7, s[1]=5, cv=0.35851
49/101, 0.00/0.00m, d[1]=8, s[1]=5, cv=0.355263
50/101, 0.00/0.00m, d[1]=9, s[1]=5, cv=0.430177
51/101, 0.00/0.00m, d[1]=10, s[1]=5, cv=0.332386
52/101, 0.00/0.00m, d[1]=1, s[1]=6, cv=0.2901
53/101, 0.00/0.00m, d[1]=2, s[1]=6, cv=0.297312
54/101, 0.00/0.00m, d[1]=3, s[1]=6, cv=0.305058
55/101, 0.00/0.00m, d[1]=4, s[1]=6, cv=0.329438
56/101, 0.00/0.00m, d[1]=5, s[1]=6, cv=0.333395
57/101, 0.00/0.00m, d[1]=6, s[1]=6, cv=0.355433
58/101, 0.00/0.00m, d[1]=7, s[1]=6, cv=0.357398
59/101, 0.00/0.00m, d[1]=8, s[1]=6, cv=0.435383
60/101, 0.00/0.00m, d[1]=9, s[1]=6, cv=0.343636
61/101, 0.00/0.00m, d[1]=10, s[1]=6, cv=2.91447
62/101, 0.00/0.00m, d[1]=1, s[1]=7, cv=0.294547
63/101, 0.00/0.00m, d[1]=2, s[1]=7, cv=0.298514
64/101, 0.00/0.00m, d[1]=3, s[1]=7, cv=0.31613
65/101, 0.00/0.00m, d[1]=4, s[1]=7, cv=0.332805
66/101, 0.00/0.00m, d[1]=5, s[1]=7, cv=0.35454
67/101, 0.00/0.00m, d[1]=6, s[1]=7, cv=0.357559
68/101, 0.00/0.00m, d[1]=7, s[1]=7, cv=0.456365
69/101, 0.00/0.00m, d[1]=8, s[1]=7, cv=0.367922
70/101, 0.00/0.00m, d[1]=9, s[1]=7, cv=10.7819
71/101, 0.00/0.00m, d[1]=10, s[1]=7, cv=21.904
72/101, 0.00/0.00m, d[1]=1, s[1]=8, cv=0.297298
73/101, 0.00/0.00m, d[1]=2, s[1]=8, cv=0.303663
74/101, 0.00/0.00m, d[1]=3, s[1]=8, cv=0.321312
75/101, 0.00/0.00m, d[1]=4, s[1]=8, cv=0.337897
76/101, 0.00/0.00m, d[1]=5, s[1]=8, cv=0.344366
77/101, 0.00/0.00m, d[1]=6, s[1]=8, cv=0.399728
78/101, 0.00/0.00m, d[1]=7, s[1]=8, cv=0.445125
79/101, 0.00/0.00m, d[1]=8, s[1]=8, cv=6.78408
80/101, 0.00/0.00m, d[1]=9, s[1]=8, cv=123.77
81/101, 0.00/0.00m, d[1]=10, s[1]=8, cv=1552.27
82/101, 0.00/0.00m, d[1]=1, s[1]=9, cv=0.297094
83/101, 0.00/0.00m, d[1]=2, s[1]=9, cv=0.307864
84/101, 0.00/0.00m, d[1]=3, s[1]=9, cv=0.322057
85/101, 0.00/0.00m, d[1]=4, s[1]=9, cv=0.332904
86/101, 0.00/0.00m, d[1]=5, s[1]=9, cv=0.36399
87/101, 0.00/0.00m, d[1]=6, s[1]=9, cv=0.466078
88/101, 0.00/0.00m, d[1]=7, s[1]=9, cv=1.37943
89/101, 0.00/0.00m, d[1]=8, s[1]=9, cv=118.251
90/101, 0.00/0.00m, d[1]=9, s[1]=9, cv=1102.96
91/101, 0.00/0.00m, d[1]=10, s[1]=9, cv=9057.6
92/101, 0.00/0.00m, d[1]=1, s[1]=10, cv=0.304438
93/101, 0.00/0.00m, d[1]=2, s[1]=10, cv=0.309745
94/101, 0.00/0.00m, d[1]=3, s[1]=10, cv=0.324339
95/101, 0.00/0.00m, d[1]=4, s[1]=10, cv=0.34466
96/101, 0.00/0.00m, d[1]=5, s[1]=10, cv=0.403782
97/101, 0.00/0.00m, d[1]=6, s[1]=10, cv=0.487324
98/101, 0.00/0.00m, d[1]=7, s[1]=10, cv=9.91548
99/101, 0.00/0.00m, d[1]=8, s[1]=10, cv=121.055
100/101, 0.00/0.00m, d[1]=9, s[1]=10, cv=1536.35
101/101, 0.00/0.00m, d[1]=10, s[1]=10, cv=22174.9                                                  Working...          Warning message:
In crs.formula(logwage ~ age, complexity = "degree-knots") :
Dynamically changing search from nomad to exhaustive (if unwanted set cv.threshold to 0)

Multistart 1 of 1 |
Multistart 1 of 1 |
Multistart 1 of 1 |
Multistart 1 of 1 /
Multistart 1 of 1 |
Multistart 1 of 1 |

Call:
crs.formula(formula = logwage ~ age, complexity = "degree-knots")

Indicator Bases/B-spline Bases Regression Spline

There is 1 continuous predictor
Spline degree/number of segments for age: 2/4
Model complexity proxy: degree-knots
Knot type: quantiles
Pruning of final model: FALSE
Training observations: 205
Rank of model frame: 6
Trace of smoother matrix: 6

Residual standard error: 0.5261 on 199 degrees of freedom
Multiple R-squared: 0.3332,   Adjusted R-squared: 0.3165
F-statistic: 19.89 on 5 and 199 DF, p-value: 4.624e-16

Cross-validation score: 0.28981112
Number of multistarts: 5
Estimation time: 0.3 seconds

Regression Data: 205 training points, in 1 variable(s)
age
Bandwidth(s): 3.268425

Kernel Regression Estimator: Local-Linear
Bandwidth Type: Fixed
Residual standard error: 0.5245445
R-squared: 0.3175747

Continuous Kernel Type: Second-Order Gaussian
No. Continuous Explanatory Vars.: 1
```

crs documentation built on Feb. 2, 2021, 5:13 p.m.