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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: Using random-effects coefficients to predict performance over time


From   Michael Housman <mhousman@evolvondemand.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Using random-effects coefficients to predict performance over time
Date   Thu, 28 Jun 2012 20:21:43 +0000

Hi,

Apologies if this is a novice question but I'm struggling with something and was wondering if the group can help out.

I have data on employee performance over time and I'm trying to depict visually the relationship between employee performance and days of tenure on the job.  My hypothesis is that there are 3 groups of employees and that these three groups vary in terms of: (1) where their performance starts off, (2) how quickly they learn, (3) how quickly their learning flattens out.  In other words, I believe (and the data seems to indicate) that the first derivative of the learning curve is positive and the second derivative is negative.

How I'd planned on approaching this problem was running a random-effects regression (because I have time-invariant explanatory variables) and interacting the group dummy variables with the linear and squared term representing days of service.  For example, here's some of the code that I've set up (simplified slightly):

* Generate the linear and squared terms

gen day_of_service = metric_date - hire_date
gen day_of_service2 = days_of_service ^ 2

* Interact those terms with the group dummy variables
* I know this code can be simplified but I'm just using it here as an example

gen Group1_dos = Group1 * day_of_service
gen Group1_dos2 = Group1 * day_of_service2

gen Group2_dos = Group2 * day_of_service
gen Group2_dos2 = Group2 * day_of_service2

gen Group3_dos = Group3 * day_of_service
gen Group3_dos2 = Group3 * day_of_service2

* Run random-effects regression (Group 3 is my omitted group)

xtreg performance day_of_service day_of_service2 Group1 Group1_dos Group1_dos2 Group2 Group2_dos Group2_dos2 other_covariates, re

So this run a random-effects regression where I model the: (1) intercept, (2) slope, and (3) squared term for these groups (relatively to the one omitted group - Group3) and generate a coefficient representing each.  That part I understand.

What I don't understand is how I can depict this visually.  In other words, I'd like to ask STATA to generate 3 separate curves from these coefficient estimates and then plot the lines on a graph.  Here's how I imagine that equation would like for each of the 3 groups:

Group1: f(t) = day_of_service*t + day_of_service2*t2 + Group1 + Group1_dos*t + Group1_dos*t2
Group2: f(t) = day_of_service*t + day_of_service2*t2 + Group2 + Group2_dos*t + Group2_dos*t2
Group3: f(t) = day_of_service*t + day_of_service2*t2

So the performance on any given day would be indicated by f(x) where x represents the agent's days of tenure on the job.  I understand this much.  Here's what I don't understand:

1) How can I get STATA to save the coefficients in a data matrix that it keeps in memory?
2) How can I get STATA to then generate a dataset where x runs from, say, 0 to 180 days and then calculates f(t) for these three groups?
3) How can I get STATA to depict this visually (most likely as a line graph)?

Truth be told, piece (3) is something I understand but pieces (1) and (2) are the ones I don't get.  Thanks in advance for any help!

Best,
Mike Housman










*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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