Quantcast
Channel: Statalist
Viewing all 73200 articles
Browse latest View live

Using outreg2 to Generate a Table with Dependent Variables at the Head of Each Row

$
0
0
Hi all,

I've recently started using outreg2 to generate publishable tables with my regression output. By default, each row of these tables specifies a different independent variable but what I would like to do is generate a table such that each row is devoted to a specific dependent variable instead. In this case, separate columns would be devoted to coefficients of interest and the independent variables which they correspond to. Is there a way to do this with outreg2 or is their a better Stata command for generating such a table?

Here is a basic example of what I'd like to generate:
Dependent Variables Ind. Variable of Interest 1 Ind. Variable of Interest 2
Dep. Var 1 0.567 0.001
Dep. Var 2 1.35 0.345
Dep. Var 3 2.5 5.45
I understand that standard errors will probably be reported below each coefficient estimate.

Thanks for any help you may provide,

Thomas

Infer individual behavior with aggregate & individual data? Package to implement Imbens and Lancaster (1994)?

$
0
0
I'm starting a project to investigate individual investment behavior. For example, let's say my research question is how different income levels would affect individual investor's stock selling decision, currently I have individual level data such as
1) investment log, such as when and how much each single investor made adjustments on his/her portfolio
2) individual characteristics: age and gender

But, I don't have individual level data on income level, all I have is aggregate level data, that is, average income at county-level.

I heard it's problematic to infer individual level behavior by just combining individual level and aggregate level data. However, I don't know how to circumvent this situation, or, can my research question be answered given the data I currently have? It seems to me
Imbens and Lancaster (1994) provides a solution to this issue, I was wondering is there a Stata package that can implement what they suggested in their paper?

Please help, thanks!

Run a Bayesian Regression

$
0
0
Hi everyone,

my goal is to run a bayesian regression on my dataset, but I do not know so good how to do that.
I have a strongly balanced panel data with monthly observations("ID" for each firm, and "mdate" for each monthly observation); the main variables are Size, BtM, FinLev, OpeLev, Momentum, DiffSprd, ret, vwretd and 48 dummies, for a total of 65880 observations and 305 firms.

This is an example with just one raw


ID mdate ret vwretd DiffSprd Size BtM FinLev Momentum OpeLev Ind_sec1 Ind_sec2 Ind_sec3 ....

1 1995m8 .03409791 .00930454 .63 .2386314 -.894672 -.9067308 -.2896548 .6094074 0 0 0


The bayesian regression I have to run on these data is the following

Rit = α*i + β*it|t−1RMt + ηit,

where Rit is the variable "ret", and RMt is the variable "vwretd"

β*it|t−1 is parameterized as

β*it|t−1 = δ0i + δ1iXt−1 + δ'2Zit−1 + δ'3Zit−1 Xt−1

where Zit−1 is a vector with lagged firm characteristics (Size, BtM, FinLev, OpeLev, Momentum and 48 dummies), and Xt−1 is the variables "DiffSprd".

Said that, the final regression I need to run is

Rit = α*i + (δ0i + δ1iXt−1 + δ'2Zit−1 + δ'3Zit−1Xt−1)RM t + ηit (where δ'2 and δ'3 are pooled parameters on the firm-level variables)

I assume that the prior distribution of βit is normal

βit ∼ N (β¯ it, σ2 βit)


I saw "bayesmh" function, but I do not know if it works and how to use it.

Please, is there someone that can help me out writing this code?

Thanks in advance to all of you.















Import format for date/time variables

$
0
0
I have a large dataset delimited by | that includes date time stamps for several variables that are bar coded data. There are nurses administering medications in a hospital, e.g. time/date var1 is time med due, var2 when med pulled from dispensing cart, var3 time med was actually administered. Ultimately we will calculate time differences between these variables. We are working to import these data, approximately 1.5 million records into Stata. Our first test import would not recognize the date/times below and imported them as text in the same format as below. What is the appropriate format in the source data for the source time/date variables that will allow Stata to directly import these as date/time not text data? I would like to avoid coding each of the variables to change them to date/time.

Code:
849|2014-11-07 16:13:00.000|2014-11-07 16:12:00.000|2014-11-07 16:13:00.000
852|2014-11-07 16:13:00.000|2014-11-07 16:12:00.000|2014-11-07 16:13:00.000
1379|2014-11-07 16:13:00.000|2014-11-07 16:12:00.000|2014-11-07 16:13:00.000
848|2014-11-07 16:13:00.000|2014-11-07 16:12:00.000|2014-11-07 16:13:00.000
Thanks, John
University of Colorado College of Nursing

Outlier Identification for GLM (poisson)

$
0
0
Hi all,

I am using Stata/SE13.1 (Windows).

I want to do some regression diagnostics after running a GLM (poisson family).
Unfortunately, there seem to be less postestimation commands for glm than for reg.

In particular, I am concered that outliers are driving my results.

So I have already investigated Cook's distance and I have looked at the residuals.
However, I am not sure what to do, so I wondered if there is...

1) a chance to run dfbeta after gml?
2) a command for gml like rreg for reg?

I know that dealing with outliers is difficulty.
Are there is general more possibilities than just reporting results with and without outliers and running robust regressions?


Best
Christoph

No Observations r(2000) Error

$
0
0
Hi there,

I have consulted the various forum posts about error r(2000) but none of the fixes have worked.

I have:

- replaced all missing values with a dot
- ensured that all variables are numeric

I am trying to run xtreg and it is at this final step that the error r(2000) comes up.

Could anyone please help? Thanks!

Precision of Stata calculations

$
0
0
Dear Stata users,

I am running the following codeto estimate variable TVmean:

gen double TVmean=( BuyTradingValue8000+ SellTradingValue8000)/( BuyTradingValue1000+ SellTradingValue1000+ BuyTradingValue8000+ SellTradingValue8000+ BuyTradingValue9000+ SellTradingValue9000)


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float date str26 IssueName double(BuyTradingValue1000 SellTradingValue1000 BuyTradingValue8000 SellTradingValue8000 BuyTradingValue9000 SellTradingValue9000 TVmean)
17940 "A&P" 0 8803400 139202650 130399250 0 0 .9683791939305754
end
format %tdNN/DD/CCYY date
When I replicate the same in Excel I get different number(0.968436154949785).

What is the reason for that?

Thanks a lot in advance.

Wild cluster bootstrap and GLM

$
0
0
Hello,

I am trying to determine the most appropriate method for improving statistical inference in GLM (generalized linear models) applications with very few clusters (in one study G=29 and in another G=4 - I am aware of Webb's 2014 advice on 6-point weights for studies with fewer than 11 clusters). The clusters are unbalanced and I've got heteroskedasticity.
Please take as given that I need to use GLM rather than OLS for these studies.
Is it appropriate to use the wild cluster bootstrap procedure with GLMs? Recent explanations of the wild method indicate that the first step is to be completed using OLS, and Stata packages (e.g., CLUSTSE and CGMWILDBOOT) note restrictions to -regress- commands. It seems to me, however, that I should be ok using Wild cluster bootstrap with GLM because the error component of the GLM is additively separable.
Any thoughts or advice on where to look for further instruction on combining GLM and wild cluster bootstrap will be greatly appreciated!
Many thanks, Kristen


Hierarchical data - setting the minimum number of observations by group

$
0
0
Hi, I'm working on a hierarchical data set on education where classes are nested into schools. Consider the name of the variable on i) classes: id_cl ; and ii) schools: id_sc

What I'm NOT managing to do is: to delete ALL schools with less than 3 classes.

I'm trying commands such as:
bysort id_cl (id_sc): gen sc_cl_nr = _n //school-class ID (within school)

bysort id_cl (id_sc): gen sc_cl_count = _N //# of school-class (within school)


But they just don't work... Any help/tips very much appreciated! Thanks!






Identifying conditional quantiles after running quantile regressions

$
0
0
Hi,

I would like to identify the conditional quantiles that individual observations belong to after I have run quantile regressions.

I have estimated the impact of treatment on various outcomes and have used quantile regressions to understand if these impacts change across the distribution of each outcome variable.

I have noticed very similar patterns especially in the top quantiles for two outcomes. I would now like to examine the similarity between the individuals in the top (conditional) quantiles of these two outcomes.

How would one go about identifying the conditional quantiles that individual observations belong (for each outcome)?

Thanks
Vilas
PhD Candidate
Monash University

Replacing hypens in STATA

$
0
0
HI,

I have many variables that have a hyphen "-".

I would like to replace this to . so STATA can read it as a missing value.

Is there any way I can do this without specifiying every variable seperately? Since I want to do this to my whole dataset.

THANKS!

Robust Standard Errors vs. Time Dummy Variable

$
0
0
Hello all,

I'm currently working on a fixed effects model and have found that there is heterogeneity across years. First, I was wondering that by grouping my "ID" variable into clusters and including robust standard errors, I account for this heterogeneity? Second, I was wondering how the aforementioned method is different from including a time dummy variable--i.Year--in my model in order to account for heterogeneity across time? Thanks in advance for your help.

Duke

Autoregression + moving average model

$
0
0
Hello,

I'm relatively new to Stata and I was wondering how to enter the command to estimate the following model for a variable (AR(2),MA(1,7)). I tried several ways to enter it with the arima command but I couldn't get it right.

Thanks ahead,

Ron

Creating regression output tables for MS Word

$
0
0
Hello there,

I have a question concerning how to create a specific regression output table for Word.



My data set contains time series of different financial market data: market return (y), tail risk (x1), book to market ratio (x2), default return spread (x3), term spread (x4), etc.
With these data, I'm running a series of predicitve regressions.

First, I'm running a regression of the form market return ~ tail risk, where market return is the dependent variable and tail risk the independent variable. (y ~ x1)
Second, I'm running a regression of the form market return ~ book to market ratio. (y ~ x2)
Third, y ~ x3
Etc.

So, I am not running one single regression containing all variables, but running different regressions with only one independent variable. The dependent variable is always market return.

For my regression, I use the -ivreg2- command:

foreach x of varlist tail risk book_to_market default_return_spread default_yield_spread dividend_payout_ratio ... (etc) {
ivreg2 CDAXreturn_1y `x', bw(12) kernel(tru) small
}

...with CDAXreturn_1y = the one year return on the CDAX (=dependent variable, market return).




In Word, I want to show a table containing the following data:

First column: names of the independent variables.
Second column: coefficients.
Third column: t statistics.
Fourth column: R squared.

As you see, the table should contain the different statistics (coefficient, t statistics, r squared) of every single independent variable one below the other.

Can anybody help me with that?

Using the output of AR(3) autoregressive model on a holdout sample

$
0
0
I am trying to use the output of an autoregressive model of order 3 (AR(3)), which was done on an analysis sample, to forecast on a holdout sample (i.e. I am using the split sample technique by dividing the data into two samples). I would like to know if there is a way I forecast this using STATA given that I am using the output of the AR(3) from the analysis sample to forecast the holdout sample.

do file execute error message r(170)

$
0
0
Dear StataList,
I have problem with execute do file i got error message and I get a pop up saying
Access to c:\Users\Admin\Appdata\Local\Temp\STD00000000.tmp was denied
I've been looking online for help, but i can't find it
Please help me.

Thanks very much
Sugi


Help with imputing covariates in survival model

$
0
0
I have data on survival time for breast cancer patients. Some of the covariates are missing. I would like to use multiple imputation. I have read a paper by White and Royston (Imputing missing covariates for the Cox model, Statistics in Medicine, 28 1982-1998) which discusses this issue at some length. They suggest first getting an estimate of the Nelson-Aalen cumulative hazard, which is done with sts gen haz = na and go on to say: "then the MICE algorithm is implemented by ice HT _d X* with appropriate options". I am not sure how to do this using mi impute chained. I have never used the ICE predecessor to mi impute and would appreciate some guidance as to how to proceed.

need to data.

$
0
0
hi
i need a file of data for discriminant linear analysis practice.if u have that please send for me.

Recursive 1-step ahead forecasting in a VAR model

$
0
0
Hi,

I am currently working to generate a 1-step ahead forecast from recursively estimating a Vector Autoregression Model, similar to a real-time forecast. At present, I am building this using the 'forvalues' command, and storing my results. My questions are as follows:

1. In 'forecast compute', is there any way for me to suppress the initial datapoint in the 1-step ahead forecast? By this, I mean that the command generates forecasts that replicate data from the current time period, which I would like to exclude.
2. Having done so, how should I go about, in the loop, saving the results to a time series containing all the 1-step ahead forecasts? I've tried the replace command, but that would delete the previous 1-step ahead forecasts.

My code at the moment is rather simple, and is as follows:

forvalues p = 150(1)225 {
var x in 1/`p', lags(1/14)
fcast compute fin8_, nose replace
}


Thanks!

Compute number of days between two dates

$
0
0
Dear Statalisters,

here is the first few observations of my data:

Code:
clear
input long(datadate gvkey rdq)
19761231 1000 19770301 
19771231 1000 19780320 
19780331 1000 19780519 
19831231 1001 19840301 
end

I want to compute the difference in days between datadate and rdq.

I do not think it is correct to do

Code:
gen day_pass=datadate-rdq

then, what is the right way?


Best,
Rochelle
Viewing all 73200 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>