The name is absent



Stata Technical Bulletin

21


logit transforms the fitted values and plots the y-axis on a logit scale. The observations are automatically jittered vertically
and plotted just outside the range of the smoothed curve. This option should only be used with binary data.

nograph suppresses production of the graph.
graph-options are any of the options allowed with graph twoway. spline plots yvar followed by its smooth against xvar; the
default options are s(oi) and c(.l). If there are more than 1000 observations, we advise using s(.i) instead. sp_adj
only plots the smooth against
xvar.

Example 1 : spline

In this example spline is used to approximate a sinusoidal signal in the presence of Gaussian noise.
. clear
. set obs 1000
obs was 0, now 1000
. generate x = (-n-500)∕100
. generate sinx = sin(x) + 0.2*invnorm(uniform())
. spline sinx x, xlabel ylabel(-l,-.5,0,.5,1) yline(0)

(graph appears, see Figure 1 )

Example 2: sp adj

In this example, we first generate Poisson data and then use sp_adj to fit the model. The program used to generate Poisson
random variables may be of independent interest. It works using the property that the number of renewals by time 1 in a renewal
process of independent exponential random variables with rate
μ has a Poisson distribution with mean μ.

. clear
. set obs 1000
obs was 0, now 1000
. generate age = 40+15*invnorm(uniform())
. replace age = 30+15*uniform() if (age<15) I (age>75)
(43 real changes made)
. generate sex = uniform()<.4
. generate case = mod(-n,2)

. generate mu = age - 3*(log(age)2) + 10*sin(age∕15) + 50/age + 5*sex if case==0
(500 missing values generated)

. replace mu = age -3*(log(age)2) +10*sin(age∕25) +90∕age -exp((age-65)∕10) + 5*sex if case ==1
(500 real changes made)

. program define mk.pois
1. generate tx = -(l∕mu)*log(uniform())    ∕* tx is an exponential random variable */

2. quietly generate int nx = .
3. local i = 0
4. while 'i' < 50 -(
5. quietly replace nx = 'iz if tx> 1 & nx==.
6. quietly replace tx = tx - log(uniform())∕mu
7. local i = "±' + 1
8. >
9. end

. mk-pois
. summarize nx
Variable
    Obs        Mean   Std. Dev.       Min        Max

---------+-----------------------------------------------------
nx I    1000      10.104   5.975524          0         32

. sp_adj nx age if case==!, kn(20,35,50,65) reg(poisson) adj(sex) gen(spl) nog
. sp_adj nx age if case==0, kn(20,35,50,65) reg(poisson) adj(sex) gen(spθ) nog

The smooths obtained from sp_adj with poisson regression must be transformed back to obtain the estimated mean
function.
. generate snl = exp(spl)
(500 missing values generated)
. generate snθ = exp(spθ)
(500 missing values generated)
. graph snl snθ mu age, sort c(ll.) s(ii.) !!(’'Count”) xlabel ylabel

(graph appears, see Figure 2)



More intriguing information

1. Biological Control of Giant Reed (Arundo donax): Economic Aspects
2. Optimal Rent Extraction in Pre-Industrial England and France – Default Risk and Monitoring Costs
3. The name is absent
4. Gerontocracy in Motion? – European Cross-Country Evidence on the Labor Market Consequences of Population Ageing
5. QUEST II. A Multi-Country Business Cycle and Growth Model
6. The Role of Land Retirement Programs for Management of Water Resources
7. Strengthening civil society from the outside? Donor driven consultation and participation processes in Poverty Reduction Strategies (PRSP): the Bolivian case
8. The name is absent
9. Yield curve analysis
10. EXECUTIVE SUMMARY
11. Database Search Strategies for Proteomic Data Sets Generated by Electron Capture Dissociation Mass Spectrometry
12. THE AUTONOMOUS SYSTEMS LABORATORY
13. THE USE OF EXTRANEOUS INFORMATION IN THE DEVELOPMENT OF A POLICY SIMULATION MODEL
14. Altruism and fairness in a public pension system
15. The name is absent
16. Multifunctionality of Agriculture: An Inquiry Into the Complementarity Between Landscape Preservation and Food Security
17. The name is absent
18. The name is absent
19. Proceedings of the Fourth International Workshop on Epigenetic Robotics
20. The name is absent