not sure about your data format, suppose the data have the following variables
y x year
* new var hold results
* residual
gen double res = .
* studentizzed res
gen double sres = .
* take the year value
levelsof year, local(y)
* loop over year
foreach i in `y' {
reg y x if year == `i'
predict double __x, r
predict double __y, rstu
replace res = __x if year==`i'
replace sres = __y if year==`i'
drop __x __y
}


雷达卡



京公网安备 11010802022788号







