- Hi, I'm Beniamino (Ben) Green
- I'm a predoctoral fellow at the Yale School of Public Heath
- I am interested in computational social science, record linkage, and semiparametric statistics
Please checkout my blog here!
Test for weak IV instruments in R.
License: GNU General Public License v3.0
Please checkout my blog here!
Hi,
I am having trouble running a toy example. How can I fix this problem?
> library(cragg)
> library(AER) # for dataaset
> data("WeakInstrument")
> stock_yogo_test(
+ # control variables
+ X = ~ 1,
+ # endogeneous variables
+ D = ~ x,
+ # instrument variables
+ Z = ~ z,
+ data = WeakInstrument
+ )
Error in stock_yogo_reccomender(K = cd$K2, N = cd$N, B, size_bias) :
Error: K must be greater than N+1 for this operation
Hello,
I ran into the error above when trying to implement the Stock-Yogo test using your cragg package. I'm working with a data set of about 1.4 million observations, 28 IVs, and one endogenous variable (I'm assuming that for size distortion results it's ok to have one endogenous variable but let me know if this is a problem for the package). The offending code is below:
stock_yogo_test(
~factor(region) + factor(yob) + Race + SMSA + Married + Age + Age2, #Controls
~educ, #Treatments
~factor(birthqtr):factor(yob), #Instruments
B=.1, #Maximum Allowable Size Distortion
size_bias="size", #Calculate critical value for size distortions
data = df
)
I'm happy to provide the data. They are the Angrist and Krueger "quarter of birth-returns to education" data, which I'm using to create a problem set. Thanks in advance.
I have issues with the functions in the package when an intercept is included explicitly and when the model should not contain an intercept.
The following code models the intercept explicitly but throws an error. The reason is that it leads to two intercept columns in X_m
that are of course perfectly collinear.
df <- iris
df$CONS <- 1
cragg_donald(X=~CONS+Sepal.Length, D=~Sepal.Width, Z=~Petal.Length + Petal.Width + Species, data = df)
Similarly, the code internally always adds an intercept column to X_m but some models might not have an intercept.
It would be good to simply have a consistent handling of an intercept. It is possibly easiest if users need to specify an intercept explicitly by creating a variable and add it to the ~X
formula. Alternatively, a function argument could ask the user whether an intercept should be added or not.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.