similar to: converting stata's by syntax to R

Displaying 20 results from an estimated 7000 matches similar to: "converting stata's by syntax to R"

2009 Jul 15
1
GLM Gamma Family logLik formula?
Hello all, I was wondering if someone can enlighten me as to the difference between the logLik in R vis-a-vis Stata for a GLM model with the gamma family. Stata calculates the loglikelihood of the model as (in R notation) some equivalent function of -1/scale * sum(Y/mu+log(mu)+(scale-1)*log(Y)+log(scale)+scale*lgamma(1/scale)) where scale (or dispersion) = 1, Y = the response variable, and mu
2012 Mar 12
2
Replicating Stata's xtreg clustered SEs in R
I'm trying to replicate a time-series cross-sectional analysis (countries over years) with SEs clustered by country. ?The original analysis was done in Stata 10 with: xtreg [DV] [IVs] fe cluster(country). Using plm() in R (cran.r-project.org/web/packages/plm/index.html), I've replicated the coefficients. I sought to estimate country-clustered SEs with vcovHC(), and tried a variety of
2006 Jun 09
1
glm with negative binomial family
I am analysing parasite egg count data and am having trouble with glm with a negative binomial family. In my first data set, 55% of the 3000 cases have a zero count, and the non-zero counts range from 94 to 145,781. Eventually, I want to run bic.glm, so I need to be able to use glm(family= neg.bin(theta)). But first I ran glm.nb to get an estimate of theta: > hook.nb<- glm.nb(fh,
2010 Apr 12
1
zerinfl() vs. Stata's zinb
Hello, I am working with zero inflated models for a current project and I am getting wildly different results from R's zeroinfl(y ~ x, dist="negbin") command and Stata's zinb command. Does anyone know why this may be? I find it odd considering that zeroinfl(y ~ x, dist="poisson") gives identical to output to Stata's zip function. Thanks, --david [[alternative
2009 Feb 10
2
What is the R equivalent of STATA's 'drop' command?
Hello, I am trying to do some data cleaning in R. I need to drop observations that take on certain values of a variable. In STATA I might type something like: drop if <variable name> == 3 drop if <variable name> == 4 Is there an R equivalent of this? I have tried playing around with the subset command, but it seems a bit clunky. What would an advanced R user's approach be for
2011 Apr 07
1
Panel data - replicating Stata's xtpcse in R
Dear list, I am trying to replicate an econometrics study that was orginally done in Stata. (Blanton and Blanton. 2009. A Sectoral Analysis of Human Rights and FDI: Does Industry Type Matter? International Studies Quarterley 53 (2):469 - 493.) The model I try to replicate is in Stata given as xtpcse total_FDI lag_total ciri human_cap worker_rts polity_4 market income econ_growth log_trade
2005 Nov 27
1
fixed, random effects with variable weights
Hi everyone, I have tried to solve a simple problem for days but I can't figure out how to run it properly. If someone could give me a hint, this would be really great. Basically, I want to run a standard economist's fixed, and random effects regression (corresponds to xtreg in STATA) but with _variable_ weights (they correspond to changing industry shares in the market). Here is
2010 Aug 04
2
does R have a command the same with Stata's loop command: ` '
hey, Rers in Stata therer is a loop command ` ' which could do the following: forvalue i=1/10 { ?gen?x`i'=expression } this will generate variable: x1,x2,,,,,x10. so, does R have a corresponding one to this? And one more very basic question: after I open a file and modify it, such as generate some new variables and change some old ones, how to use the changed dataset in
2004 Nov 30
3
Relative subscripting
Hi! I'm trying to do the following. I have monthly a dataset with, among other things, "marketcap", and "return". I want to multiply return by the marketcap of the previous month. How do I do this? In STATA (which I have used frequently in the past) I would simply use an expression of the form return[_n]*marketcap[_n-1] I believe they call this relative
2012 Sep 21
1
Exactly Replicating Stata's Survey Data Confidence Intervals in R
Hi everyone, apologies if the answer to this is in an obvious place. I've been searching for about a day and haven't found anything.. I'm trying to replicate Stata's confidence intervals in R with the survey package, and the numbers are very very close but not exact. My ultimate goal is to replicate Berkeley's SDA website with R (http://sda.berkeley.edu/), which seems to
2007 Jan 06
2
negative binomial family glm R and STATA
Dear Lister, I am facing a strange problem fitting a GLM of the negative binomial family. Actually, I tried to estimate theta (the scale parameter) through glm.nb from MASS and could get convergence only relaxing the convergence tolerance to 1e-3. With warning messages: glm1<-glm.nb(nbcas~.,data=zonesdb4,control=glm.control(epsilon = 1e-3)) There were 25 warnings (use warnings() to see
2008 Mar 15
1
again with polr
hello everybody solved the problem with summary, now I have another one eg I estimate > try.op <- polr( > as.ordered(sod.sit.ec.fam) ~ > log(y) + > log(1 + nfiglimin) + > log(1 + nfiglimagg) + > log(ncomp - nfiglitot) + > eta + > I(eta^2) + >
2010 Jan 21
3
cross validation function translated from stata
Hi, everyone: I ask for help about translating a stata program into R. The program perform cross validation as it stated. #1. Randomly divide the data set into 10 sets of equal size, ensuring equal numbers of events in each set #2. Fit the model leaving out the 1st set #3. Apply the fitted model in (2) to the 1st set to obtain the predicted probability of a prostate cancer diagnosis. #4. Repeat
2011 Mar 10
2
R beginner - Error in as.vector(x, mode)
Hi everyone, I am new to R and keep getting the message Error in as.vector(x, mode) while trying to run nlsystemfit. Below is my exact code. The data is in Stata format because I only recently swapped to R and am trying to compare results from Stata to make sure I know what is going on. I have searched google and read sever R-help articles with this error. They all say the problem is to do
2012 Jul 08
2
Notation for previous observation in a data frame
I've created a data frame in R, but in order to clean up some of the data, I need to set certain variable observations equal to the value of their previous observation (it would be conditional, but that part's less important right now). In Stata, I would simply set var = var[_n-1] in those cases. What is the R equivalent? [[alternative HTML version deleted]]
2016 Dec 29
3
Change default Server ports
I'm using Tinc 1.1pre14 and I'm trying to connect a node that is behind a firewall that blocks all non-standard ports. I set up a rule in the server to redirect port 25 (that is not used in the server right now) to port 655, both in tcp and udp protocols, and set up the port 25 in the server host configuration file. The client can reach the server, but after the initial sync and key
2014 Jan 23
2
Stata support in package foreign
As you know, Stata support in 'foreign' was frozen a while back at Stata version 12. R-core has received a request from a grad student to 'give top priority' to supporting Stata 13. That is not going to happen, not least because none of us has access to Stata. However, according to Stata's documentation both Stata 12 and 13 use format 115, so foreign::read.dta should be
2017 Sep 05
1
[Announcement] Tinc versions 1.0.32 and 1.1pre15 released
Hi Guillermo, Yes, I've also noticed there are still issues with resuming from standby on Windows, despite the latest fixes that I wrote (which are included in 1.1pre15). I think my fixes covered some of the causes of tinc misbehaving on standby, but not all of them. Are you able to reproduce the issue reliably? If so, can you please file an issue at https://github.com/gsliepen/tinc/issues
2017 Sep 05
1
[Announcement] Tinc versions 1.0.32 and 1.1pre15 released
Hi Guillermo, Yes, I've also noticed there are still issues with resuming from standby on Windows, despite the latest fixes that I wrote (which are included in 1.1pre15). I think my fixes covered some of the causes of tinc misbehaving on standby, but not all of them. Are you able to reproduce the issue reliably? If so, can you please file an issue at https://github.com/gsliepen/tinc/issues
2006 Jun 23
2
Tetrachoric correlation in R vs. stata
I hope someone here knows the answer to this since it will save me from delving deep into documentation. Based on 22 pairs of vectors, I have noticed that tetrachoric correlation coefficients in stata are almost uniformly higher than those in R, sometimes dramatically so (TCC=.61 in stata, .51 in R; .51 in stata, .39 in R). Stata's estimate is higher than R's in 20 out of 22