Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Adding -nocons- to -mlbeta-


From   [email protected]
To   [email protected]
Subject   Re: st: Adding -nocons- to -mlbeta-
Date   Tue, 24 May 2005 16:25:56 -0500

I am not sure it will help, but here the ado file I used:

program define mlbeta, rclass

	version 8
	syntax varlist [if][in] [,DIspersion(varlist)] [,Robust] 
[,svy] [,Nocons]
	tokenize `varlist'
	marksample touse
	if "`svy'"!=""{
		svymarkout `touse'
	}
	local lhs "`1'"
	mac shift
	local rhs "`*'"
	ml model lf mlbeta_ll (`lhs'=`rhs', `nocons') (`dispersion') 
`if' `in', `robust' `svy'
	ml search
	ml maximize
	tempvar error 
	quietly { 
		predict `error' if e(sample) 
		replace `error' = exp(`error')/(1+exp(`error'))
		replace `error' = (`lhs' - `error')^2
		su `error', meanonly 
	} 
	display in green _n "Mean squared error:" in yellow `r(mean)' 
end



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index