Dear Statalist,

I'm examining the relationship between the number of common stocks in a portfolio (n) and standard deviation of the returns (std_dev).

I'm using a non-parametric regression since the relationship is non-linear and I would like to plot the standard deviation against portfolio size with confidence intervals.

My exact code is:

Code:
npregress kernel std_dev n if c5==1 & year==2015, vce(bootstrap, reps(100) seed(100))
margins, at(n=(1(1)30)) vce(bootstrap) saving (margins_us_2015, replace)
marginsplot
Stata obtains the margins and standard errors as follows:


------------------------------------------------------------------------------
| Observed Bootstrap Percentile
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_at |
1 | .0134765 .0003987 33.80 0.000 .0127186 .0143896
2 | .0126912 .0002999 42.32 0.000 .012129 .0133716
3 | .0120618 .0002233 54.02 0.000 .0116877 .0125552
4 | .0114989 .000163 70.56 0.000 .0112455 .0118804
5 | .0111131 .0001311 84.80 0.000 .0108905 .0114036
6 | .0108291 .0001148 94.30 0.000 .0106232 .0110769
7 | .0105692 .0001022 103.47 0.000 .0103448 .0107606
8 | .0103451 .0000897 115.39 0.000 .0101602 .0104865
9 | .0102435 .0000694 147.54 0.000 .0101208 .0103534
10 | .0101498 .0000628 161.58 0.000 .0100396 .0102488
11 | .0100671 .0000601 167.55 0.000 .0099623 .0101607
12 | .0100112 .00006 166.93 0.000 .0098873 .0101129
13 | .009973 .0000636 156.74 0.000 .0098267 .0100791
14 | .0099319 .000072 137.86 0.000 .0097779 .0100636
15 | .0098895 .0000848 116.62 0.000 .0097199 .0100206
16 | .0098543 .0001104 89.26 0.000 .0096211 .0100658
17 | .0098378 .0001434 68.62 0.000 .0095309 .0100934
18 | .0098128 .0001796 54.64 0.000 .0094408 .0101209
19 | .0097849 .0002175 44.99 0.000 .0093506 .0101485
20 | .0097566 . . . 0 0
21 | .0097322 . . . 0 0
22 | .0097077 . . . 0 0
23 | .0096833 . . . 0 0
24 | .0096589 . . . 0 0
25 | .0096561 . . . 0 0
26 | .0096533 . . . 0 0
27 | .0096505 . . . 0 0
28 | .0096477 . . . 0 0
29 | .0096449 . . . 0 0
30 | .0096421 . . . 0 0
------------------------------------------------------------------------------

At values n>19, Stata does not compute standard errors, and returns no error messages. What could be causing this and how can I resolve the problem?