Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: mkspline question

From   Vivien Lee <>
Subject   st: mkspline question
Date   Wed, 6 Mar 2013 15:16:33 -0700


I have a few questions regarding splines and creation of linear regression
with a spline at a specified knot.  Some background:

I am plotting injury count (var: cinj) over a number of years (var:year)
(1999-2010).  Associated with cinj and year is a mine id number (var:
mineid).  Currently, my dataset lists the number of injuries per year per
mine id number.  I am interested in comparing "company C" (var: compc == 1)
owned mines against all other mining companies (var: compc == 0).  I'd like
for both series to show up on the same graph (company C owned mines vs. all
other mines, averaged injury count each year).  I'd also like to show the
95% confidence interval (bar and spike) of the average number of injuries
per year.  The spline should occur in year 2004 as a new risk management
system was introduced at the time.  I want to show that there is a
difference in slope of average injury count per year before 2004 and after
2004 for company C owned mines versus mines not owned by company C
(basically to show whether the new risk management system worked or not).

I had tried to perform an lfit plot of my data but the slopes were not
meeting in 2004.  It was suggested that I look at using a spline command to
depict the data instead.  I'm unsure as to how to set up the command for
this.  Thanks you very much for your time and help.

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index