Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: mkspline question
From 
 
Vivien Lee <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: mkspline question 
Date 
 
Wed, 6 Mar 2013 15:16:33 -0700 
Hello,
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.
Regards,
Vivien
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/