[Limdep Nlogit List] Weighted mean and standard deviation
Steven Yen
syen at utk.edu
Thu May 21 08:31:50 EST 2009
Dear fellow Limdepers
Is there a way to calculate and save the weighted sample means and
standard deviation with the "calc" command, the way "xbr" and "sdv"
do for the unweighted mean and standard deviation? Or, is there a
way to do this with the matrix command?
In other words, can somebody help me finish the fourth line of code
below? I need the weighted mean/sd in further calculation. Thank you.
dstat ;rhs=m12 $
calc ;list ;xb=xbr(m12) ;sd=sdv(m12) $
dstat ;rhs=m12 ;wts=mweight $
?calc ;list ;xbw=??? ;sdw=??? $
Output from the first three lines follow:
--> dstat ;rhs=m12 $
Descriptive Statistics
All results based on nonmissing observations.
===============================================================================
Variable Mean Std.Dev. Minimum Maximum Cases Missing
===============================================================================
------------------------------------------------------------------------------
All observations in current sample
------------------------------------------------------------------------------
M12 | .304133E-01 .825750 -.967448 42.1079 3611 0
--> calc ;list ;xb=xbr(m12) ;sd=sdv(m12) $
+------------------------------------+
| Listed Calculator Results |
+------------------------------------+
XB = .030413
SD = .825750
Calculator: Computed 2 scalar results
--> dstat ;rhs=m12 ;wts=mweight $
Descriptive Statistics
All results based on nonmissing observations.
===============================================================================
Variable Mean Std.Dev. Minimum Maximum Cases Missing
===============================================================================
------------------------------------------------------------------------------
All observations in current sample
------------------------------------------------------------------------------
M12 | .242638E-01 .747578 -.967448 42.1079 3611 0
Steven T. Yen
http://web.utk.edu/~syen/
Check out our postdoc opening at:
http://web.utk.edu/~syen/postdoc.html
More information about the Limdep
mailing list