stata

Matlab Replication of OLS regression with clustered standard errors Stata-command [closed]

耗尽温柔 提交于 2020-04-07 08:46:16
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 7 days ago . A newbie question: I want to replicate the following Stata code in Matlab: reg logbid1 logmiles photos photos2 options logfdback negpct cont*, cluster(sellername_id) estimates store m1, title((1)) This represents an Hedonic regression with clustered standard errors (the clustervariable "sellername

Data Analysis Examples with R and SAS

淺唱寂寞╮ 提交于 2020-03-20 18:35:57
http://www.ats.ucla.edu/stat/R/dae/ R Data Analysis Examples The pages below contain examples (often hypothetical) illustrating the application of different statistical analysis techniques using different statistical packages. Each page provides a handful of examples of when the analysis might be used along with sample data, an example analysis, explanation of the output, a short sample write-up, followed by references for more information. These pages merely introduce the essence of the technique and do not to provide a comprehensive description of how to use it. The combination of topics and

R prediction package VS Stata margins

你。 提交于 2020-02-27 07:26:17
问题 I'm switching from Stata to R, and I find inconsistent results when I use prediction to compute marginal pred and the results from the Stata command margins fixing the values of a variable to x . Here is the example: library(dplyr) library(prediction) d <- data.frame(x1 = factor(c(1,1,1,2,2,2), levels = c(1, 2)), x2 = factor(c(1,2,3,1,2,3), levels = c(1, 2, 3)), x3 = factor(c(1,2,1,2,1,2), levels = c(1, 2)), y = c(3.1, 2.8, 2.5, 4.3, 4.0, 3.5)) m2 <- lm(y ~ x1 + x2 + x3, d) summary(m2) marg2a

Loop nested loops (in R or Stata)

你。 提交于 2020-02-25 06:58:05
问题 I have a nested loop with 60 dimensions, i.e. I nest 60 loops into each other. In Stata the MWE would look like the following: forvalues i = 1/60 { forvalues j = 1/60 { forvalues k = 1/60 { forvalues l = 1/60 { ... imagine the 56 remaining loops here } } } } The equivalent in R is: for(i in 1:60) { for(j in 1:60) { for(k in 1:60) { for(l in 1:60) { ... imagine the 56 remaining loops here } } } } The objective here is to avoid typing all 60 levels into my code and create a loop for the loop

Loop nested loops (in R or Stata)

限于喜欢 提交于 2020-02-25 06:57:47
问题 I have a nested loop with 60 dimensions, i.e. I nest 60 loops into each other. In Stata the MWE would look like the following: forvalues i = 1/60 { forvalues j = 1/60 { forvalues k = 1/60 { forvalues l = 1/60 { ... imagine the 56 remaining loops here } } } } The equivalent in R is: for(i in 1:60) { for(j in 1:60) { for(k in 1:60) { for(l in 1:60) { ... imagine the 56 remaining loops here } } } } The objective here is to avoid typing all 60 levels into my code and create a loop for the loop

Error:'no variables defined' in stata when using monte carlo simulation

孤者浪人 提交于 2020-02-08 07:23:07
问题 I have written the program below and keep getting the error message that my variables are not defined. Can somebody plese see where the error is and how I should adapt the code? Really nothing seems to work. program define myreg, rclass drop all set obs 200 gen x= 2*uniform() gen z = rnormal(0,1) gen e = (invnorm(uniform()))^2 e=e-r(mean) replace e=e-r(mean) more gen y = 1 + 1*x +1*z + 1*e reg y x z e=e-r(mean) replace e=e-r(mean) more gen y = 1 + 1*x +1*z + 1*e reg y x z more return scalar

Error:'no variables defined' in stata when using monte carlo simulation

杀马特。学长 韩版系。学妹 提交于 2020-02-08 07:22:24
问题 I have written the program below and keep getting the error message that my variables are not defined. Can somebody plese see where the error is and how I should adapt the code? Really nothing seems to work. program define myreg, rclass drop all set obs 200 gen x= 2*uniform() gen z = rnormal(0,1) gen e = (invnorm(uniform()))^2 e=e-r(mean) replace e=e-r(mean) more gen y = 1 + 1*x +1*z + 1*e reg y x z e=e-r(mean) replace e=e-r(mean) more gen y = 1 + 1*x +1*z + 1*e reg y x z more return scalar

How to create a confusion matrix after mlogit?

人走茶凉 提交于 2020-02-02 21:31:19
问题 I have a categorical variable n_produttore : A-B-C-D-E-F and the output of multinomial logit (mlogit). How do I create the confusion matrix? mlogit n_produttore UVAtevola NUTILIZZODIVOLTE EXPOSTFIORITURA DIMENSIONE DOSI Iteration 0: log likelihood = -898.93386 Iteration 1: log likelihood = -868.27679 Iteration 2: log likelihood = -864.38774 Iteration 3: log likelihood = -864.28614 Iteration 4: log likelihood = -864.26279 Iteration 5: log likelihood = -864.25805 Iteration 6: log likelihood =

How to create a confusion matrix after mlogit?

假装没事ソ 提交于 2020-02-02 21:29:05
问题 I have a categorical variable n_produttore : A-B-C-D-E-F and the output of multinomial logit (mlogit). How do I create the confusion matrix? mlogit n_produttore UVAtevola NUTILIZZODIVOLTE EXPOSTFIORITURA DIMENSIONE DOSI Iteration 0: log likelihood = -898.93386 Iteration 1: log likelihood = -868.27679 Iteration 2: log likelihood = -864.38774 Iteration 3: log likelihood = -864.28614 Iteration 4: log likelihood = -864.26279 Iteration 5: log likelihood = -864.25805 Iteration 6: log likelihood =

Generating a new variable using conditional statements

自闭症网瘾萝莉.ら 提交于 2020-01-30 12:21:06
问题 Given the following dataset and commands: sysuse auto, clear generate x = . replace x = 5 if price == 4099 replace x = 5 if price == 4749 I want to generate a new variable x that is equal to 5 if price belongs to a list of values. The following command generates no new values of x and is incorrect: replace x = 5 if price == 4099 & price == 4749 I need a simpler one-line method that does not involve replacing x the way I did it in the code above, which works, but is tedious and inelegant. 回答1: