XMLReader::read
(PHP 5 >= 5.1.0, PHP 7)
XMLReader::read — Move to next node in document
说明
public bool XMLReader::read ( void )
Moves cursor to the next node in the document.
返回值
成功时返回 TRUE，或者在失败时返回 FALSE。
参见
• XMLReader::moveToElement() - Position cursor on the parent Element of
current Attribute
• XMLReader::moveToAttribute() - Move cursor to a named attribute
• XMLReader::next() - Move cursor to next node skipping all subtrees
User Contributed Notes 6 notes
===============================================================================
libxml2 contains much more useful method readString() that will read and return
whole text content of element. You can call it after receiving start tag
(XMLReader::ELEMENT). You can use this PHP code to emulate this method until
PHP will directly call underlying libxml2 implementation.
read() && $depth != 0)
{
if (in_array($this->nodeType, array(XMLReader::TEXT, XMLReader::
CDATA, XMLReader::WHITESPACE, XMLReader::SIGNIFICANT_WHITESPACE)))
$text .= $this->value;
if ($this->nodeType == XMLReader::ELEMENT) $depth++;
if ($this->nodeType == XMLReader::END_ELEMENT) $depth--;
}
return $text;
}
}
?>
Just use XMLReader2 instead of XMLReader.
===============================================================================
It is interesting to note that this function will stop on closing tags as
well. I have an XML document similar to the following:
columnX
columnY
I need to parse the object to know what attributes to check for from
each node. Therefore I was doing the following:
read()) {
if ($xml->name === 'column') {
//parse column node to into $columns array
}
elseif ($xml->name === 'row') {
//parse row node, using constructed $columns array
}
}
?>
This kind of worked in that I ended up with an array of all the data I wanted,
but the array I constructed was twice as large as I expected and every other
entry was empty. Took me a while to debug, but finally figured out that
checking name === 'row' ?> matches both and
, so the
check should really be something more like:
name === 'row' && $xml->nodeType == XMLReader::ELEMENT) {
// parse row node
}
?>
I would have liked to use the next() function instead, but as I needed to parse
2 different subtrees, I couldn't figure out how to find all the columns, reset
the pointer, and then find all the rows.
===============================================================================
If like myself you have been turning the interwebz upside down looking for a
solution for this issue:
PHP Warning: XMLReader::read(): /tmp/xml_feed.xml:4183934: parser error :
Input is not proper UTF-8, indicate encoding !
For some reason, this warning breaks the execution - is it a fatal error in
disguise?
After days of frustration I found it!!!!
tidy -xml -o output.xml -utf8 -f error.log input.xml
You can invoque tidy using exec, It takes several seconds to convert a 250Mb
feed, but it worthy the time.
In my case the issue was with latin1 charset, and for some reason I had to pass
the xml through tidy 2 times - first time around creates new errors, second
time it fixes everything.
I know invalid xml should be fixed by xml creators, but it works differently in
the real world.
===============================================================================
> I would have liked to use the next() function instead, but as I needed to
parse 2 different subtrees, I couldn't figure out how to find all the columns,
reset the pointer, and then find all the rows.
I just use:
$reader->close();
$reader->open($url);
to reset the pointer.
===============================================================================
If you have trouble parsing xml documents with text tags bigger than 10MB, this
might help you:
open($uri, null, 1<<19);
?>
Since in libxml there is a constant
XML_PARSE_HUGE = 1<<19
which enables parsing xml documents with huge texts.
Please note that this option is not accessible using the setParserProperty
method and that there is currently no constant to do the work, which will
hopefully change soon:
http://bugs.php.net/bug.php?id=49660
===============================================================================
A very simple way to avoid typing $reader->read() multiple times when you want
to skip some nodes:
read();
$i++;
}
}
}
?>
Using this smartXMLReader,
readTimes(3);
?>
is equivalent to
read();
$reader->read();
$reader->read();
?>
Makes getting around in your XML document a bit easier :)


Watch it changing for tiny, small, medium, large, xlarge, 2xlarge and 3xlarge widths!
Use one input:
colOffset= "2"
=> colOffset= "2,2,2,2,2,2,2"
Use two inputs:
colOffset= "2,3"
=> colOffset= "2,3,3,3,3,3,3"
Use three inputs:
colOffset= "0,3,4"
=> colOffset= "0,3,4,4,4,4,4"
Use four inputs:
colOffset= "0,3,4,5"
=> colOffset= "0,3,4,5,5,5,5"
Use seven inputs:
colOffset= "0,3,4,5,6,7,8"
=> colOffset= "0,3,4,5,6,7,8"


Goodbye Wordpress
I am in the process of migrating away from my self-hosted Wordpress to the Github-hosted Github Pages, powered by Jekyll.
I was finding it difficult to motivate myself to write when my wordpress comments kept getting hit by bots. Please excuse the plain styling while I get the hang of using Jekyll.


Campaign highlights: Johnson pledges Brexit vote as ‘early Christmas present’
Meanwhile, the DUP suggested it could potentially support a Labour Government – without Jeremy Corbyn as prime minister.
Boris Johnson pledged to “get Brexit done” and reunite the country as he launched the Tory General Election manifesto.
The Prime Minister promised a programme of investment for the NHS and the police while freezing key tax rates.
Meanwhile, Labour promised to compensate an estimated 3.7 million women who believed they lost out financially due to changes in the state pension age, and the DUP hinted at a new alliance.
Here are some of the highlights of Sunday’s campaign trail:
– The Tories launched their manifesto
Boris Johnson pledged to “get Brexit done” and reunite the country as he unveiled the Conservative Party’s manifesto.
The Prime Minister promised a programme of investment for the NHS and the police while freezing key tax rates.
He sought to characterise the election contest as a battle between “retrograde destructive socialism” under Labour and “sensible one nation Conservatism” under the Tories.
– Michael Gove does not always agree with Dominic Cummings
The Chancellor of the Duchy of Lancaster was shown a clip of Boris Johnson’s aide Mr Cummings speaking in 2017, in which he said Tory MPs largely do not care about poor people or the NHS, adding that the public has “cottoned on to that”.
Responding to the clip, Mr Gove told The Andrew Marr Show: “He’s wrong about that. There are a number of occasions where I’ve disagreed with Dominic on this issue and some other matters as well.
“I’m very happy to look at our record in government.”
– There could be a huge vote in the House of Commons before Christmas
Boris Johnson is promising to bring back his Brexit deal to Parliament before Christmas if the Tories are returned to power on December 12.
The Prime Minister described his decision to reintroduce the Withdrawal Agreement Bill (WAB) – ratifying his Brexit deal with Brussels – in December as an “early Christmas present” for voters fed up with the wrangling over Britain’s departure from the EU.
He said he wants families to enjoy their turkey dinner “free from the seemingly unending Brexit box-set drama”.
– Millions of women born in the 1950s will be compensated under Labour plans
Labour is promising to compensate an estimated 3.7 million women who believed they lost out financially due to changes in the state pension age if the party wins the General Election.
Shadow chancellor John McDonnell said the payments were to settle a “historical debt of honour” to the women born in the 1950s.
The party said the payout could amount to £58 billion over five years.
– The DUP could potentially support a Labour Government – without Jeremy Corbyn as prime minister
DUP leader Arlene Foster has acknowledged there are others in the Labour Party, with different positions from Mr Corbyn, who she could consider working with.
In that situation, she said her party would judge any successor to Mr Corbyn against the DUP’s election blueprint for Northern Ireland, and whether the new leader’s vision was good for the region.
Ms Foster says she could see no circumstance in which her party would support a minority Labour administration with Mr Corbyn as prime minister.
Tweet of the day
The Conservative manifesto was launched, with promises that the Tories would “get Brexit done” as well as ploughing money into the NHS and police.
The most discussed moment online was the party’s U-turn on the decision to scrap nursing bursaries six years ago. Now, Boris Johnson is promising to provide nursing students with an annual grant of £5,000-£8,000.
The announcement coincided with the news that more than 3,000 staff have left the NHS since the Brexit referendum.
Picture of the day
Video of the day
Boris Johnson: Let’s go Corbyn-neutral by Christmas
What’s next?


The Soweto Derby Old-School Beamer Battle
by SL SocialThe BMW automobile brand is a favorite among many footballers. Some, however, can still be seen cruising around in old-school "beamers". Check it out!
With the Soweto Derby looming, we look at two Kaizer Chiefs and Orlando Pirates players, namely Augustine Mulenga and Bernard Parker, and their preference for classic BMWs.
Download The Soccer Laduma Social Media App & Earn Airtime for Selfies!
During his earlier days as a professional footballer, Mulenga owned a black BMW 318i, and often took to Instagram to post pics of himself posing next to his ride.
As for "Die Hond", the attacker owned a pimped out BMW 325i, which is a newer version of the iconic "gusheshe".
To see Parker and Mulenga’s BMWs, scroll through the mini-gallery above!
Between these two attackers, who would you say had the better BMW?


Implements a Gibbs sampler to do linear regression with multiple covariates, multiple responses, Gaussian measurement errors on covariates and responses, Gaussian intrinsic scatter, and a covariate prior distribution which is given by either a Gaussian mixture of specified size or a Dirichlet process with a Gaussian base distribution.
| Version: | 0.5.3 |
| Imports: | mvtnorm |
| Published: | 2017-12-01 |
| Author: | Adam Mantz |
| Maintainer: | Adam Mantz <amantz at slac.stanford.edu> |
| License: | MIT + file LICENSE |
| URL: | https://github.com/abmantz/lrgs |
| NeedsCompilation: | no |
| CRAN checks: | lrgs results |
| Reference manual: | lrgs.pdf |
| Package source: | lrgs_0.5.3.tar.gz |
| Windows binaries: | r-devel: lrgs_0.5.3.zip, r-release: lrgs_0.5.3.zip, r-oldrel: lrgs_0.5.3.zip |
| OS X binaries: | r-release: lrgs_0.5.3.tgz, r-oldrel: lrgs_0.5.3.tgz |
| Old sources: | lrgs archive |
Please use the canonical form https://CRAN.R-project.org/package=lrgs to link to this page.


Table of Contents
Widget sets are collections of functions that create HTML elements. They're useful to set up pages with a common layout.
At the time there's only a native HTML widget set for most block elements which you'll find very useful to print form elements.
Widget set are packed into classes.
Some widget functions might delay output until this function is called. Instead of php's internal function echo () function widget_set::print () to preserve the right code order.


Chapter 10 Panel Data: Fixed Effects and Difference-in-Difference
Another source of variation is repeated measures of the same unit over time. This can allow for identification with different identifying assumptions. There are two identification approaches we will focus on
- Fixed Effects
- Different-in-Difference
See Angrist and Pischke (2014 Ch. 5) and Angrist and Pischke (2009 Ch 5) on fixed effects and difference-in-difference approaches.
10.1 Panel (Longitudinal) Data
In these methods there are repeated measurements of the same unit over time. This requires different methods and also has implications for causal inference. While simply having panel data does not identify an effect, it allows the researcher to claim identification using different assumptions than simply selection on observables (as in the cross-sectional case).
10.2 Terminology
There are several closely related concepts and terminology to cover.
- Panel (longitudinal) data
small \(T\), large \(N\). Examples: longitudinal surveys with a few rounds.
- Time series cross-section data
large \(T\), medium \(N\). Examples: most country-year panels in CPE/IPE with several decades of data.
For the purposes of causal inference, identification relies on the same assumptions. However, different estimators work differently under different data types. Some estimators work well as \(N \to \infty\), some as \(T \to \infty\), and usually these are not the same. Additionally, longer time series may require and/or have enough data for the researcher to estimate serial correlation in the errors.
There are some additional related concepts that should also be mentioned at this time, hopefully to spare the reader future confusion (and not to add to it):
- Hierarchical Models
units nested within groups. E.g. children in schools, districts within states
- Time-series Models
large \(T\), usually \(N = 1\), or the different units modeled separately.
Terminology can be confusing and varies across fields and literatures. In particular, fixed effects and random effects are used differently and often estimated differently in statistics and econometrics. This is easily seen by comparing the lme4 and plm packages in R which both estimate fixed and random effects models. Hierarchical models will often used fixed and random effects even though there is no time component, and thus they are not longitudinal models. The reason that I bring up this terminology is that if you search for fixed and random effects you can quickly be confused when it seems that people are talking about seemingly different concepts; they more of less may be.
By panel data we will mean repeated measures for a unit, \(i \in 1, \dots, N\), over time, \(t \in 1, \dots, T\).
- same individuals in multiple surveys over time
- countries or districts over years
- individuals over time
There are many different terms for repeated measurement data, including longitudinal, panel, and time-series cross-sectional data. Generally,
The issues of causality are mostly the same, for these two types of data. However, the estimation methods are different. Estimation methods often rely on asymptotic assumptions about observations going to infinity. In repeated measurements there are two dimensions: number of units, and number of periods. Different estimators will work better for small \(T\) vs. large \(T\), and small \(N\) vs. large \(N\).
10.3 Fixed Effects
Suppose that there are \(i \in 1, \dots n\) unit, and \(t \in 1, \dots, T\) time periods. The key assumption is that the treatment is independent of time, observed covariates, *and the identity of the observation. \[ \E[Y_{it}(0) | U_i, X_{it}, t, D_{it}] = \E[Y_{it}(0) | U_i, X_{it}, t] \] This is effectively a control for an unobserved factors for a unit.
We need to make a few assumptions. Assume that time and linear effects are constant, \[ \E[Y_{it}(0) | U_i, X_{it}, t] = \alpha + U_i' \gamma + X'_{it} \beta . \]
Assume that the causal effect is constant, and has a linear functional form: \[ \E[Y_{it}(1) | U_i, X_{it}, t] = \E[Y_{it}(0) | U_i, X_{it}, t] + \tau \]
Together this implies \[ \E[Y_{it} | U_i, X_{it}, t, D_{it}] = \alpha + \tau D_{it} + \delta_{t} + U_i' \gamma + X' \beta . \] This implies, \[ Y_{it} = \alpha_i + \delta_t + \tau D_{it} + X'_{it} \beta + \epsilon_{it} \] where \[ \epsilon_{it} = Y_{it}(0) - \E[Y_{it}(0) | U_i, X_{it}, t] . \] This implies that the fixed effects regression will be a CEF if \(\epsilon_{it}\) has an expected value of 0.
Fixed effects allows us to identify causal effects within units, and it is constant within the unit. You can think of this as a special kind of control.
This requires some more stringent functional forms assumptions than regression, but it also can handle a specific form of unobserved confounders.
10.3.1 Estimators
Given this model, there are several different estimators that are used.
<IP_ADDRESS> Within Estimator
First calculate the unit-level averages, \[ \bar{Y}_i = \alpha_i + \bar{\delta} + \tau \bar{D}_{i} + \bar{X}_{it}' \beta + \bar{\epsilon}_{i} . \] The within estimator subtracts these unit-level means from the response, treatment, and all the controls: \[ Y_{it} - \bar{Y}_i = (\delta_t - \bar{\delta}) + (X_{it} - \bar{X}_i)' \beta + \tau (D_{it} - \bar{D}_i) + (\epsilon_{it} - \bar{\epsilon}_{i}) \] Also note that since \(\bar{Y}_i\) are unit averages, and the unobserved effect is constant over time, subtracting off the mean also subtracts that unobserved effect.
Implications are:
- Cannot use fixed effects to estimate causal effects of treatments that are constant within a unit.
- We do not need to include any time-constant controls.
- Only removes time-constant unobserved effects in a unit. See difference-in-difference for a method to remove some types of time-varying unobserved values.
<IP_ADDRESS> Least Squares Dummy Variable (LSDV)
Dummy variable regression is an alternative way to estimate fixed effects models. Called the least squared dummy variable (LSDV) estimator. Include a matrix of indicator variables (\(W_i\)) for each observation. \[ Y_{it} = \tau D_{it} + w_i' \gamma + x'_{it} \beta + \epsilon_{it} \]
Within vs. LSDV are equivalent algebraically.
LSDV is more computationally demanding. With \(p\) covariates and \(G\) groups, within estimator’s design matrix has only \(p\) columns, whereas the LSDV design matrix has \(p + G\) columns.
If the within estimator is manually estimated by demeaning variables and then using OLS, the standard errors will be incorrect. They need to account for the degrees of freedom due to calculating the group means.
In LSDV, the fixed effects themselves are not consistent if \(T\) fixed and \(N \to \infty\). However, the other coefficients are consistent, and those are the ones we care about. (Angrist and Pischke 2009, 224)
<IP_ADDRESS> First-differences estimation
Given that \(U_i\) is constant over time, first difference model is an alternative to mean-differences. The model is, \[ \begin{aligned}[t] Y_{it} - Y_{i,t-1} &= (x'_{it} - x'_{i,t-1}) \beta + \tau (D_{it} - D_{i,t-1}) + (\epsilon_{it} - \epsilon_{i,t-1}) \\ \Delta Y_{it} &= \Delta x'_{it} \beta + \tau \Delta D_{it} + \Delta \epsilon_{it} \end{aligned} \]
- If \(U_i\) are time-fixed, then first-differences are an alternative to mean-differences
- If the difference in errors, \(\Delta \epsilon_{it}\) are homoskedastic, OLS standard errors work fine.
- But implies that original errors must have had serial correlation: \(\epsilon_{it} = \epsilon_{i,t-1} + \Delta \epsilon_{it}\).
- If serial correlation, then more efficient than FE.
- Robust/sandwich SEs can be used.
See Angrist and Pischke (2009 Ch 5.3) for a discussion of the difference between lagged dependent variables and fixed effects.
LDV and FE estimators bound the causal effect of interest (Angrist and Pischke 2009, 246).
If lagged dependent variable and fixed effect are both included then there is bias. Though this bias is not too bad and declines with the amount of data (CITE?). Instrumental variable approaches can be used, which are unbiased but very high variance, and thus OLS is often as good (same CITE)
10.3.2 Issues with Fixed Effects
The only use within unit variation. This does not address changes over time.
Susceptible to measurement error. There may be little variation within each unit. This will make it harder to estimate effects, which is okay, because the lack of within-unit variation tells us that this is a poor identification strategy. IV could be used (Angrist and Pischke 2014, 226)
Fixed effects only identifies contemporaneous effects. See Blackwell (2013) for an approach to dynamic panel data .
Since a fixed effect approach can usually be turned into a difference-in-difference approach by including period level dummies, there is often little reason not to do a DiD.
10.4 Difference-in-Difference
The difference-in-difference estimator is similar to the fixed effect model, but relies on different assumptions.
10.4.1 Basic differences-in-differences model
| Treatment | Control | |
|---|---|---|
| Pre | \(E(Y_{i1}(0) | D_i = 1)\) | \(E(Y_{i1}(0) | D_i = 0)\) |
| Post | \(E(Y_{i2}(1) | D_i = 1)\) | \(E(Y_{i2}(0) | D_i = 0)\) |
The difference-in-difference (DiD) estimator is \[ DiD = \underbrace{(\E(Y_{i2}(1) | D_i = 1) - \E(Y_{i1}(0) | D_i = 1))}_{\text{Treatment Difference}} - \underbrace{(\E(Y_{i2}(0) | D_i = 0) - E(Y_{i1}(0) | D_i = 0))}_{\text{Control treatment}} . \]
For the general case of multiple time periods \(t = 1, \dots, T\), for observations \(i = 1, \dots, N\) in \(g = 1, \dots, G\) groups, the DiD regression is, \[ y_{itg} = \alpha + \underbrace{\sum_{t = 1}^T \beta_{t} I(t = \tau)}_{\text{time dummies}} + \underbrace{\sum_{k = 1}^G \gamma_{g} I(k = g)}_{\text{group dummies}} + \underbrace{\delta D_{tg}}_{\text{treatment}} + \epsilon_{it} \]
Identification comes from inter-temporal variation between groups.
10.4.2 Potential Outcomes Approach to DiD
<IP_ADDRESS> Constant Effects Linear DiD Model
Causal effects are constant across individuals and time, \[ \E[Y_{it}(1) - Y_{it}(0)] = \tau . \] The effects of time \(\delta_t\) and individuals \(\alpha_g\) are linearly separable, \[ \E[Y_{it}(0)] = \delta_t + \alpha_{g} . \] Then the model is, \[ Y_{igt} = \delta_{t} \]
10.4.3 Threats to identification
- Treatment independent of idiosyncratic shocks, so variation in outcome is the same for treated and control groups.
- Example: Ashenfelter’s Dip is an empirical phenomena in which people who enroll in job training programs see their earnings decline .
- It may be possible to condition on covariates (control) in order to make treatment and shocks independent.
10.4.4 Robustness Checks
Lags and Leads
- If \(D_{igt}\) causes \(Y_{igt}\), then current and lagged values should have an effect on \(Y_{igt}\), but future values of \(D_{igt}\) should not.
Placebo permutation test. Randomly assign the intervention(s) to create the sampling distribution of the null hypothesis.
Use different comparison groups. Different groups should have the same affect.
Use an outcome variable that you know is not affected by the intervention. If DiD estimates not zero, then there is some other difference between groups.
Time Trends
If more than two time periods, add unit specific linear trends to regression DiD model. \[ Y_{igt} = \delta_{t} + \tau G_{i} + \alpha_{0g} + \alpha_{1g} \times t + \epsilon_{igt} , \] where \(\alpha_{0g}\) are group fixed effects, \(\delta_t\) is the overall (not necessarily linear) time trend, and \(\alpha_{1g}\) is the group linear time trend.
Helps detect if varying trends when estimated from pre-treatment data.
10.4.5 Extensions
The general DiD model relies on linear-separability and constant treatment effects.
The parallel trends assumption is the important assumption: \[ \E[ Y_{i1}(0) - Y_{i0} | X_i, G_i = 1] = \E[ Y_{i1}(0) - Y_{i0} | X_i, G_i = 0]. \] It says that the potential trend under control is the same for the control and treated groups, conditional on covariates.
With the parallel trends assumption unconditional ATT is, \[ \E[Y_{i1}(1) - Y_{i1}(0) | G_i = 1] = \E_{X}[\E[Y_{i1}(1) - Y_{i1}(0) | G_i = 1]] = , 𝐺𝑖 = 1]]. \] What we need is an estimator of each CEF. This doesn’t need to be linear or parametric.
However, cannot estimate ATE because \(\E(Y_{i1}(1) | X_i, G_i = 0)\) could be anything.
With covariates we can estimate conditional DiD in several ways.
- Regression DiD
- Match on \(X_i\) and then use regular DiD
- Weighting approaches Abadie (2005)
Regression DiD includes \(X_i\) in a linear, additive manner, \[ Y_{it} = \mu + x'_i \beta_t + \delta I(t = 1) + \tau(I(t = 1) \times G_i) + \epsilon_{it} \] If there are repeated observations, take difference between \(t = 0\) and \(t = 1\), \[ Y_{i1} - Y_{i0} = \delta + x'_i \beta + \tau G_i + (\epsilon_{i1} - \epsilon_{i0}) \] Have \(\beta = \beta_1 - \beta_0\). Because everyone is untreated in first period, \(D_{i1} - D_{i0} = D_{i1}\).
For panel data, regress changes on treatment.
Depends on constant effects and linearity in \(X_i\). Matching could reduce model dependence.
10.4.6 Standard Error Issues
<IP_ADDRESS> Serial Correlation
A major issue with errors in difference-in-difference models is serial correlation (Bertrand, Duflo, and Mullainathan 2004). Consider the DiD model, \[ Y_{igt} = \mu_g + \delta_t + \tau (I_{it} \times G_i) + \nu_{gt} + \epsilon_{igt} . \] The problem is that \(\nu_{gt}\) can be serially correlated \[ Cor(\nu_{gt}, \nu_{gs}) \neq 0 \text{ for } s \neq t . \] An example called \(AR(1)\) serial correlation is when each \(\nu_t\) is a function of its lag, \[ \nu_t = \rho \nu_{t - 1} + \eta_t \text{ where } \rho \in (0, 1). \] Since errors are usually positively correlated, the outcomes are correlated over time and effectively there are fewer independent observations in the sample; it’s almost as if the same observation was simply copy and pasted over time with a little error added. This will mean that the standard errors will likely be too optimistic (too narrow). See Bertrand, Duflo, and Mullainathan (2004) for a longer discussion of this. here are a couple of solutions:
- Clustered standard errors at the group level
- Clustered bootstrap (re-sample groups, not individual observations)
- Aggregated to \(g\) units with two time periods each: pre- and post-intervention. Since correlation makes the panel data closer to simply a two-period DiD, this takes that all the way.
All these solutions depend on larger numbers of groups. Do not use the off-the-shelf clustered standard errors unless the number of groups is large. See Esarey and Menger (2018) for an extensive discussion of this. Also see the associated clusterSE package and clubSandwich for implementations of cluster robust standard errors that work with smaller numbers of clusters.
10.4.7 Other DiD Approaches
Changes-in-changes (Athey and Imbens 2006) generalizes DiD to allow for different changes in the distribution of \(Y_{it}\), not just the mean. This allows for estimating ATT or any changes in distribution (quantiles, variance, etc.). Unfortunately requires more data than estimating the mean.
Synthetic controls is used when there is one treated group, but many controls. (See Abadie and Gardeazabel and the paper on the Seattle minimum wage).
The basic idea is to compare the time series of the outcome in the treated group to a control.
- But what if there are many control group?
- What if they aren’t comparable to the treated?
Synthetic control uses a weighted average of different controls.
10.5 Lagged Dependent Variables
This is a different thing …
See Dafoe (2018) for advice on when to use LDV.
A different model is to assume a lagged dependent variable, \[ Y_{i,t} = \rho Y'_{i,t-1} + X'_{i,t} \beta + \varepsilon_{i,t} \] This captures some of the unit-specific aspects that the fixed effects capture. However, the LDV model is making a different assumption than fixed effects. The FE model assumes that each unit has a separate effect that is constant over time, while the LDV model assumes that anything specific about a unit is captured through the value of the dependent variable in the previous period.
Beck and Katz recommendation of LDV with PCSE.
The LDV and Fixed Effects models make different assumptions, and they are not nested. So why not combine them into a single model? \[ Y_{i,t} = \rho Y'_{i,t-1} + X'_{i,t} \beta + \alpha_i + \varepsilon_{i,t} . \] There is a problem with this approach. OLS is biased. The fixed effect estimator includes demeaned values of the outcome variable and covariates. S the FE model with a LDV will use \(Y_{i,t - 1} - \bar{Y}_{i,t-1}\). This average includes \(Y_{i,t}\) and \(Y_{i,t} = ... + \varepsilon_{i,t}\). T us by construction, \(Y_{i,t} - \bar{Y}_{i,t-1}\) is correlated with the errors.
So what can we do about this? There are two options.
Ignore it. The bias is proportional to \(1/T\). In panels with 20 or more periods, the bias may be small. Moreover, the bias is generally largest in the coefficient of the lagged dependent variable itself, which may not be of primary interest. Accept the bias.
Use both LDV and FE models. The LDV and FE methods can bound the effects of the coefficient of interest. See Angrist and Pischke (2009).
Use IV methods to instrument the lagged dependent variable. See Arrellano-Bond methods.
This is a case where the difference between panel and TSCS is important. In many TSCS settings with larger \(T\) it is probably fine to estimate fixed effects with LDV. However, if you have panel data model with few \(T\), then you should use either method 2 or 3.
10.6 Random Effects
Consider the panel data model, \[ Y_{i,t} = \alpha + X'_{i,t} \beta + u_i + \varepsilon_{i,t} \] In fixed effect, the errors are assumed to be uncorrelated with both the unit effects and the covariates, \[ \E(\varepsilon_{i,t} | X_{i}, u_i) = 0 . \] With random effects we make an additional assumption, the unit effects are uncorrelated with the covariates, \[ \E(u_i | X_i) = \E(u_i) = 0 . \]
What this means that under the assumptions of random effects, omitting \(u_i\) would not bias \(\beta\) since they are assumed to be uncorrelated with \(X\). Thus, there’s no omitted variable bias.
So why use random effects? To fix standard errors. \[ Y_{i,t} = X'_{i,t} \beta + \nu_i \] where \(\nu_i = u_i + \varepsilon_{i,t}\). However, this means that \[ \Cov(Y_{i,1}, Y_{i,2} | X_{i,t}) = \sigma^2_u . \] This violates the OLS assumption of non-autocorrelation. Using random effects gets consistent standard errors.
10.6.1 How to estimate random effects?
There are a variety of methods, but the econometric method is to use quasi-demeaning or partial pooling, \[ (Y_{i,t} - \theta \bar{Y}_i) = (X_{i,t} - \bar{X}_i)' \beta + (\nu_{i,t} - \theta \Var{\nu}_i) \] where \(\theta \in [0, 1]\) where \(\theta = 0\) is OLS, and \(\theta = 1\) is fixed effects. Some math (TM) shows, \[ \theta = 1 - \left( \sigma_u^2 / (\sigma^2_u + T \sigma^2_epsilon) \right)^{1/2} . \] The random effects estimator runs pooled OLS on this model, but replaces \(\theta\) with the estimate \(\hat{\theta}\).
See the R package plm.
The R package lme4 and Bayesian methods, e.g. Gelman and Hill, take a different approach to estimating random effects.
References
Angrist, Joshua D., and Jörn-Steffen Pischke. 2009. Mostly Harmless Econometrics: An Empiricist’s Companion. Pr.
2014. Mastering ‘Metrics. Princeton UP.Angrist, Joshua D., and Jörn-Steffen Pischke. 2009. Mostly Harmless Econometrics: An Empiricist’s Companion. Pr.
Blackwell, Matthew. 2013. “A Framework for Dynamic Causal Inference in Political Science.” American Journal of Political Science 57 (2): 504–20. https://doi.org/10.1111/j.1540-5907.2012.00626.x.
Bertrand, M., E. Duflo, and S. Mullainathan. 2004. “How Much Should We Trust Differences-in-Differences Estimates?” The Quarterly Journal of Economics 119 (1). Oxford University Press (OUP): 249–75. https://doi.org/10.1162/003355304772839588.
Esarey, Justin, and Andrew Menger. 2018. “Practical and Effective Approaches to Dealing with Clustered Data.” Political Science Research and Methods, January. Cambridge University Press (CUP), 1–19. https://doi.org/10.1017/psrm.2017.42.
Athey, Susan, and Guido W. Imbens. 2006. “Identification and Inference in Nonlinear Difference-in-Differences Models.” Econometrica 74 (2). [Wiley, Econometric Society]: 431–97. http://www.jstor.org/stable/3598807.
Dafoe, Allan. 2018. “Nonparametric Identification of Causal Effects Under Temporal Dependence.” Sociological Methods & Research 47 (2): 136–68. https://doi.org/10.1177/0049124115613784.


Git is a version control system
After creating somefile.txt in the project directory:
Use 'git add . ' or 'git add filename'
git commit -m "some description"
VIM editor:
git log after two commits:
git revert
Shortcut: 'git checkout -b branch_name'
git merge branch_name
Delete branch
Hosting services
To create repository press 'new' button, then enter the name of the repository and press 'create'
Clone repository
Pull request
Good luck
Resources to learn Git


Has distributed $1,067,000 in the past nineteen years to parishes across the state to assist in Catholic Education.
The annual Tootsie Roll Program raised over $315,000 last year to help people with mental retardation. Since its beginning in Kansas, this program has distributed $5.8 million to centers across the state, and is the prime sponsor of the Special Olympics Basketball Tournament.
The Pennies from Heaven Program (EDAP) gives immediate financial assistance for clothing, food or shelter to families, regardless of race, creed, or national origin, whose home has been destroyed by fire or other natural disasters. Since inception the program has provided $545,000 for 3,471 claims.
For many years have supported Pro-Life groups in Kansas. Cash and in-kind donations have exceeded $1,441,133 to assist these groups to protect the life of the unborn.
For 46 years the Knights of Columbus has provided financial support for the Newman Centers on college campuses in Kansas in the amount of $ 480,000; has granted $150,300 to the Kansas Catholic Conference; and over $ 109,015 for other charitable endeavors.
Conducts a Statewide Free Throw contest, Vocation poster contest and Alcohol and Drug-Awareness contest for our Youth.
Promotes many other programs in support of the Church, the Family, Youth and local Communities.
Has 260 councils and more than 35,400 members across Kansas.
Through the Adopt-A-Seminarian program councils provide moral and financial support to each of Kansas’ Seminarians. Last year, over $162,000 of financial support was given.
In 1950 erected the Padilla monument near Lyons, KS in honor of Fr. Juan de Padilla, the proto-martyr of the United States and in 2000 established a $ 200,000 Centennial Memorial Fund, earnings from which will be used in perpetuity for religious education in Kansas. To date, $40,000 has been given to the four Kansas dioceses.
© Knights of Columbus - Kansas State Council
For comments or questions please email webmaster@kansas-kofc.org


#include <db_cxx.h>virtual const char * DbException::what() const;
A DbException object contains an informational string and an errno. The errno can be obtained by using DbException::get_errno. The informational string can be obtained by using DbException::what.


Class: Kharon::Handlers::Messages
- Inherits:
-
Object
- Object
- Kharon::Handlers::Messages
- Defined in:
- lib/kharon/handlers/messages.rb
Overview
Errors handler that stores each problem encountered during validation.
Instance Method Summary (collapse)
-
- (Array) errors
Getter for the errors, cloning it so no error can be added from outside of the report_error method.
-
- (Messages) initialize
constructor
Constructor of the class, initializing the errors array.
-
- (Kharon::Handlers::Messages) report_error(error_hash)
Method used to report an error by storing it in an array.
Constructor Details
- (Messages) initialize
Constructor of the class, initializing the errors array.
9 10 11 |
# File 'lib/kharon/handlers/messages.rb', line 9 def initialize @errors = Array.new end |
Instance Method Details
- (Array) errors
Getter for the errors, cloning it so no error can be added from outside of the report_error method
23 24 25 |
# File 'lib/kharon/handlers/messages.rb', line 23 def errors @errors.clone end |
- (Kharon::Handlers::Messages) report_error(error_hash)
Method used to report an error by storing it in an array.
16 17 18 19 |
# File 'lib/kharon/handlers/messages.rb', line 16 def report_error(error_hash) @errors.push(error_hash) self end |


Wetator / Mouse Over
Plain Content
Pferde fressen keinen Gurkensalat.
Font infos in Content
This t
ex
t is
styled
.
Buttons
MouseOver defined on parent
Effect with timeout
Button will go away after 4s.
CSS hover
Hover me


{% extends 'base.html' %} {% block subtitle %} List of Forums {% endblock %} {% block main_content %}
Welcome to the forums for the Educational Assessment BOOC.
Available forums:
There are no forums created yet.


This sample is the finished playground component.
force-app/main/default/lightningcomponents/playground_finished
.force-app/main/default/lightningcomponents/playground_finished/__tests__
.
To create the playground component, start at the
The playground component relies on data from a record in your org. Create a record using the form below.


| DOSE: |
30 mg |
smoked |
DPT |
(freebase) |
Let me start with the freebasing diary as it seem to differ from other freebasing instructions shown here:
DPT freebase preparation
10% ammonia solution (NH4OH) was put into a glass. 0.5g of DPT HCl salt poured into the glass. DPT powder floats on top of the liquid, the solution has propably too high pH for the freebasing process to work. I pour some warm tap water in and soon the DPT salt powder dissolves and turns the liquid muddy light gray. I stir the solution to make sure all DPT has been dissolved. I wait a few minutes and soon a few drops of clear oil is formed on top of the solution. Now I realize I stirred the solution too vigorously, since some part of the oil has been chop up into tiny drops floating around the solution and they are impossible to collect. So I carefully pour the ammonia solution away and keep only the big oil drops in the glass. Then I pour some more warm water in and skim the oil drops away with a spoon. The oil sticks to metal, as has been pointed here before, so this is easy. Finally I impregnate some weak marijuana with the DPT freebase oil.
A few notes: Why is the oil completely clear? With other preparation reports, they claim it should be dark red. However, if I have understood correctly, they have used NaOH solution and not real ammonia solution. Second, I used tap water, which is naturally a bad idea and might affect the colour. The oil works fine though and doesn't give any ammonia odour when smoked, so I presume it is quite good freebase. Next batch I will freebase using distilled water and the same ammonia solution, I will give a report of that too.
Distilled water freebasing was quite identical with the above, except when I managed to get the oil I skimmed it with a steel knife without diluting the ammonia subtance any further. I had to dilute the 10% ammonia solution to more than 10 times in order to make the freebasing process to start at all. The resulting DPT freebase oil was also completely colourless this time. Instead of marijuana, I used some weak damiana mixture as the base smoking material for this oil.
Here is some thoughts of the first taste of this DPT freebased form.
I was at a friends flat. My friend who had also promised to be my sitter. After the bitter experience from 5-meo-DMT without sitter I had decided to use a sitter with every new substance that I was going to take. So there I was. I became rather nervous before the critical moment, as I had the intense 5-meo-DMT memories still fresh and this was about to be only my second type of smokable tryptamine. Music is roaming in the background. I try to empty my mind from disturbing memories and concentrate on this one.
Finally I think I am ready and I put some marijuana-DPT into my bong bowl, approximately including around 15mg of the DPT freebase, and light it. I wonder for a while why it is so difficult to smoke, before I realize I had forgotten the air hole in the bong.  I didn't know what to expect, even though I had read all available reports about this DPT freebase that I could find. This feeling of going into unknown territory is very exciting, but I hoped it would be a bit less exciting now. Now that I remember to plug the air hole smoking is a lot easier and I empty the bowl without much hesitance.
Smoke tastes rather mild. This is the place, where I feel like standing on a doorstep to somewhere. I am full of expectations. I am prepared to take anything that might be coming from this new world. When Columbus was sailing on the pacific ocean before finding the americas, this is how he must have felt like.
My mind gets more relaxed when I realize there is not going to be the incredibly intense rush that the 5-meo-DMT gives. This is going to be a lot smoother start and I am very happy about it. I wait for a couple of minutes and notice some very slight feelings of altered state. I decide this is not high enough so I smoke another 15mg of the marijuana-DPT mixture. The first bowl had made such a big difference to me that I could feel roughly how it had affected and where this was going to. I didn't have the excitedness of the unknown with me anymore, because I already saw a glimpse of this new world ahead of me.
T+3min Now I begin to feel the onset a lot more. My pulse has risen moderately and I start to see mild visuals. My friend has a carpet with coloured stripes on it, a very typical, propably homemade, carpet in Finland. The colours on stripes get clear and they look as if they were in an oil painting. The stripes start slowly spilling to the floor. I glance the ceiling and I see now the ceiling pattern flowing like a thick liquid. This visual distortion has become very familiar to me on my trips and it is always one of the first signs to me that I am entering a psychedelic state.
Onset is very comfortable and smooth, it almost sneaks in and before I even realize I am very high. Shpongle is playing in the background, but not loud enough for me to dive into the music completely. Smile is creeping on my face. Even though this is the first time I take this particular substance I already feel like coming home. I have been here before, definitely. This is the place where I can get lost in my thoughts, dive into music and see the world anew. It feels so good to be here again.
T+5min No body buzz at all and somehow very neutral in all other ways too, but definitely I am already very high travelling through psychedelic areas. Time dilation is getting very noticable. My sitter takes a hit of this DPT-marijuana as well, I have lost the track of time almost completely. My thoughts and conversations with the sitter create interesting patterns too.
T+10min (?) The sitters girlfriend comes home. She eats some orange and offers me a slice too. It tastes good. This high is very cannabis-like for me. Perhaps the weak marijuana where DPT was in, affects this high somewhat. The marijuana high is very strong though, so if this stone comes from the weak marijuana, the DPT must potentiate the effects quite considerably.
I conclude this is a very good substance and I have a constant feeling that I might give this impression out aloud too many times. The sitter and his girlfriend are quite experienced, so even though I feel repetitious I give myself the freedom to express my feelings aloud.
T+15min (?) I feel that I have sat there on my friends purple mattress talking this and that with him and his girlfriend for several hours, though quick check on my watch assures me it has been only for a couple of minutes. Conversation is easy and nice. I see our discussion going in patterns around my head. It feels like a slowly moving recursion drifting through all of us three.
The time dilation makes me worry about getting home in time. I tend to check my watch and tell others that I should leave soon every 3 minutes. Internally, of course, I feel that I have been there till late evening and that I am already late. This constant worrying about getting home in time, when there are still well over an hour for the train I promised my wife to catch, seem very amusing to her.
T+30min (?) I feel coming down. The psychedelic effects are waning slowly, but marijuana effects are still lingering strong. My sitter and his friend drive me to town with a van. This apparently quite conservative drive feels very exciting and fast to me.
[Erowid Note: Driving while intoxicated or tripping is dangerous and irresponsible because it endangers other people. Don't do it!]
T+45min I take a bus back home. Bus ride is full of thoughts and beautiful sunset.
T+1:15 I am home and psychedelic effects are completely gone now. Some slight stoned feeling is still left, but it vanishes within an hour. Sleep is fine and everything seems good that evening.
All in all, very positive, interesting and mentally rewarding trip. This immediately became one of my favourite psychedelics. I will take it another time as well, perhaps changing the marijuana to some other non-active smoking material so I could see how much it affects the trip. DPT freebase has the benefit of having a short duration time, easy onset and being smokable, the dose is rather easy to control.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Virtualization is the process of running a virtual instance of a computer system in a layer abstracted from the actual hardware. Most commonly, it refers to running multiple operating systems on a computer system...
Read More...Containerization is an application or system distribution method that isolates the application or system and its dependencies from the underlying infrastructure. It is an OS-level virtualization that allows users to deploy...
Read More...If you’re looking to improve scalability, reduce overhead costs, and standardize software deployments across multiple machines and platforms, containers and virtual machines (VMs) are two of the top approaches in use...
Read More...Before setting up a server we must know the real meaning or definition of a server. So, the Server is a program that provides the client with any kind of services. For example, a web server provides our websites....
Read More...When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that...
Read More...Basic requirement is we must have docker installed and running as well as Pycharm installed. For more information see To operate with Docker you need the busybox image be available on your machine...
Read More...


OpenSeesPy Grillage wizard - ospgrillage¶
ospgrillage is a python wrapper of the OpenSeesPy package to speed up the creation of bridge deck grillage models. OpenSeesPy is a python interpreter of the well-know Open System for Earthquake Engineering Simulation (OpenSees) software framework. ospgrillage provides a simple python API which allows users to:
Quickly generate and analyze a bridge deck grillage model in the OpenSeesPy model space, including many forms of loading and load cases;
Export a
*.py
file containing the OpenSeesPy commands, which on execution, creates the prescribed OpenSeesPy grillage model.
The ability to use ospgrillage directly to do bridge deck analysis, or to export the OpenSeesPy command file for further editing, facilities an enormous range of use-cases in both bridge engineering practice and research.
Documentation¶
Support¶
For technical support, please raise an issue at the Github repository
Contributing¶
We really value and welcome contributions to the ospgrillage package. Please check out our contributing guidelines.
Credits¶
Mayer Melhem for producing the documentation illustrations and the design of the ospgrillage logo.


Password Generator
Generate a Password
Length (8 to 128 characters):
Character Types:
Lowercase
Uppercase
Numeric
Special
Submit


Welcome
My name is Melanie Book, and I have an affinity for great design and functional user experience. Combining these two has allowed me to act as a key contributor to the front end development of several projects. Below you will find a few examples of my work. Thank you for stopping by!


Mason Rudolph Officially Responds To Myles Garrett’s Allegation
by Matt HladikMason Rudolph and the Steelers will face the Cleveland Browns next weekend. It remains to be seen if Rudolph will start after he was benched earlier today, but he’ll be in uniform.
Myles Garrett will not. The Browns defensive end has been suspended indefinitely by the NFL after he swung Rudolph’s own helmet at the QB during an altercation in a game 10 days ago.
During Garrett’s appeal hearing with the NFL this past week, he alleged that Rudolph provoked his actions by calling Garrett a racial slur. Rudolph and his agent vehemently denied the claim.
Ultimately, the NFL said they could not determine that a slur was said. After today’s game, Rudolph was asked to comment on the accusation on the record for the first time.
Not surprisingly, he said Garrett was lying.
At this point, it doesn’t look like there is any definitive proof regarding what was and wasn’t said on the field in Cleveland that night. Garrett doubled down on his version of the story a couple of days ago.
Rudolph did the same today, and whoever is lying, they aren’t going to admit their untruthfulness any time soon.


Domino Design Code Injection
In an earlier entry I discussed how to maintain custom system databases. It works well when you add design elements or change them wholesale. However it doesn't work very well when you tweak design elements. Something like: adding one action in a form or using a different subform for a specific task. Once an updated system template is available, you have to go back and recreate all your changes in your template.
This entry discusses how to automate these little fixes. There are a number of moving parts involved:
Some simple examples:
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
Now we need a pice of code that can do the transformation of the DXL. Unfortunately the LotusScript XML Parser is lacking, so we use some Java code to perform this step. After creating the class (without parameters, for LS2J comfort, we need to set the DXL as Document and then call injectCode with 3 parameters: xPath expression, codeSnippet to insert (must be an XML fragment) and insertion type (before/after/replace). See Part 2 for the Java code.
This entry discusses how to automate these little fixes. There are a number of moving parts involved:
- Export the design element using DXL. (You might need to set NotesDXLExporter.RichTextOption = RICHTEXTOPTION_RAW to make sure the fidelity of forms is maintained)
- Locate the entry/replace point. The best mechanism for that is XPath
- Locate the new code. This could be as easy as provide a string with the XML Snippet to pointing to an existing design element elsewhere. (We would use XPath again)
- Perform the insertion/replacement. We will have the option: before/after/replace
- Write back your changes and test it
- Add an action to a form/view
- Add a subform to a form
- Replace a validation formula in a field
- Insert a script library and a custom class into a form
- Add a field at the top or bottom of a form (our favorite hidden fields $$Return anyone
Some simple examples:
- * selects ANY element.
- / selects the root element, basically before any tags in the XML
- /database/form/actionbar selects the actionbar elements in all forms in our XML
- /database/form[1]/actionbar selects the actionbar element in the first form in our XML
- /database/form[@name='Message']/actionbar selects the actionbar element in the form Message in our XML
- /database/form[@name='Message'] //field[@name='Subject'] /code[@event='defaultvalue'] /formula Select the default value formula for the field "Subject". Please note the double slashes in front of the field. They are intentional. One slash says: a child, two slashes says any decendant down the document. Also: no spaces before/after the slashes. They are here for readablitity only.
- //field[code/@event='inputvalidation'] Any field that has an input validation formula
Sub InjectCodeIntoForm (formName As String , xPath As String , codeSnippet As String ) 'Errorhandling omitted for clarity Dim s As New NotesSession Dim db As NotesDatabase Dim f As NotesForm Dim out As NotesStream Dim ex As NotesDXLExporter Dim importer As NotesDXLImporter Dim col As NotesNoteCollection 'The strings holding the DXL Dim rawDXL As String Dim resultDXL As String Set db = s .CurrentDatabase 'Create a Note collection and add the form Set col = db .CreateNoteCollection ( False ) Set f = db .GetForm (formName ) col .BuildCollection Call col .Add (f ) 'Create the exporter and run the stuff out Set ex = s .CreateDXLExporter Set out = s .CreateStream ex .RichTextOption = RICHTEXTOPTION_RAW 'This is to get rawitems for untranslatable stuff ex .ValidationStyle = VALIDATIONSTYLE_NONE 'To make sure we don't generate a schema reference Call ex .setinput (col ) Call ex .setOutput (out ) ex .process 'Reset the stream and manipulate the DXL out .Position = 0 rawDXL = out .ReadText resultDXL = injectCode (rawDXL , xPath , codeSnippet ) 'Write it back out .Truncate Call out .WriteText (resultDXL ) out .Position = 0 Set importer = s .CreateDXLImporter 'Having the right importer options is important importer .CompileLotusScript = True importer .ReplaceDBProperties = False importer .ReplicaRequiredForReplaceOrUpdate = True importer .ACLImportOption = DXLIMPORTOPTION_IGNORE importer .DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE 'We only want to update the current form importer .DocumentImportOption = DXLIMPORTOPTION_IGNORE 'This is for design only importer .ExitOnFirstFatalError = False 'Standard import execution Call importer .setInput (out ) Call importer .setOutput (db ) On Error Resume Next Call importer .Import Msgbox importer . log End Sub
provided by Julian Robichaux at nsftools.com.
Posted by Stephan H Wissel on 21 March 2008 | Comments (2) | categories: Show-N-Tell Thursday