program psn, rclass  byable(recall)

args cp xi w alpha

local h (`cp'-`xi')/`w'

local aa = abs(`alpha')
local ah = abs(`h')

if (`aa'<=1){
	Tint `ah' `aa' 50 8
	local owen = r(m)
}
else{
	local el1= (`aa'*`ah')
	local el2= 1/`aa'
	Tint `el1' `el2' 50 8
	local owen= (0.5*normal(`ah')+normal(`aa'*`ah')*(0.5-normal(`ah'))-r(m))
}
local owent=sign(`alpha')*`owen'

local val = normal(`h')-2*`owent'

return scalar owen_value=`owent'
return scalar psn =`val'

end