clear cd "C:\Documents and Settings\Betsy\Desktop\SF0\Pulse" capture log close set more off log using Pulse_log, t replace insheet using Pulse.txt, tab drop if time=="" drop description *Translate time gen double time2 = clock(time, "hm") *Create indicator variables for different levels of activity gen act_rest = 0 gen act_sit = 0 gen act_walk = 0 gen act_exert = 0 replace act_rest = 1 if activity_level == "Rest" replace act_sit = 1 if activity_level == "Sitting" replace act_walk = 1 if activity_level == "Walking around" replace act_exert = 1 if activity_level == "Heavy exertion" *Create variable for minutes since last heavy exertion gen double time_exert = clock("12:00 AM", "hm") replace time_exert = time2 if act_exert == 1 replace time_exert = time_exert[_n-1] if act_exert == 0 & _n !=1 gen time_since_exert = (time2 - time_exert)/100000 *Create variable for minutes since last food gen double time_food = clock("12:00 AM", "hm") replace time_food = time2 if food == 1 replace time_food = time_food[_n-1] if food == 0 & _n !=1 gen time_since_food = (time2 - time_food)/100000 *****Investigate data***** summarize twoway (scatter pulse_15sec time2, sort) (lfit pulse_15sec time2) *****Run regressions***** *label variable pulse_15sec "Just Public" reg pulse_15sec public outreg2 using pulse_regs, replace br adjr2 *label variable pulse_15sec "Baseline" reg pulse_15sec public act_* outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Music Baseline" reg pulse_15sec public act_* music outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Music Baseline with Singing" reg pulse_15sec public act_* music singing outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Music Baseline with Singing & Fast" reg pulse_15sec public act_* music singing fastmusic outreg2 using pulse_regs, br adjr2 *Interaction variable gen singfast = singing*fastmusic *label variable pulse_15sec "Music Baseline, Singing Fast" reg pulse_15sec public act_* music singing fastmusic singfast outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline, Singing" reg pulse_15sec public act_* singing outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline, Singing & Fast" reg pulse_15sec public act_* singing fastmusic outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline, Singing Fast" reg pulse_15sec public act_* singing fastmusic singfast outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline Late" reg pulse_15sec public act_* late outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline Late, Time Since Heavy Exertion" reg pulse_15sec public act_* late time_since_exert outreg2 using pulse_regs, br adjr2 *Logarithmic specifications gen ln_time_exert = ln(time_since_exert+.00001) gen ln_time_food = ln(time_since_food+.00001) *label variable pulse_15sec "Baseline, Time Since Heavy Exertion" reg pulse_15sec public act_* time_since_exert outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline, Log Time Since Heavy Exertion" reg pulse_15sec public act_* ln_time_exert outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline, Log Time Since Heavy Exertion and Since Food" reg pulse_15sec public act_* ln_time_exert ln_time_food outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline, Singing, Time Since Heavy Exertion" reg pulse_15sec public act_* singing time_since_exert outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline, Singing, Log Time Since Heavy Exertion" reg pulse_15sec public act_* singing ln_time_exert outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline Without Public, Log Time Since Heavy Exertion" reg pulse_15sec act_* ln_time_exert outreg2 using pulse_regs, br adjr2 *label variable pulse_15sec "Baseline Without Public, Log Time Since Heavy Exertion, Singing" reg pulse_15sec act_* ln_time_exert singing outreg2 using pulse_regs, br adjr2 log close