josherrickson / pbph Goto Github PK
View Code? Open in Web Editor NEWR package implementing Peters-Belson with Prognostic Heterogeneity
R package implementing Peters-Belson with Prognostic Heterogeneity
Right now, disjoint CI's are returned like finite CI's. Only if returnShape = TRUE
is there any indication.
In the paper, we recommend considering disjoint CI's as infinite.
Possible approaches:
returnShape = TRUE
is specified.disjointInf = FALSE
or something.confint
outcome to allow the disjoint form (probably not the best option as it would drastically differ from other confint
displays).With cluster random assignment, the effective sample size is more nearly determined by the number of clusters than by the number of elements within clusters. Statisticians who are aware of this should expect to see it reflected in the calculations. However, in R/sandwich.R as it stands now (f7fb70b on Mar 22), the clusters don't appear to be informing the scaling constants: n
is being defined as n <- NROW(sandwich::estfun(x))
, just as if there were no clusters.
Perhaps this is as it should be: assuming that bread()
will have scaled its A matrices by the reciprocal of the number of elements, then this mischief is undone by premultiplying both the bread matrix and the
Relatedly, I don't imagine that the n/(n - k)
degrees of freedom adjustment to the bread is the correct one when there are clusters and n
refers to the number of elements. The simplest or most accepted cluster-aware alternative that presents itself in (your nonrandom sample of) the cluster-robust standard error literature would be an improvement here, if only for the purpose of emphasizing to the reader of the code that the code really is cluster-aware. (If there's no one proposal for simplest or most accepted cluster-aware d.f. adjustment, pick one.)
Issue #7 brought up the existence of clubSandwich. Potentially implement in the future. For the record, type = "CR1S"
is equivalent to the adjustment pbph
currently makes.
Pros:
Cons:
pbph
requires creating bread
and meat
separately; its not immediately obvious if clubSandwich
allows this. Look into whether that could be worked around (I believe we'd always need B22
, but maybe its worth not using sandwich
or clubSandwich
for that piece if it eases other calculations?).If it is decided not to lean on clubSandwich, then cleaning up the adjust
argument is needed (See #7 for discussion).
To estimate the SE of
In practice one will have estimated
@josherrickson , could I interest you in bringing your cluster-aware sandwich functions into RItools? We could make use of them for various purposes over there.
A couple things I'd suggest doing in the process:
adjust=
argument with a non-null cluster=
argument also? (Maybe while changing adjust=
to default to TRUE
.)Occasionally getting the following error, mostly when running automated scripts (e.g. in a make
call for a paper.)
Error in eval(expr, envir, enclos) : object 'y_t - pred' not found
I'm unable to replicate in an interactive session so far.
Possible solution is to stop editing the call, and instead modify summary.pblm
to stop relying so heavily on summary.lm
.
Looking at the two-stage sandwich variance formulas as they apply in the case of glms and/or clusters,
Looking at formulas for optmatch::scores
function was written with precisely this type of scenario in mind.
optmatch::scores
wraps to predict
, whose glm method supports type
options selected from c("link", "response", "terms")
. This issue is suggesting an additional type, "gradient", that could be invoked to fill this role.
Supporting this functionality by way of an extension to optmatch::scores()
, as opposed to functions developed more specifically for the epb problem, could come in handy in some other problems with stacked estimating equations: simple PB; estimators using various types of inverse probability weighting, with probabilities estimated from a superset of the analytic sample itself, and so on.
R 3.3 introduced a new chkDots()
function that will warn on arguments passed via ...
if no such arguments are supported.
Adding this functionality is a bit safer, but will require bumping version requirement of R to 3.3 (or putting a check around the call to chkDots()
).
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.