Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: R: on counting and fractions in stata


From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   st: R: on counting and fractions in stata
Date   Thu, 27 Oct 2011 14:11:33 +0200

Dear Rado,
I do hope that the following code (in Stata9.2/SE) can help:
-------------------------------------------------------
set obs 10
g y=10*uniform()
g threshold=3
g threshold_exc=1 if y> threshold
replace  threshold_exc=0 if  y<=threshold
sum  threshold_exc
-------------------------------------------------------

Kindest Regards,
Carlo
-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di
[email protected]
Inviato: giovedì 27 ottobre 2011 13.39
A: [email protected]
Oggetto: st: on counting and fractions in stata

Dear all,

I face the following problem in Stata:

I have a series of daily observations on a given variable and I also have
one estimate of this variable that serves as a threshold. 


I would like to estimate how many times this threshold is exceeded by
comparing the value of this estimate with the available data on daily
observations. Is it possible to estimate fractions in Stata in this
particular way? 


Below is a simple example: 


series   estimate: 3.1
1.2
2.1
3.2
1.01

Given this data,I would like to get the following estimates (comments in
brackets):

count:1 (threshold is exceeded only once)
fraction: 1/4=0.25 (one out of 4 cases)



Many thanks in advance.

Rado


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index