| 1 | /* =========================================================== | |
| 2 | * JFreeChart : a free chart library for the Java(tm) platform | |
| 3 | * =========================================================== | |
| 4 | * | |
| 5 | * (C) Copyright 2000-2009, by Object Refinery Limited and Contributors. | |
| 6 | * | |
| 7 | * Project Info: http://www.jfree.org/jfreechart/index.html | |
| 8 | * | |
| 9 | * This library is free software; you can redistribute it and/or modify it | |
| 10 | * under the terms of the GNU Lesser General Public License as published by | |
| 11 | * the Free Software Foundation; either version 2.1 of the License, or | |
| 12 | * (at your option) any later version. | |
| 13 | * | |
| 14 | * This library is distributed in the hope that it will be useful, but | |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
| 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | |
| 17 | * License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU Lesser General Public | |
| 20 | * License along with this library; if not, write to the Free Software | |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | |
| 22 | * USA. | |
| 23 | * | |
| 24 | * [Java is a trademark or registered trademark of Sun Microsystems, Inc. | |
| 25 | * in the United States and other countries.] | |
| 26 | * | |
| 27 | * -------------------- | |
| 28 | * HighLowRenderer.java | |
| 29 | * -------------------- | |
| 30 | * (C) Copyright 2001-2009, by Object Refinery Limited. | |
| 31 | * | |
| 32 | * Original Author: David Gilbert (for Object Refinery Limited); | |
| 33 | * Contributor(s): Richard Atkinson; | |
| 34 | * Christian W. Zuckschwerdt; | |
| 35 | * | |
| 36 | * Changes | |
| 37 | * ------- | |
| 38 | * 13-Dec-2001 : Version 1 (DG); | |
| 39 | * 23-Jan-2002 : Added DrawInfo parameter to drawItem() method (DG); | |
| 40 | * 28-Mar-2002 : Added a property change listener mechanism so that renderers | |
| 41 | * no longer need to be immutable (DG); | |
| 42 | * 09-Apr-2002 : Removed translatedRangeZero from the drawItem() method, and | |
| 43 | * changed the return type of the drawItem method to void, | |
| 44 | * reflecting a change in the XYItemRenderer interface. Added | |
| 45 | * tooltip code to drawItem() method (DG); | |
| 46 | * 05-Aug-2002 : Small modification to drawItem method to support URLs for | |
| 47 | * HTML image maps (RA); | |
| 48 | * 25-Mar-2003 : Implemented Serializable (DG); | |
| 49 | * 01-May-2003 : Modified drawItem() method signature (DG); | |
| 50 | * 30-Jul-2003 : Modified entity constructor (CZ); | |
| 51 | * 31-Jul-2003 : Deprecated constructor (DG); | |
| 52 | * 20-Aug-2003 : Implemented Cloneable and PublicCloneable (DG); | |
| 53 | * 16-Sep-2003 : Changed ChartRenderingInfo --> PlotRenderingInfo (DG); | |
| 54 | * 29-Jan-2004 : Fixed bug (882392) when rendering with | |
| 55 | * PlotOrientation.HORIZONTAL (DG); | |
| 56 | * 25-Feb-2004 : Replaced CrosshairInfo with CrosshairState. Renamed | |
| 57 | * XYToolTipGenerator --> XYItemLabelGenerator (DG); | |
| 58 | * 15-Jul-2004 : Switched getX() with getXValue() and getY() with | |
| 59 | * getYValue() (DG); | |
| 60 | * 01-Nov-2005 : Added optional openTickPaint and closeTickPaint settings (DG); | |
| 61 | * ------------- JFREECHART 1.0.0 --------------------------------------------- | |
| 62 | * 06-Jul-2006 : Replace dataset methods getX() --> getXValue() (DG); | |
| 63 | * 20-Jun-2007 : Removed JCommon dependencies (DG); | |
| 64 | * 27-Jun-2007 : Updated drawItem() to use addEntity() (DG); | |
| 65 | * 08-Apr-2008 : Added findRangeBounds() override (DG); | |
| 66 | * 29-Apr-2008 : Added tickLength field (DG); | |
| 67 | * 25-Sep-2008 : Check for non-null entity collection (DG); | |
| 68 | * | |
| 69 | */ | |
| 70 | ||
| 71 | package org.jfree.chart.renderer.xy; | |
| 72 | ||
| 73 | import java.awt.Graphics2D; | |
| 74 | import java.awt.Paint; | |
| 75 | import java.awt.Shape; | |
| 76 | import java.awt.Stroke; | |
| 77 | import java.awt.geom.Line2D; | |
| 78 | import java.awt.geom.Rectangle2D; | |
| 79 | import java.io.IOException; | |
| 80 | import java.io.ObjectInputStream; | |
| 81 | import java.io.ObjectOutputStream; | |
| 82 | import java.io.Serializable; | |
| 83 | ||
| 84 | import org.jfree.chart.axis.ValueAxis; | |
| 85 | import org.jfree.chart.entity.EntityCollection; | |
| 86 | import org.jfree.chart.event.RendererChangeEvent; | |
| 87 | import org.jfree.chart.plot.CrosshairState; | |
| 88 | import org.jfree.chart.plot.PlotOrientation; | |
| 89 | import org.jfree.chart.plot.PlotRenderingInfo; | |
| 90 | import org.jfree.chart.plot.XYPlot; | |
| 91 | import org.jfree.chart.util.PaintUtilities; | |
| 92 | import org.jfree.chart.util.PublicCloneable; | |
| 93 | import org.jfree.chart.util.RectangleEdge; | |
| 94 | import org.jfree.chart.util.SerialUtilities; | |
| 95 | import org.jfree.data.Range; | |
| 96 | import org.jfree.data.general.DatasetUtilities; | |
| 97 | import org.jfree.data.xy.OHLCDataset; | |
| 98 | import org.jfree.data.xy.XYDataset; | |
| 99 | ||
| 100 | /** | |
| 101 | * A renderer that draws high/low/open/close markers on an {@link XYPlot} | |
| 102 | * (requires a {@link OHLCDataset}). This renderer does not include code to | |
| 103 | * calculate the crosshair point for the plot. The example shown here is | |
| 104 | * generated by the HighLowChartDemo1.java program included in the | |
| 105 | * JFreeChart demo collection: | |
| 106 | *

 | |
| 107 | *  | |
| 109 | */ | |
| 110 | public class HighLowRenderer extends AbstractXYItemRenderer | |
| 111 | implements XYItemRenderer, Cloneable, PublicCloneable, Serializable { | |
| 112 | ||
| 113 | /** For serialization. */ | |
| 114 | private static final long serialVersionUID = -8135673815876552516L; | |
| 115 | ||
| 116 | /** A flag that controls whether the open ticks are drawn. */ | |
| 117 | private boolean drawOpenTicks; | |
| 118 | ||
| 119 | /** A flag that controls whether the close ticks are drawn. */ | |
| 120 | private boolean drawCloseTicks; | |
| 121 | ||
| 122 | /** | |
| 123 | * The paint used for the open ticks (if null, the series | |
| 124 | * paint is used instead). | |
| 125 | */ | |
| 126 | private transient Paint openTickPaint; | |
| 127 | ||
| 128 | /** | |
| 129 | * The paint used for the close ticks (if null, the series | |
| 130 | * paint is used instead). | |
| 131 | */ | |
| 132 | private transient Paint closeTickPaint; | |
| 133 | ||
| 134 | /** | |
| 135 | * The tick length (in Java2D units). | |
| 136 | * | |
| 137 | * @since 1.0.10 | |
| 138 | */ | |
| 139 | private double tickLength; | |
| 140 | ||
| 141 | /** | |
| 142 | * The default constructor. | |
| 143 | */ | |
| 144 | public HighLowRenderer() { | |
| 145 | super(); | |
| 146 | this.drawOpenTicks = true; | |
| 147 | this.drawCloseTicks = true; | |
| 148 | this.tickLength = 2.0; | |
| 149 | } | |
| 150 | ||
| 151 | /** | |
| 152 | * Returns the flag that controls whether open ticks are drawn. | |
| 153 | * | |
| 154 | * @return A boolean. | |
| 155 | * | |
| 156 | * @see #getDrawCloseTicks() | |
| 157 | * @see #setDrawOpenTicks(boolean) | |
| 158 | */ | |
| 159 | public boolean getDrawOpenTicks() { | |
| 160 |
1
1. getDrawOpenTicks : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return this.drawOpenTicks; |
| 161 | } | |
| 162 | ||
| 163 | /** | |
| 164 | * Sets the flag that controls whether open ticks are drawn, and sends a | |
| 165 | * {@link RendererChangeEvent} to all registered listeners. | |
| 166 | * | |
| 167 | * @param draw the flag. | |
| 168 | * | |
| 169 | * @see #getDrawOpenTicks() | |
| 170 | */ | |
| 171 | public void setDrawOpenTicks(boolean draw) { | |
| 172 | this.drawOpenTicks = draw; | |
| 173 |
1
1. setDrawOpenTicks : removed call to org/jfree/chart/renderer/xy/HighLowRenderer::fireChangeEvent → SURVIVED |
fireChangeEvent(); |
| 174 | } | |
| 175 | ||
| 176 | /** | |
| 177 | * Returns the flag that controls whether close ticks are drawn. | |
| 178 | * | |
| 179 | * @return A boolean. | |
| 180 | * | |
| 181 | * @see #getDrawOpenTicks() | |
| 182 | * @see #setDrawCloseTicks(boolean) | |
| 183 | */ | |
| 184 | public boolean getDrawCloseTicks() { | |
| 185 |
1
1. getDrawCloseTicks : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return this.drawCloseTicks; |
| 186 | } | |
| 187 | ||
| 188 | /** | |
| 189 | * Sets the flag that controls whether close ticks are drawn, and sends a | |
| 190 | * {@link RendererChangeEvent} to all registered listeners. | |
| 191 | * | |
| 192 | * @param draw the flag. | |
| 193 | * | |
| 194 | * @see #getDrawCloseTicks() | |
| 195 | */ | |
| 196 | public void setDrawCloseTicks(boolean draw) { | |
| 197 | this.drawCloseTicks = draw; | |
| 198 |
1
1. setDrawCloseTicks : removed call to org/jfree/chart/renderer/xy/HighLowRenderer::fireChangeEvent → SURVIVED |
fireChangeEvent(); |
| 199 | } | |
| 200 | ||
| 201 | /** | |
| 202 | * Returns the paint used to draw the ticks for the open values. | |
| 203 | * | |
| 204 | * @return The paint used to draw the ticks for the open values (possibly | |
| 205 | * null). | |
| 206 | * | |
| 207 | * @see #setOpenTickPaint(Paint) | |
| 208 | */ | |
| 209 | public Paint getOpenTickPaint() { | |
| 210 |
1
1. getOpenTickPaint : mutated return of Object value for org/jfree/chart/renderer/xy/HighLowRenderer::getOpenTickPaint to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this.openTickPaint; |
| 211 | } | |
| 212 | ||
| 213 | /** | |
| 214 | * Sets the paint used to draw the ticks for the open values and sends a | |
| 215 | * {@link RendererChangeEvent} to all registered listeners. If you set | |
| 216 | * this to null (the default), the series paint is used | |
| 217 | * instead. | |
| 218 | * | |
| 219 | * @param paint the paint (null permitted). | |
| 220 | * | |
| 221 | * @see #getOpenTickPaint() | |
| 222 | */ | |
| 223 | public void setOpenTickPaint(Paint paint) { | |
| 224 | this.openTickPaint = paint; | |
| 225 |
1
1. setOpenTickPaint : removed call to org/jfree/chart/renderer/xy/HighLowRenderer::fireChangeEvent → SURVIVED |
fireChangeEvent(); |
| 226 | } | |
| 227 | ||
| 228 | /** | |
| 229 | * Returns the paint used to draw the ticks for the close values. | |
| 230 | * | |
| 231 | * @return The paint used to draw the ticks for the close values (possibly | |
| 232 | * null). | |
| 233 | * | |
| 234 | * @see #setCloseTickPaint(Paint) | |
| 235 | */ | |
| 236 | public Paint getCloseTickPaint() { | |
| 237 |
1
1. getCloseTickPaint : mutated return of Object value for org/jfree/chart/renderer/xy/HighLowRenderer::getCloseTickPaint to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this.closeTickPaint; |
| 238 | } | |
| 239 | ||
| 240 | /** | |
| 241 | * Sets the paint used to draw the ticks for the close values and sends a | |
| 242 | * {@link RendererChangeEvent} to all registered listeners. If you set | |
| 243 | * this to null (the default), the series paint is used | |
| 244 | * instead. | |
| 245 | * | |
| 246 | * @param paint the paint (null permitted). | |
| 247 | * | |
| 248 | * @see #getCloseTickPaint() | |
| 249 | */ | |
| 250 | public void setCloseTickPaint(Paint paint) { | |
| 251 | this.closeTickPaint = paint; | |
| 252 |
1
1. setCloseTickPaint : removed call to org/jfree/chart/renderer/xy/HighLowRenderer::fireChangeEvent → SURVIVED |
fireChangeEvent(); |
| 253 | } | |
| 254 | ||
| 255 | /** | |
| 256 | * Returns the tick length (in Java2D units). | |
| 257 | * | |
| 258 | * @return The tick length. | |
| 259 | * | |
| 260 | * @since 1.0.10 | |
| 261 | * | |
| 262 | * @see #setTickLength(double) | |
| 263 | */ | |
| 264 | public double getTickLength() { | |
| 265 |
1
1. getTickLength : replaced return of double value with -(x + 1) for org/jfree/chart/renderer/xy/HighLowRenderer::getTickLength → NO_COVERAGE |
return this.tickLength; |
| 266 | } | |
| 267 | ||
| 268 | /** | |
| 269 | * Sets the tick length (in Java2D units) and sends a | |
| 270 | * {@link RendererChangeEvent} to all registered listeners. | |
| 271 | * | |
| 272 | * @param length the length. | |
| 273 | * | |
| 274 | * @since 1.0.10 | |
| 275 | * | |
| 276 | * @see #getTickLength() | |
| 277 | */ | |
| 278 | public void setTickLength(double length) { | |
| 279 | this.tickLength = length; | |
| 280 |
1
1. setTickLength : removed call to org/jfree/chart/renderer/xy/HighLowRenderer::fireChangeEvent → SURVIVED |
fireChangeEvent(); |
| 281 | } | |
| 282 | ||
| 283 | /** | |
| 284 | * Returns the range of values the renderer requires to display all the | |
| 285 | * items from the specified dataset. | |
| 286 | * | |
| 287 | * @param dataset the dataset (null permitted). | |
| 288 | * | |
| 289 | * @return The range (null if the dataset is null | |
| 290 | * or empty). | |
| 291 | */ | |
| 292 | public Range findRangeBounds(XYDataset dataset) { | |
| 293 |
1
1. findRangeBounds : negated conditional → KILLED |
if (dataset != null) { |
| 294 |
1
1. findRangeBounds : mutated return of Object value for org/jfree/chart/renderer/xy/HighLowRenderer::findRangeBounds to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return DatasetUtilities.findRangeBounds(dataset, true); |
| 295 | } | |
| 296 | else { | |
| 297 |
1
1. findRangeBounds : mutated return of Object value for org/jfree/chart/renderer/xy/HighLowRenderer::findRangeBounds to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return null; |
| 298 | } | |
| 299 | } | |
| 300 | ||
| 301 | /** | |
| 302 | * Draws the visual representation of a single data item. | |
| 303 | * | |
| 304 | * @param g2 the graphics device. | |
| 305 | * @param state the renderer state. | |
| 306 | * @param dataArea the area within which the plot is being drawn. | |
| 307 | * @param plot the plot (can be used to obtain standard color | |
| 308 | * information etc). | |
| 309 | * @param domainAxis the domain axis. | |
| 310 | * @param rangeAxis the range axis. | |
| 311 | * @param dataset the dataset. | |
| 312 | * @param series the series index (zero-based). | |
| 313 | * @param item the item index (zero-based). | |
| 314 | * @param pass the pass index. | |
| 315 | */ | |
| 316 | public void drawItem(Graphics2D g2, XYItemRendererState state, | |
| 317 | Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis, | |
| 318 | ValueAxis rangeAxis, XYDataset dataset, int series, int item, | |
| 319 | boolean selected, int pass) { | |
| 320 | ||
| 321 | double x = dataset.getXValue(series, item); | |
| 322 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (!domainAxis.getRange().contains(x)) { |
| 323 | return; // the x value is not within the axis range | |
| 324 | } | |
| 325 | double xx = domainAxis.valueToJava2D(x, dataArea, | |
| 326 | plot.getDomainAxisEdge()); | |
| 327 | ||
| 328 | // setup for collecting optional entity info... | |
| 329 | Shape entityArea = null; | |
| 330 | EntityCollection entities = null; | |
| 331 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (state.getInfo() != null) { |
| 332 | entities = state.getInfo().getOwner().getEntityCollection(); | |
| 333 | } | |
| 334 | ||
| 335 | PlotOrientation orientation = plot.getOrientation(); | |
| 336 | RectangleEdge location = plot.getRangeAxisEdge(); | |
| 337 | ||
| 338 | Paint itemPaint = getItemPaint(series, item, selected); | |
| 339 | Stroke itemStroke = getItemStroke(series, item, selected); | |
| 340 |
1
1. drawItem : removed call to java/awt/Graphics2D::setPaint → NO_COVERAGE |
g2.setPaint(itemPaint); |
| 341 |
1
1. drawItem : removed call to java/awt/Graphics2D::setStroke → NO_COVERAGE |
g2.setStroke(itemStroke); |
| 342 | ||
| 343 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (dataset instanceof OHLCDataset) { |
| 344 | OHLCDataset hld = (OHLCDataset) dataset; | |
| 345 | ||
| 346 | double yHigh = hld.getHighValue(series, item); | |
| 347 | double yLow = hld.getLowValue(series, item); | |
| 348 |
2
1. drawItem : negated conditional → NO_COVERAGE 2. drawItem : negated conditional → NO_COVERAGE |
if (!Double.isNaN(yHigh) && !Double.isNaN(yLow)) { |
| 349 | double yyHigh = rangeAxis.valueToJava2D(yHigh, dataArea, | |
| 350 | location); | |
| 351 | double yyLow = rangeAxis.valueToJava2D(yLow, dataArea, | |
| 352 | location); | |
| 353 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (orientation == PlotOrientation.HORIZONTAL) { |
| 354 |
1
1. drawItem : removed call to java/awt/Graphics2D::draw → NO_COVERAGE |
g2.draw(new Line2D.Double(yyLow, xx, yyHigh, xx)); |
| 355 |
2
1. drawItem : Replaced double subtraction with addition → NO_COVERAGE 2. drawItem : Replaced double subtraction with addition → NO_COVERAGE |
entityArea = new Rectangle2D.Double(Math.min(yyLow, yyHigh), |
| 356 | xx - 1.0, Math.abs(yyHigh - yyLow), 2.0); | |
| 357 | } | |
| 358 |
1
1. drawItem : negated conditional → NO_COVERAGE |
else if (orientation == PlotOrientation.VERTICAL) { |
| 359 |
1
1. drawItem : removed call to java/awt/Graphics2D::draw → NO_COVERAGE |
g2.draw(new Line2D.Double(xx, yyLow, xx, yyHigh)); |
| 360 |
2
1. drawItem : Replaced double subtraction with addition → NO_COVERAGE 2. drawItem : Replaced double subtraction with addition → NO_COVERAGE |
entityArea = new Rectangle2D.Double(xx - 1.0, |
| 361 | Math.min(yyLow, yyHigh), 2.0, | |
| 362 | Math.abs(yyHigh - yyLow)); | |
| 363 | } | |
| 364 | } | |
| 365 | ||
| 366 | double delta = getTickLength(); | |
| 367 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (domainAxis.isInverted()) { |
| 368 |
1
1. drawItem : removed negation → NO_COVERAGE |
delta = -delta; |
| 369 | } | |
| 370 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (getDrawOpenTicks()) { |
| 371 | double yOpen = hld.getOpenValue(series, item); | |
| 372 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (!Double.isNaN(yOpen)) { |
| 373 | double yyOpen = rangeAxis.valueToJava2D(yOpen, dataArea, | |
| 374 | location); | |
| 375 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (this.openTickPaint != null) { |
| 376 |
1
1. drawItem : removed call to java/awt/Graphics2D::setPaint → NO_COVERAGE |
g2.setPaint(this.openTickPaint); |
| 377 | } | |
| 378 | else { | |
| 379 |
1
1. drawItem : removed call to java/awt/Graphics2D::setPaint → NO_COVERAGE |
g2.setPaint(itemPaint); |
| 380 | } | |
| 381 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (orientation == PlotOrientation.HORIZONTAL) { |
| 382 |
2
1. drawItem : Replaced double addition with subtraction → NO_COVERAGE 2. drawItem : removed call to java/awt/Graphics2D::draw → NO_COVERAGE |
g2.draw(new Line2D.Double(yyOpen, xx + delta, yyOpen, |
| 383 | xx)); | |
| 384 | } | |
| 385 |
1
1. drawItem : negated conditional → NO_COVERAGE |
else if (orientation == PlotOrientation.VERTICAL) { |
| 386 |
2
1. drawItem : Replaced double subtraction with addition → NO_COVERAGE 2. drawItem : removed call to java/awt/Graphics2D::draw → NO_COVERAGE |
g2.draw(new Line2D.Double(xx - delta, yyOpen, xx, |
| 387 | yyOpen)); | |
| 388 | } | |
| 389 | } | |
| 390 | } | |
| 391 | ||
| 392 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (getDrawCloseTicks()) { |
| 393 | double yClose = hld.getCloseValue(series, item); | |
| 394 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (!Double.isNaN(yClose)) { |
| 395 | double yyClose = rangeAxis.valueToJava2D( | |
| 396 | yClose, dataArea, location); | |
| 397 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (this.closeTickPaint != null) { |
| 398 |
1
1. drawItem : removed call to java/awt/Graphics2D::setPaint → NO_COVERAGE |
g2.setPaint(this.closeTickPaint); |
| 399 | } | |
| 400 | else { | |
| 401 |
1
1. drawItem : removed call to java/awt/Graphics2D::setPaint → NO_COVERAGE |
g2.setPaint(itemPaint); |
| 402 | } | |
| 403 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (orientation == PlotOrientation.HORIZONTAL) { |
| 404 |
2
1. drawItem : Replaced double subtraction with addition → NO_COVERAGE 2. drawItem : removed call to java/awt/Graphics2D::draw → NO_COVERAGE |
g2.draw(new Line2D.Double(yyClose, xx, yyClose, |
| 405 | xx - delta)); | |
| 406 | } | |
| 407 |
1
1. drawItem : negated conditional → NO_COVERAGE |
else if (orientation == PlotOrientation.VERTICAL) { |
| 408 |
2
1. drawItem : Replaced double addition with subtraction → NO_COVERAGE 2. drawItem : removed call to java/awt/Graphics2D::draw → NO_COVERAGE |
g2.draw(new Line2D.Double(xx, yyClose, xx + delta, |
| 409 | yyClose)); | |
| 410 | } | |
| 411 | } | |
| 412 | } | |
| 413 | ||
| 414 | } | |
| 415 | else { | |
| 416 | // not a HighLowDataset, so just draw a line connecting this point | |
| 417 | // with the previous point... | |
| 418 |
2
1. drawItem : changed conditional boundary → NO_COVERAGE 2. drawItem : negated conditional → NO_COVERAGE |
if (item > 0) { |
| 419 |
1
1. drawItem : Replaced integer subtraction with addition → NO_COVERAGE |
double x0 = dataset.getXValue(series, item - 1); |
| 420 |
1
1. drawItem : Replaced integer subtraction with addition → NO_COVERAGE |
double y0 = dataset.getYValue(series, item - 1); |
| 421 | double y = dataset.getYValue(series, item); | |
| 422 |
3
1. drawItem : negated conditional → NO_COVERAGE 2. drawItem : negated conditional → NO_COVERAGE 3. drawItem : negated conditional → NO_COVERAGE |
if (Double.isNaN(x0) || Double.isNaN(y0) || Double.isNaN(y)) { |
| 423 | return; | |
| 424 | } | |
| 425 | double xx0 = domainAxis.valueToJava2D(x0, dataArea, | |
| 426 | plot.getDomainAxisEdge()); | |
| 427 | double yy0 = rangeAxis.valueToJava2D(y0, dataArea, location); | |
| 428 | double yy = rangeAxis.valueToJava2D(y, dataArea, location); | |
| 429 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (orientation == PlotOrientation.HORIZONTAL) { |
| 430 |
1
1. drawItem : removed call to java/awt/Graphics2D::draw → NO_COVERAGE |
g2.draw(new Line2D.Double(yy0, xx0, yy, xx)); |
| 431 | } | |
| 432 |
1
1. drawItem : negated conditional → NO_COVERAGE |
else if (orientation == PlotOrientation.VERTICAL) { |
| 433 |
1
1. drawItem : removed call to java/awt/Graphics2D::draw → NO_COVERAGE |
g2.draw(new Line2D.Double(xx0, yy0, xx, yy)); |
| 434 | } | |
| 435 | } | |
| 436 | } | |
| 437 | ||
| 438 |
1
1. drawItem : negated conditional → NO_COVERAGE |
if (entities != null) { |
| 439 |
1
1. drawItem : removed call to org/jfree/chart/renderer/xy/HighLowRenderer::addEntity → NO_COVERAGE |
addEntity(entities, entityArea, dataset, series, item, selected, |
| 440 | 0.0, 0.0); | |
| 441 | } | |
| 442 | ||
| 443 | } | |
| 444 | ||
| 445 | /** | |
| 446 | * Returns a clone of the renderer. | |
| 447 | * | |
| 448 | * @return A clone. | |
| 449 | * | |
| 450 | * @throws CloneNotSupportedException if the renderer cannot be cloned. | |
| 451 | */ | |
| 452 | public Object clone() throws CloneNotSupportedException { | |
| 453 |
1
1. clone : mutated return of Object value for org/jfree/chart/renderer/xy/HighLowRenderer::clone to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return super.clone(); |
| 454 | } | |
| 455 | ||
| 456 | /** | |
| 457 | * Tests this renderer for equality with an arbitrary object. | |
| 458 | * | |
| 459 | * @param obj the object (null permitted). | |
| 460 | * | |
| 461 | * @return A boolean. | |
| 462 | */ | |
| 463 | public boolean equals(Object obj) { | |
| 464 |
1
1. equals : negated conditional → KILLED |
if (this == obj) { |
| 465 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
| 466 | } | |
| 467 |
1
1. equals : negated conditional → KILLED |
if (!(obj instanceof HighLowRenderer)) { |
| 468 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
| 469 | } | |
| 470 | HighLowRenderer that = (HighLowRenderer) obj; | |
| 471 |
1
1. equals : negated conditional → KILLED |
if (this.drawOpenTicks != that.drawOpenTicks) { |
| 472 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED |
return false; |
| 473 | } | |
| 474 |
1
1. equals : negated conditional → KILLED |
if (this.drawCloseTicks != that.drawCloseTicks) { |
| 475 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED |
return false; |
| 476 | } | |
| 477 |
1
1. equals : negated conditional → KILLED |
if (!PaintUtilities.equal(this.openTickPaint, that.openTickPaint)) { |
| 478 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED |
return false; |
| 479 | } | |
| 480 |
1
1. equals : negated conditional → KILLED |
if (!PaintUtilities.equal(this.closeTickPaint, that.closeTickPaint)) { |
| 481 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED |
return false; |
| 482 | } | |
| 483 |
1
1. equals : negated conditional → KILLED |
if (this.tickLength != that.tickLength) { |
| 484 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED |
return false; |
| 485 | } | |
| 486 |
1
1. equals : negated conditional → KILLED |
if (!super.equals(obj)) { |
| 487 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
| 488 | } | |
| 489 |
1
1. equals : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED |
return true; |
| 490 | } | |
| 491 | ||
| 492 | /** | |
| 493 | * Provides serialization support. | |
| 494 | * | |
| 495 | * @param stream the input stream. | |
| 496 | * | |
| 497 | * @throws IOException if there is an I/O error. | |
| 498 | * @throws ClassNotFoundException if there is a classpath problem. | |
| 499 | */ | |
| 500 | private void readObject(ObjectInputStream stream) | |
| 501 | throws IOException, ClassNotFoundException { | |
| 502 |
1
1. readObject : removed call to java/io/ObjectInputStream::defaultReadObject → KILLED |
stream.defaultReadObject(); |
| 503 | this.openTickPaint = SerialUtilities.readPaint(stream); | |
| 504 | this.closeTickPaint = SerialUtilities.readPaint(stream); | |
| 505 | } | |
| 506 | ||
| 507 | /** | |
| 508 | * Provides serialization support. | |
| 509 | * | |
| 510 | * @param stream the output stream. | |
| 511 | * | |
| 512 | * @throws IOException if there is an I/O error. | |
| 513 | */ | |
| 514 | private void writeObject(ObjectOutputStream stream) throws IOException { | |
| 515 |
1
1. writeObject : removed call to java/io/ObjectOutputStream::defaultWriteObject → KILLED |
stream.defaultWriteObject(); |
| 516 |
1
1. writeObject : removed call to org/jfree/chart/util/SerialUtilities::writePaint → KILLED |
SerialUtilities.writePaint(this.openTickPaint, stream); |
| 517 |
1
1. writeObject : removed call to org/jfree/chart/util/SerialUtilities::writePaint → KILLED |
SerialUtilities.writePaint(this.closeTickPaint, stream); |
| 518 | } | |
| 519 | ||
| 520 | } | |
Mutations | ||
| 160 |
1.1 |
|
| 173 |
1.1 |
|
| 185 |
1.1 |
|
| 198 |
1.1 |
|
| 210 |
1.1 |
|
| 225 |
1.1 |
|
| 237 |
1.1 |
|
| 252 |
1.1 |
|
| 265 |
1.1 |
|
| 280 |
1.1 |
|
| 293 |
1.1 |
|
| 294 |
1.1 |
|
| 297 |
1.1 |
|
| 322 |
1.1 |
|
| 331 |
1.1 |
|
| 340 |
1.1 |
|
| 341 |
1.1 |
|
| 343 |
1.1 |
|
| 348 |
1.1 2.2 |
|
| 353 |
1.1 |
|
| 354 |
1.1 |
|
| 355 |
1.1 2.2 |
|
| 358 |
1.1 |
|
| 359 |
1.1 |
|
| 360 |
1.1 2.2 |
|
| 367 |
1.1 |
|
| 368 |
1.1 |
|
| 370 |
1.1 |
|
| 372 |
1.1 |
|
| 375 |
1.1 |
|
| 376 |
1.1 |
|
| 379 |
1.1 |
|
| 381 |
1.1 |
|
| 382 |
1.1 2.2 |
|
| 385 |
1.1 |
|
| 386 |
1.1 2.2 |
|
| 392 |
1.1 |
|
| 394 |
1.1 |
|
| 397 |
1.1 |
|
| 398 |
1.1 |
|
| 401 |
1.1 |
|
| 403 |
1.1 |
|
| 404 |
1.1 2.2 |
|
| 407 |
1.1 |
|
| 408 |
1.1 2.2 |
|
| 418 |
1.1 2.2 |
|
| 419 |
1.1 |
|
| 420 |
1.1 |
|
| 422 |
1.1 2.2 3.3 |
|
| 429 |
1.1 |
|
| 430 |
1.1 |
|
| 432 |
1.1 |
|
| 433 |
1.1 |
|
| 438 |
1.1 |
|
| 439 |
1.1 |
|
| 453 |
1.1 |
|
| 464 |
1.1 |
|
| 465 |
1.1 |
|
| 467 |
1.1 |
|
| 468 |
1.1 |
|
| 471 |
1.1 |
|
| 472 |
1.1 |
|
| 474 |
1.1 |
|
| 475 |
1.1 |
|
| 477 |
1.1 |
|
| 478 |
1.1 |
|
| 480 |
1.1 |
|
| 481 |
1.1 |
|
| 483 |
1.1 |
|
| 484 |
1.1 |
|
| 486 |
1.1 |
|
| 487 |
1.1 |
|
| 489 |
1.1 |
|
| 502 |
1.1 |
|
| 515 |
1.1 |
|
| 516 |
1.1 |
|
| 517 |
1.1 |


Fireside Chat with Shereef: Kitchen vs Table
September 20th, 2014
I love how Dev Bootcamp treats each cohort as its own individual experiment. Unlike a lot of educational programs and institutions today, they are not afraid to admit that they do not have things figured out. Their curriculum is constantly evolving, and there is not a perfect way to teach everyone.
My favorite part about Dev Bootcamp is that they treat the students as adults, and expect us to come in with a Kitchen Mindset. We are not entitled to any sort of experience, and Dev Bootcamp is not some prepackaged software that you can pick off the shelf. I believe it is my responsibility to control my experience in every aspect of my life and that perception is reality. This type of mindset empowers me to live life to the fullest, and I am excited to be immersed in a program that adopts this same sort of mentality.
As excited as I am to join this type of community, I am also very nervous. The idea of pair programming freightens me because I have imposter syndrome. I put a lot of pressure on myself in life to be a strong co-worker, teamate, friend, sibiling etc. I know going in that there are going to be challenges and situations that I struggle with and I am going to feel guilty that I am letting my pairing partner down. I haven't even had a chance to pair program yet, but I already have this fear not to become the weak link that noone wants to pair with. In a way this is good, because it motivates me to study more and try harder, but this pressure and anxiety I put on myself is not healthy in the long run.
One thing for sure is that I am walking into Dev Bootcamp hungry, mad and inspired. This program is me taking control of my career and my future. I am very happy to be a part of DBC and I cannot wait to co-create a magical experience with my cohort.


TechnologyConversations.com is the result of after-the-office-hours talks between Viktor Farcic and Jordi Falguera. We would go to a bar or a pub, order a drink and some "tapas" and discuss. Those discussions could be anything from frustration regarding some work decision we had no control of, discussion about the latest article or blog post we read and, more than anything, planning of our next steps in the continuous struggle to improve processes in our own company. Many successful (and some failed) improvements were implemented in our company as a result of those conversations. Our objective was to make a big, international and well established company as efficient, lean and modern as possible.
For the long time we kept those discussions for ourselves until, near the end of 2013, we decided to share our "discussions" with the world outside the close corporate environment. Thus, TechnologyConversations.com site was born.
One of our big subjects in the conversations was Behavior-Driven Development (BDD) and ways to implement it in a company as big as the one we worked for at that time. BDD Assistant is the result of best-practices we found, discovered, modified or invented.


Pat's Salmon Cookies
New Store
Location:
Minimum Customers:
Maximum Customers:
Average Per Sale:
SUBMIT
Stores Info:
go to
index


Take one down, pass it around, 98 bottles of pop on the wall.") ``` ``` ## 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. ``` ```r cat("98 bottles of pop on the wall, 98 bottles of pop. Take one down, pass it around, 97 bottles of pop on the wall.") ``` ``` ## 98 bottles of pop on the wall, 98 bottles of pop. ## Take one down, pass it around, 97 bottles of pop on the wall. ``` ```r ###.... and so on... ``` --- # We could write a function... ```r sing_about_pop <- function(num) { paste(num, "bottles of pop on the wall,", num, "bottles of pop.", "Take one down, pass it around,", num - 1, "bottles of pop on the wall.") } ``` --- # We could write a function... ```r sing_about_pop <- function(num) { glue("{num} bottles of pop on the wall, {num} bottles of pop. Take one down, pass it around, {num - 1} bottles of pop on the wall.") } ``` --- # This helped! ```r sing_about_pop(99) ``` ``` ## 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. ``` ```r sing_about_pop(98) ``` ``` ## 98 bottles of pop on the wall, 98 bottles of pop. ## Take one down, pass it around, 97 bottles of pop on the wall. ``` --- # But it is still repetitive... ```r pop_song <- paste( sing_about_pop(99), sing_about_pop(98), sing_about_pop(97), sing_about_pop(99), sing_about_pop(98) ) pop_song %>% cat(sep = "\n") ``` ``` ## 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. 98 bottles of pop on the wall, 98 bottles of pop. ## Take one down, pass it around, 97 bottles of pop on the wall. 97 bottles of pop on the wall, 97 bottles of pop. ## Take one down, pass it around, 96 bottles of pop on the wall. 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. 98 bottles of pop on the wall, 98 bottles of pop. ## Take one down, pass it around, 97 bottles of pop on the wall. ``` --- # Old School: For loops ```r pop_song <- c() for (i in 99:95) { pop_song <- c(pop_song, sing_about_pop(i)) } pop_song %>% cat(sep = "\n") ``` ``` ## 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. ## 98 bottles of pop on the wall, 98 bottles of pop. ## Take one down, pass it around, 97 bottles of pop on the wall. ## 97 bottles of pop on the wall, 97 bottles of pop. ## Take one down, pass it around, 96 bottles of pop on the wall. ## 96 bottles of pop on the wall, 96 bottles of pop. ## Take one down, pass it around, 95 bottles of pop on the wall. ## 95 bottles of pop on the wall, 95 bottles of pop. ## Take one down, pass it around, 94 bottles of pop on the wall. ``` --- # Old School: For loops **Pro:** * Classic programming approach; easy to understand * Can change values at each loop step. -- **Con:** * A little messy to read the code * Don't fit "nicely" inside other functions or pipelines. --- # Better: The `apply` functions ```r sapply(99:95, sing_about_pop) %>% cat(sep = "\n") ``` ``` ## 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. ## 98 bottles of pop on the wall, 98 bottles of pop. ## Take one down, pass it around, 97 bottles of pop on the wall. ## 97 bottles of pop on the wall, 97 bottles of pop. ## Take one down, pass it around, 96 bottles of pop on the wall. ## 96 bottles of pop on the wall, 96 bottles of pop. ## Take one down, pass it around, 95 bottles of pop on the wall. ## 95 bottles of pop on the wall, 95 bottles of pop. ## Take one down, pass it around, 94 bottles of pop on the wall. ``` --- # Better: The `apply` functions - Pay attention to what type of input they *take* and what type of output they *give* - `sapply` takes a vector, returns a vector - `lapply` takes a list, returns a list - `apply` takes a dataset and a dimension (1 = row, 2 = col), returns a vector or list --- # Best: The `map` functions from `purrr` ```r map_chr(99:95, sing_about_pop) %>% cat(sep = "\n") ``` ``` ## 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. ## 98 bottles of pop on the wall, 98 bottles of pop. ## Take one down, pass it around, 97 bottles of pop on the wall. ## 97 bottles of pop on the wall, 97 bottles of pop. ## Take one down, pass it around, 96 bottles of pop on the wall. ## 96 bottles of pop on the wall, 96 bottles of pop. ## Take one down, pass it around, 95 bottles of pop on the wall. ## 95 bottles of pop on the wall, 95 bottles of pop. ## Take one down, pass it around, 94 bottles of pop on the wall. ``` --- # Best: The `map` functions from `purrr` - `map` always returns a **list** - `map_chr` always returns a **character vector** (or an error) - What do you think `map_dbl` returns? --- class: inverse, center, middle # Mapping with multiple arguments --- # What if I want some options in my function? ```r sing_about_drinks <- function(num, drink, container = "bottles") { glue("{num} {container} of {drink} on the wall, {num} {container} of {drink}. Take one down, pass it around, {num - 1} {container} of {drink} on the wall.") } ``` --- # `sapply` has trouble! ```r sapply(99:95, sing_about_drinks(drink = "beer")) ``` ``` ## Error in eval(parse(text = text, keep.source = FALSE), envir): argument "num" is missing, with no default ``` --- # You can kind of get around this... (This is called a **headless function**) <code class ='r hljs remark-code'>sapply(99:95, <span style='background-color:#ffff7f'>function(<span style='background-color:#ffff7f'>x</span>)</span> sing_about_drinks(<span style='background-color:#ffff7f'>x</span>, drink = "beer")) %>%<br> cat(sep = "\n")</code> ``` ## 99 bottles of beer on the wall, 99 bottles of beer. ## Take one down, pass it around, 98 bottles of beer on the wall. ## 98 bottles of beer on the wall, 98 bottles of beer. ## Take one down, pass it around, 97 bottles of beer on the wall. ## 97 bottles of beer on the wall, 97 bottles of beer. ## Take one down, pass it around, 96 bottles of beer on the wall. ## 96 bottles of beer on the wall, 96 bottles of beer. ## Take one down, pass it around, 95 bottles of beer on the wall. ## 95 bottles of beer on the wall, 95 bottles of beer. ## Take one down, pass it around, 94 bottles of beer on the wall. ``` --- # You can also do this in `map` functions <code class ='r hljs remark-code'>map_chr(99:95, <span style='background-color:#ffff7f'>function(<span style='background-color:#ffff7f'>x</span>)</span> sing_about_drinks(<span style='background-color:#ffff7f'>x</span>, drink = "beer")) %>%<br> cat(sep = "\n")</code> ``` ## 99 bottles of beer on the wall, 99 bottles of beer. ## Take one down, pass it around, 98 bottles of beer on the wall. ## 98 bottles of beer on the wall, 98 bottles of beer. ## Take one down, pass it around, 97 bottles of beer on the wall. ## 97 bottles of beer on the wall, 97 bottles of beer. ## Take one down, pass it around, 96 bottles of beer on the wall. ## 96 bottles of beer on the wall, 96 bottles of beer. ## Take one down, pass it around, 95 bottles of beer on the wall. ## 95 bottles of beer on the wall, 95 bottles of beer. ## Take one down, pass it around, 94 bottles of beer on the wall. ``` --- # But `map` has a cool shortcut! - Note the "~" in front of the function - this is important! - Note the "." before the "x" - this is important! <code class ='r hljs remark-code'>map_chr(99:95, <span style='background-color:#ffff7f'>~</span>sing_about_drinks(<span style='background-color:#ffff7f'>.x</span>, "beer")) %>%<br> cat(sep = "\n")</code> ``` ## 99 bottles of beer on the wall, 99 bottles of beer. ## Take one down, pass it around, 98 bottles of beer on the wall. ## 98 bottles of beer on the wall, 98 bottles of beer. ## Take one down, pass it around, 97 bottles of beer on the wall. ## 97 bottles of beer on the wall, 97 bottles of beer. ## Take one down, pass it around, 96 bottles of beer on the wall. ## 96 bottles of beer on the wall, 96 bottles of beer. ## Take one down, pass it around, 95 bottles of beer on the wall. ## 95 bottles of beer on the wall, 95 bottles of beer. ## Take one down, pass it around, 94 bottles of beer on the wall. ``` --- class: center, middle, inverse # But what if I want to iterate over multiple options? --- # Multiple iteration ```r head(data) ``` ``` ## num drink ## 1 99 pop ## 2 98 beer ## 3 97 water ## 4 96 lemonade ## 5 95 milk ``` --- # Use `map2`! ```r map2_chr(data$num, data$drink, ~sing_about_drinks(.x, .y, "cans")) %>% cat(sep = "\n") ``` ``` ## 99 cans of pop on the wall, 99 cans of pop. ## Take one down, pass it around, 98 cans of pop on the wall. ## 98 cans of beer on the wall, 98 cans of beer. ## Take one down, pass it around, 97 cans of beer on the wall. ## 97 cans of water on the wall, 97 cans of water. ## Take one down, pass it around, 96 cans of water on the wall. ## 96 cans of lemonade on the wall, 96 cans of lemonade. ## Take one down, pass it around, 95 cans of lemonade on the wall. ## 95 cans of milk on the wall, 95 cans of milk. ## Take one down, pass it around, 94 cans of milk on the wall. ``` --- class: center, middle, inverse # I demand even more options! --- # Mapping over many options ```r head(data) ``` ``` ## num drink container ## 1 99 pop bottles ## 2 98 beer cans ## 3 97 water glasses ## 4 96 lemonade beyonces ## 5 95 milk cartons ``` --- # Mapping over many options `pmap` takes a list or data frame as input. ```r pmap_chr(data, ~sing_about_drinks(..1, ..2, ..3)) %>% cat(sep = "\n") ``` ``` ## 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. ## 98 cans of beer on the wall, 98 cans of beer. ## Take one down, pass it around, 97 cans of beer on the wall. ## 97 glasses of water on the wall, 97 glasses of water. ## Take one down, pass it around, 96 glasses of water on the wall. ## 96 beyonces of lemonade on the wall, 96 beyonces of lemonade. ## Take one down, pass it around, 95 beyonces of lemonade on the wall. ## 95 cartons of milk on the wall, 95 cartons of milk. ## Take one down, pass it around, 94 cartons of milk on the wall. ``` --- # Mapping over many options Since there are only 3 variables, and we want them to go into the arguments of `sing_about_drinks` in order... ```r pmap_chr(data, sing_about_drinks) %>% cat(sep = "\n") ``` ``` ## 99 bottles of pop on the wall, 99 bottles of pop. ## Take one down, pass it around, 98 bottles of pop on the wall. ## 98 cans of beer on the wall, 98 cans of beer. ## Take one down, pass it around, 97 cans of beer on the wall. ## 97 glasses of water on the wall, 97 glasses of water. ## Take one down, pass it around, 96 glasses of water on the wall. ## 96 beyonces of lemonade on the wall, 96 beyonces of lemonade. ## Take one down, pass it around, 95 beyonces of lemonade on the wall. ## 95 cartons of milk on the wall, 95 cartons of milk. ## Take one down, pass it around, 94 cartons of milk on the wall. ``` --- # Using map with the pipe The `map` functions work very nicely with `mutate()` and similar pipe-friendly functions. <code class ='r hljs remark-code'>penguins %>%<br> mutate(<br> smaller_dimension = <span style='background-color:#ffff7f'>min(bill_length_mm, bill_depth_mm)</span><br> ) %>%<br> select(bill_length_mm, bill_depth_mm, smaller_dimension)</code> ``` ## # A tibble: 344 x 3 ## bill_length_mm bill_depth_mm smaller_dimension ## <dbl> <dbl> <dbl> ## 1 39.1 18.7 NA ## 2 39.5 17.4 NA ## 3 40.3 18 NA ## 4 NA NA NA ## 5 36.7 19.3 NA ## 6 39.3 20.6 NA ## 7 38.9 17.8 NA ## 8 39.2 19.6 NA ## 9 34.1 18.1 NA ## 10 42 20.2 NA ## # … with 334 more rows ``` --- # Using map with the pipe The `map` functions work very nicely with `mutate()` and similar pipe-friendly functions. <code class ='r hljs remark-code'>penguins %>%<br> mutate(<br> smaller_dimension = min(bill_length_mm, bill_depth_mm, <span style='background-color:#ffff7f'>na.rm = TRUE</span>)<br> ) %>%<br> select(bill_length_mm, bill_depth_mm, smaller_dimension)</code> ``` ## # A tibble: 344 x 3 ## bill_length_mm bill_depth_mm smaller_dimension ## <dbl> <dbl> <dbl> ## 1 39.1 18.7 13.1 ## 2 39.5 17.4 13.1 ## 3 40.3 18 13.1 ## 4 NA NA 13.1 ## 5 36.7 19.3 13.1 ## 6 39.3 20.6 13.1 ## 7 38.9 17.8 13.1 ## 8 39.2 19.6 13.1 ## 9 34.1 18.1 13.1 ## 10 42 20.2 13.1 ## # … with 334 more rows ``` --- # Using map with the pipe The `map` functions work very nicely with `mutate()` and similar pipe-friendly functions. <code class ='r hljs remark-code'>penguins %>%<br> mutate(<br> smaller_dimension = <span style='background-color:#ffff7f'>map2_dbl</span>(bill_length_mm, bill_depth_mm, <span style='background-color:#ffff7f'>min</span>)<br> ) %>%<br> select(bill_length_mm, bill_depth_mm, smaller_dimension)</code> ``` ## # A tibble: 344 x 3 ## bill_length_mm bill_depth_mm smaller_dimension ## <dbl> <dbl> <dbl> ## 1 39.1 18.7 18.7 ## 2 39.5 17.4 17.4 ## 3 40.3 18 18 ## 4 NA NA NA ## 5 36.7 19.3 19.3 ## 6 39.3 20.6 20.6 ## 7 38.9 17.8 17.8 ## 8 39.2 19.6 19.6 ## 9 34.1 18.1 18.1 ## 10 42 20.2 20.2 ## # … with 334 more rows ``` --- class: inverse, center, middle # The best iteration is no iteration --- # Vectorized functions ## What does it mean to be vectorized? ```r add_odds <- function(x, y){ if(x %% 2 == 1 & y %% 2 == 1){ return(x + y) } else { return(0) } } ``` --- # What does it mean to be vectorized? ```r add_odds(1, 3) ``` ``` ## [1] 4 ``` ```r add_odds(2, 4) ``` ``` ## [1] 0 ``` --- # What does it mean to be vectorized? ```r first_nums <- c(1, 2) next_nums <- c(3, 4) add_odds(first_nums, next_nums) ``` ``` ## Warning in if (x%%2 == 1 & y%%2 == 1) {: the condition has length > 1 and only ## the first element will be used ``` ``` ## [1] 4 6 ``` --- # Vectorized Functions `add_odds` is not a vectorized function! ```r add_odds <- function(x, y){ if(x %% 2 == 1 & y %% 2 == 1){ return(x + y) } else { return(0) } } ``` --- # Vectorized Functions We can avoid the error by iteration, but this is slow! ```r first_nums <- c(1,2) next_nums <- c(3,4) map2_dbl(first_nums, next_nums, add_odds) ``` ``` ## [1] 4 0 ``` --- # Vectorized function A better (but harder!) approach is to make the function **truly** vectorized: ```r add_odds <- function(x, y){ is_odd <- x %% 2 == 1 & y %% 2 == 1 answers <- x + y answers[!is_odd] <- 0 return(answers) } ``` ```r add_odds(first_nums, next_nums) ``` ``` ## [1] 4 0 ``` --- # Function design: Things to think about - What does your function take as INPUT? - What does your function give as OUTPUT? -- - How can we write it to be friendly with `apply` or `map`? -- - Do you REALLY need to use `apply` or `map`, or is it vectorized? -- - Bonus: How can we write it to be friendly with `%>%`?


chasepeck.com
/topics
topics
hot topics!
Games
Chase Peck Games
GameJolt Community
You Don't Know Scratch
The Skiller
Featured blog posts
All blog posts
6-28-2020
5-20-2020
3-31-2020
Blog extras
The envelope
Fake ads
Execution
Graphic design
John Code
Get rich quick
Secrets
Assets/audio
American Battle.wav
Awkward Battle.wav
Conventional Battle.wav
Interrupted Battle.wav
Monday Morning Battle.wav
Moody Battle.wav
Miscellaneous
Back to chasepeck.com
Feedback
Good time
MIT license
Information
Readme markup
404 page


Police Search Underway For 25 Y.O. British Tourist Missing In VIC Bushland
by By Josephine Rozenberg-ClarkePolice search teams are working tirelessly to locate a British tourist missing in bushland near the Twelve Apostles in Victoria after he suffered a head injury and ran into the wilderness in the early hours of this morning.
Aslan King, a 25-year-old illustrator and designer visiting Australia from the UK city of Bristol, was camping with friends off Old Coach Road near Princetown when he ran off at around 2am, according to Nine News.
King reportedly suffered a “medical episode” which led to him hitting his head. According to a police spokesperson, he “suddenly got up and ran from the area into surrounding bushland”. While his friends attempted to find him, they were unable to locate King. It’s believed he became disoriented and lost in the dense bushland.
Victoria Police have released a photo taken of Aslan King yesterday, indicating that he was last seen wearing the same clothing, minus the jacket.
Police describe King as Caucasian, with a medium build, dark short hair and was wearing trackpants, a light grey t-shirt with grey hoodie, green Reebok runners and may possibly have blood on his forehead.
If you have any information that could help, call Warrnambool Police Station on (03) 5560 1333.
Image: Victoria Police


Smart E.
Menu
Close
Smart E.
Home
Product Tour - Beta
Application Process - Beta
Account Number:
Balance:
Post a Vacany
Request a Seat
Course description
:
Course Fee (ETH)
:
Offered by
:
Enrolled by
:
Enroll
×
Course name
Description of the Course
Course Fee in ETH
Submit
Close


### Your brain gets smart but your head gets dumb ##### Designing A Data-Driven Story for the Busy and Bored Shane, Mac, David
### Guiding Design Principles
### Reading Level Visualization
### Legend Placement - Two seperate legends - Focus them where the whitespace is - Size of bubble for vocab - Color for role in film
- Decided not to add text to scatterplot directly (Shrek is not labeled) - This encourages interaction - Showing one character at a time through the tooltip encourages a user to play with the visualization
- On hover, there is additional information for the character - The individual point is highlighted, synced to the tooltip. - This makes everything visually consistent
## Allow by movie exploration, with default of "the trilogy" - Results are "averaged" for the trilogy - No sense in adding totals, since some characters only appear in some movies
## Filter characters with less than 20 lines - The measurement of interest is skewed with a lower number of lines - Characters with a lower number of lines are less interesting to the audience, no need to busy presentation
### Character Interaction Visualization
### Gender Dialogue Visualization
### Color by Gender - Legend Omission - Default colors for gender - Gender graph should make colors obvious - Removed non-binary characters such as enchanted furniture. for focus on genders.
### ToolTips - Decided to be repetitive for names - Don't have to hover over every character - Interactivity is encouraged to see word count and choose movie - No images - Character and word count on hover
### Whitescape - Five ticks on bottom - Background is see through
## Scale - Maximum word count per character/gender be 100% width - Kept the scale linear instead of log - Major difference in words spoken per group (main, supporting, secondary) is visible
## Character choice - Clipped characters by top 18 rather than by number of words spoke - This allowed the graphs to stay the same height and easier to compare - Show the difference in the number of words spoken in each movie per each character
## Character interactions
### Inspiration - _Les Mis_ - Interactivity - Force graphs look cool
### Design - Plotting everything is a mess, need to filter - Want it to be very interactive - Choose characters, films, layout - Let users find their own conclusions in the data - Too cluttered for mouseover text/pop-up legend - Reference character names elsewhere
### Issues - Interactivity not immediately obvious - More analysis might help solve this - Character/film selection spartan, not well labeled


Question 1/1
"Degree of an Array (sample question)"
Given a non-empty array N, of non-negative integers , the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible length of a (contiguous) subarray of N, that has the same degree as N. For example, in the array [1 2 2 3 1], integer 2 occurs maximum of twice. Hence the degree is 2. Input Test case input contains 2 lines. First line contains an integer T, representing the number of elements in the array. The second line contains the array N, list of T integers each separated by space. Output Print the length of the smallest contiguous subarray of input array N, that has the same degree as N. Code evaluation is based on your output, please follow the sample format and do NOT print anything else.


Numbers 35:22
But if he thrust him suddenly without enmity, or have cast upon him any thing without laying of wait,


--- layout: post title: Couch Table categories: - Woodworking tags: [] comments: [] ---
Matt and I needed a quick project for Christmas time.
It's an original design with a u-shaped base that allows the table to slide forward and out of the way of the arm rest by wrapping around the leg of the couch. We made it out of red oak with two small walnut accents. Plans below.
First we built the base. We ripped 2" nominal thick red oak into 1.5" strips and chopped them to length. We cut shallow angles into the parallel parts of the base using a band saw and hand plane. We used hand tools to cut mitered bridle joint corners. These were the toughest part of the project, and we spent a lot of time fussing over the precise fit.
We made the top of the table by chopping a piece of 1x12" red oak. We beveled three edges using a hand plane and cut the through mortices.
Next, we made the vertical legs of the table. We ripped 1.25" strips of 1" nominal red oak and chopped them to length. We cut through tenons for the top and bottom with 1/8" shoulders.
We decided to try wedged tenons for a nice look on the top of the table. By eye, we cut some slim wedges out of walnut on the band saw. We also cut slots into the top tenon and flaired out the corresponding mortices slightly to accomodate the extra width from the wedges.
We glued everything together and gently hammered the wedges in.
Here's what they looked like after we sawed off the excess.
Finally, we planed all of the joint surfaces flat and sanded down to 200 grit. For a finish, we decided to use danish oil. I highly recommend it. At least for red oak, it make the grain stand out and gives the whole thing a wonderful color. We also applied a layer of finishing wax.
This table was fun to build and came out looking good. It doesn't feel too unstable, either. With some simple length adjustments, it would be easy to fit this design to different couches and chairs.


Play the opening of Silent Hill in first-person
by Jody MacgregorGame designer and Silent Hill fan Zero Trace Operative has spent the last five months recreating the opening of the first game in the Silent Hill series in first-person. This concept demo is playable now, and although it's only about four minutes long it's a powerful hit of nostalgia for anyone who spent a chunk of 1999 being terrified of foggy streets and air-raid sirens.
According to ZTO's blog about this demo, the assets are traced from model extractions rather than being ripped directly from the actual game, but they're still eerily familiar, even in this new perspective.
You can download the Silent Hill Remake demo from itch.io. ZTO has no plans to continue work on this fan tribute, and considers it complete as it stands.


Provides APIs for KiiCloud application features.
See Also: Inherited members from object.
|
static
|
AccessTokenExpiration | long . Gets or set the access token lifetime in seconds. |
| [read-only] static |
AppId | string . Gets the application ID. |
| [read-only] static |
AppKey | string . Gets the application key. |
| [read-only] static |
BaseUrl | string . Gets the server URL. |
| [read-only] static |
KiiAppsBaseUrl | string . URL for KiiApps server. |
|
static
|
Logger | IKiiLogger . Sets the logger. |
|
static
|
Bucket
(string)Gets new Kiibucket whose scope is app scope. |
|
|
static
|
Group
(string)Create a group own by current user. |
|
|
static
|
Group
(string, IList<KiiUser>)Create a group with the specified groupName and groupMembers. |
|
|
static
|
Initialize
(string, string, Kii.Site)Initialize KiiSDK appId, appKey and Site. |
|
|
static
|
Initialize
(string, string, string)Initialize KiiSDK appId, appKey and serverUrl. |
|
|
static
|
Initialize
(string, string, Kii.Site, KiiHttpClientFactory, KiiHttpClientFactory)This method is intended for use in internal purposes. Do not use it to initialize your application. |
|
|
static
|
Initialize
(string, string, string, KiiHttpClientFactory, KiiHttpClientFactory)Initialize KiiSDK appID, appKey, deviceID, serverUrl and KiiHttpClientFactory. |
|
|
static
|
ListTopics
()Gets the list of topics in app scope. |
|
|
static
|
ListTopics
(KiiGenericsCallback<KiiListResult<KiiTopic>>)Asynchronous call for Kii.ListTopics. |
|
|
static
|
ListTopics
(string)Gets the list of next page of topics in app scope. |
|
|
static
|
ListTopics
(string, KiiGenericsCallback<KiiListResult<KiiTopic>>)Asynchronous call for Kii.ListTopics(string). |
|
|
static
|
ServerCodeEntry
(string)Instantiate KiiServerCodeEntry with specified entry name. |
|
|
static
|
ServerCodeEntry
(string, Nullable<KiiServerCodeEnvironmentVersion>)Instantiate KiiServerCodeEntry with specified entry name and environment version. |
|
|
static
|
ServerCodeEntry
(string, string)Instantiate KiiServerCodeEntry with specified entry name and version. |
|
|
static
|
ServerCodeEntry
(string, string, Nullable<KiiServerCodeEnvironmentVersion>)Instantiate KiiServerCodeEntry with specified entry name and version and environment version. |
|
|
static
|
Topic
(string)Get instance of app scope topic. The topic bound to the application. |
Gets or set the access token lifetime in seconds.Syntax
public static long AccessTokenExpiration { get; set; }Value
The life time of access token in seconds.Exceptions
Type Reason InvalidOperationException Thrown if SDK has not initialized yet. Remarks
If you don't set this or set with 0, token won't be expired. Set this if you like the access token to be expired after a certain period. Once set, token retrieved by each future authentication will have the specified lifetime. Note that, it will not update the lifetime of token received prior calling this method. Once expired, you have to login again to renew the token.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Gets the application ID.Syntax
public static string AppId { get; }Value
Application ID found in your Kii developer consoleRemarks
If Kii.Initialize(string, string, Kii.Site) is not called, return null.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Gets the application key.Syntax
public static string AppKey { get; }Value
Application key found in your Kii developer consoleRemarks
If Kii.Initialize(string,string,Kii.Site) is not called, return null.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Gets the server URL.Syntax
public static string BaseUrl { get; }Value
The server URL.Remarks
If Kii.Initialize(string,string,string) is not called, return null.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Gets new Kiibucket whose scope is app scope.Syntax
Parameters
- bucketName
- Bucket name
Returns
KiiBucket instance.Exceptions
Type Reason ArgumentException Is thrown when bucket name is invalid. Remarks
This API doesn't call server API.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Create a group own by current user.Syntax
Parameters
- groupName
- Group name.
Returns
New KiiGroup instance.Exceptions
Type Reason ArgumentException Is thrown when group name is empty. Remarks
This API is equivalent to Kii.Group(groupName, null)Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Create a group with the specified groupName and groupMembers.Syntax
Parameters
- groupName
- Group name.
- groupMembers
- Group members.
Returns
New KiiGroup instance.Exceptions
Type Reason ArgumentException Is thrown when group name is empty. Remarks
To create new group on KiiCloud, please call KiiGroup.Save() API of returned KiiGroup.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Initialize KiiSDK appId, appKey and Site.Syntax
Parameters
- appId
- Application ID found in your Kii developer console.
- appKey
- Application key found in your Kii developer console
- site
- Please set any one of Site.US, Site.JP, Site.CN, Site.CN3 or Site.SG you've chosen when you created application on Kii developer console.
Exceptions
Type Reason ArgumentException Is thrown when an argument is invalid. Remarks
Initialize KiiCloudStorage SDK and this must be call prior to all APIs call.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Initialize KiiSDK appId, appKey and serverUrl.Syntax
Parameters
- appId
- Application ID found in your Kii developer console
- appKey
- Application key found in your Kii developer console
- serverUrl
- Server URL.
Exceptions
Type Reason ArgumentException Is thrown when an argument passed to a method is invalid. Remarks
Initialize KiiCloudStorage SDK and this must be call prior to all APIs call.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
This method is intended for use in internal purposes. Do not use it to initialize your application.Syntax
public static void Initialize (string appId, string appKey, Kii.Site site, KiiHttpClientFactory syncFactory, KiiHttpClientFactory asyncFactory)Parameters
- appId
- Application ID found in your Kii developer console
- appKey
- Application key found in your Kii developer console
- site
- Please set any one of Site.US, Site.JP, Site.CN, Site.CN3 or Site.SG you've chosen when you created application on Kii developer console.
- syncFactory
- Http client factory for blocking api.
- asyncFactory
- Http client factory for non-blocking api.
Exceptions
Type Reason ArgumentException Is thrown when an argument passed to a method is invalid. Remarks
Initialize KiiCloudStorage SDK and this must be call prior to all APIs call.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Initialize KiiSDK appID, appKey, deviceID, serverUrl and KiiHttpClientFactory.Syntax
public static void Initialize (string appId, string appKey, string serverUrl, KiiHttpClientFactory syncFactory, KiiHttpClientFactory asyncFactory)Parameters
- appId
- Application ID found in your Kii developer console
- appKey
- Application key found in your Kii developer console
- serverUrl
- Server URL.
- syncFactory
- Http client factory for blocking api.
- asyncFactory
- Http client factory for non-blocking api.
Exceptions
Type Reason ArgumentException Is thrown when an argument passed to a method is invalid. Remarks
This method is intended for use in internal purposes. Do not use it to initialize your application.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
URL for KiiApps server.Syntax
public static string KiiAppsBaseUrl { get; }Value
The KiiApps server URL.Remarks
No need to serialize because this value is generated in initialize by appId and serverUrl.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Gets the list of topics in app scope.Syntax
public static KiiListResult<KiiTopic> ListTopics ()Returns
A list of the topics in app scope.Exceptions
Type Reason KiiCorp.Cloud.Storage.CloudException Is thrown when server sends error response. KiiCorp.Cloud.Storage.UnauthorizedException Is thrown when this method called by anonymous user. Remarks
This api sends a request to server.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Asynchronous call for Kii.ListTopics.Syntax
public static void ListTopics (KiiGenericsCallback<KiiListResult<KiiTopic>> callback)Parameters
- callback
- Callback.
Exceptions
Type Reason KiiCorp.Cloud.Storage.CloudException Is thrown when server sends error response. Remarks
This api sends a request to server.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Gets the list of next page of topics in app scope.Syntax
public static KiiListResult<KiiTopic> ListTopics (string paginationKey)Parameters
- paginationKey
- Specifies the pagination key that is obtained by KiiListResult`1.PaginationKey. If specified null or empty, it's same as the Kii.ListTopics.
Returns
A list of the topics in app scope.Exceptions
Type Reason KiiCorp.Cloud.Storage.CloudException Is thrown when server sends error response. KiiCorp.Cloud.Storage.UnauthorizedException Is thrown when this method called by anonymous user. Remarks
This api sends a request to server.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Asynchronous call for Kii.ListTopics(string).Syntax
public static void ListTopics (string paginationKey, KiiGenericsCallback<KiiListResult<KiiTopic>> callback)Parameters
- paginationKey
- Specifies the pagination key that is obtained by KiiListResult`1.PaginationKey. If specified null or empty, it's same as the Kii.ListTopics(KiiGenericsCallback<KiiListResult<KiiTopic>>).
- callback
- Callback.
Exceptions
Type Reason KiiCorp.Cloud.Storage.CloudException Is thrown when server sends error response. Remarks
This api sends a request to server.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Sets the logger.Syntax
public static IKiiLogger Logger { get; set; }Value
The logger.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Instantiate KiiServerCodeEntry with specified entry name.Syntax
public static KiiServerCodeEntry ServerCodeEntry (string entryName)Parameters
- entryName
- Entry name.
Returns
KiiServerCodeEntry instance.Exceptions
Type Reason ArgumentNullException Is thrown when entryName is null or empty string. ArgumentException Is thrown when entryName does not match ^[a-zA-Z][_a-zA-Z0-9]*$ Remarks
Name must be valid.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Instantiate KiiServerCodeEntry with specified entry name and environment version.Syntax
public static KiiServerCodeEntry ServerCodeEntry (string entryName, Nullable<KiiServerCodeEnvironmentVersion> environmentVersion)Parameters
- entryName
- Entry name.
- environmentVersion
- Environment Version.
Returns
KiiServerCodeEntry instance.Exceptions
Type Reason ArgumentNullException Is thrown when entryName / version is null or empty string. ArgumentException Is thrown when entryName does not match ^[a-zA-Z][_a-zA-Z0-9]*$ or version is larger than 36 characters. Remarks
Name must be valid.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Instantiate KiiServerCodeEntry with specified entry name and version.Syntax
Parameters
- entryName
- Entry name.
- version
- Version.
Returns
KiiServerCodeEntry instance.Exceptions
Type Reason ArgumentNullException Is thrown when entryName / version is null or empty string. ArgumentException Is thrown when entryName does not match ^[a-zA-Z][_a-zA-Z0-9]*$ or version is larger than 36 characters. Remarks
Name must be valid.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Instantiate KiiServerCodeEntry with specified entry name and version and environment version.Syntax
public static KiiServerCodeEntry ServerCodeEntry (string entryName, string version, Nullable<KiiServerCodeEnvironmentVersion> environmentVersion)Parameters
- entryName
- Entry name.
- version
- Version.
- environmentVersion
- Environment Version.
Returns
KiiServerCodeEntry instance.Exceptions
Type Reason ArgumentNullException Is thrown when entryName / version is null or empty string. ArgumentException Is thrown when entryName does not match ^[a-zA-Z][_a-zA-Z0-9]*$ or version is larger than 36 characters. Remarks
Name must be valid.Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>
Get instance of app scope topic. The topic bound to the application.Syntax
Parameters
- name
- topic name.
Returns
KiiTopic bound to the application.Remarks
Requirements
Namespace: KiiCorp.Cloud.Storage
Assembly: KiiCloudStorageSDK (in KiiCloudStorageSDK.dll)
Assembly Versions: <IP_ADDRESS>


Sales Informations:
Salmon Cookies
Store Name:
Minimum Order:
Maximum Order:
Average Sales:
GO BACK TO HOME PAGE


Dream A Dream
Already have an account?
Login
Email address
Password
Forget the password ?
Sign in
keep me logged-in
New here ?
Join Us
Upcoming Events
Programs
Career Connect
LSD programs
Last Mile Support
Long Term Engagement
ContactUs
Send us a message, or contact us from the address below
No. 398/E
, 17th Cross, 9th Main, 3rd Block, Jayanagar, Bangalore - 560011, India T +91.80.40951084
Name
Email
Your Website
Any Message
Submit


UK a 'rogue state' after missing deadline to handover Chagos Islands
by Rachael KennedyThe UK has been widely criticised after missing a UN deadline to hand over control of the Chagos Islands to Mauritius.
As the due date passed on Friday, the African Union called for a "complete decolonisation" of the islands and expressed "deep concern" for the missed deadline.
It came a day after Mauritius Prime Minister Pravind Kumar Jugnauth told parliament the UK had violated human rights and international law by "maintaining an illegal colonial administration".
According to a UN advisory ruling in February, the UK acted unlawfully in its separation of the Chagos Archipelago from Mauritius in the 1960s.
In May, the UN General Assembly then voted in favour of the UK relinquishing control of the islands and enacted a six-month deadline.
But the UK government, which calls the islands the British Indian Ocean Territory, has previously rejected foreign claims of sovereignty.
In a statement in early November, it said: "The UK has no doubt as to our sovereignty over the British Indian Ocean Territory (BIOT), which has been under continuous British sovereignty since 1814."
Euronews has reached out to the UK's foreign office for comment on Friday's expired deadline.
READ MORE:
- UN Court urges Britain to act on 'unlawful' separation of Chagos Islands from Mauritius
- Where are the Chagos Islands and why has Pope Francis weighed in on the controversy?
It comes as a particularly controversial case due to the UK's control of the islands after Mauritius gained independence in 1968 leading to the displacement of thousands of islanders.
Their displacements made way for a US military base on the archipelago's largest island, Diego Garcia.
Chagos Support UK, an association of volunteers speaking out for displaced Chagossians, said on Friday the community was "united in demanding their fundamental right to live on their islands and recompense for over fifty years of abuse and neglect."
It added: "The UN General Assembly and International Court of Justice (ICJ) verdict highlighted the vicious treatment of Chagossians to the wider world. Chagossians can not wait any longer."
Meanwhile, other experts were also vocal in their criticisms of the UK's lack of response.
Mark Curtis, a foreign policy and international development expert, said the UK was acting the part of "a rogue state" for appearing to ignore the UN's deadline.
He added: "Nothing sensationalist about this, it's a statement of fact."
Former British ambassador to Uzbekistan Craig Murray said the UK had shunned the rulings.
He said: "You can vote not to be a criminal rogue state", in reference to the upcoming general election in December.


Upsert Lands in PostgreSQL 9.5 – a First Look
If you’ve followed anything I’ve written about Postgres, you know that I’m a fan. At the same time you know that there’s been one feature that so many other databases have, which Postgres lacks and it causes a huge amount of angst for not being in Postgres… Upsert. Well the day has come, it’s finally committed and will be available in Postgres 9.5.
Sure we’re still several months away from Postgres 9.5 being released, anywhere from 3-6 months as a best guess. That doesn’t mean we can’t take a first look at this feature. Though before we get into it a few special call outs of thanks to Peter Geoghegan of the Heroku Postgres team for being the primary author on it, Andres Freund who recently just joined Citus Data for his heavy contributions, and Heikki Linnakangas as well for his contributions.
And now onto the exploration. Upsert is the common name, but if you’re unfamiliar upsert is essentially create or update – Create this new record, but if a conflict exists update it. Let’s take a practical example.
Assume you have a web scraper that imports product information into a table. Each product has a UPC code, title, description, and link. There’s a unique constraint on the UPC code. Now, if your web scraper tries to insert a new product, and a product with the same UPC already exists, you’d usually get an error. But you don’t want the query to fail, you’d want to update the existing product instead. Maybe with a new image, maybe a new description, whatever have you, but I don’t want it to blow up… I simply want to capture the new data and save it.
So before: Insert a record… Exception this violates a unique constraint… Let your app figure out what to do. protip: often applications would try to work around this, but you can run a chance of a race condition and duplicate records if there’s a conflict. TLDR; it’s not a perfect solution.
Now: Insert a record… There’s a unique constraint violation… Okay, let’s just update all the new record’s fields inside a single transaction
So enough explanation, here’s how it actually looks in the syntax:
INSERT INTO products (
upc,
title,
description,
link)
VALUES (
123456789,
‘Figment #1 of 5’,
‘THE NEXT DISNEY ADVENTURE IS HERE - STARRING ONE OF DISNEY'S MOST POPULAR CHARACTERS! ’,
‘http://www.amazon.com/dp/B00KGJVRNE?tag=mypred-20’
)
ON CONFLICT DO UPDATE SET description=excluded.description;
It’s been a long time coming for this, and it makes building applications that need this kind of behavior even easier. While it would have been great for this to be available years ago, kudos to Postgres and its community for taking the approach that is safe for your data. The result we have now both provides the desired behavior of create or update, and is performant without the risk of race conditions for your data.


App Store Apple
Mobile App Captioncall
Download Apps From The App Store On Your Mac Apple Support
New App Store Marketing Tools Available News Apple Developer
App Store Png Logo Apple Store Ios Icon Free Download Free Transparent Png Logos
I Can T Download Facebook App In App Store Apple Community
Download App Download On The Apple Store Vector Png Image Transparent Png Free Download On Seekpng
How To Manually Update Apps On Your Apple Device Apple Support
How To Download Apps And Games From The App Store Imore
Apple Support App For Iphone Free Download Apple Support For Ipad Iphone At Apppure
Rgt Cycling Get Started Join Rgt Cycling It S Free
How To Create An Apple Id Account And Download Apps From Apple App Store
Share App Store Itunes Store And Apple Books Purchases With Family Sharing Apple Support
Itunes 12 6 4 Released As Minor Update To Version With Built In App Store Macrumors
Tutorial How To Add An Official Download On The App Store Badge To Your Website In 3 Steps Jacob Ruiz
Download Our App Bartlesville Animal Hospital
How To Download Deleted Apps From The App Store On Any Apple Device
Watchos 6 How To Download Apps Directly On Apple Watch 9to5mac
How To Download Iphone Apps You Ve Already Purchased
Can T Download Videos App From The App St Apple Community
How To Download Apps Without App Store On Iphone Ipad
Apple Increases Over The Air App Store Download Limit To 200mb Macrumors
Ankiapp The Best Flashcard App To Learn Languages And More
観光に便利 超簡単 アメリカのアプリダウンロード方法とオススメアプリ一覧 The Best App For Ny Life And Sightseeing How To Change The Country Of Apple Id ワーママデトックス
Apple Now Lets You See What Data Apps Collect Before You Hit Download Cnet


class: title-slide # Methods for Estimating Causal Effects for Multivariate Continuous Exposures ## Justin Williams ### 2020-11-05

 --- class: center, middle, inverse # Introduction --- # What If... .pull-left[ .small[ - Q: "*What if* the batter had swung?" - "What-if" questions require us to think causally and imagine unobserved potential outcomes - Inability to observe all potential outcomes - Fundamental problem of causal inference (Holland, 1986) - Third rung of ladder of causation (Pearl and Mackenzie, 2018) ] ] .pull-right[ <video width="560" height="315" controls> <source src="https://sporty-clips.mlb.com/8b0a7a89-c0af-40a7-aa57-032817d03177.mp4" type="video/mp4"> </video> ] --- # Background - Gold standard for answering causal questions is the randomized clinical trial - Balance on known and unknown confounders - However, using the gold standard RCT may not be possible in real world settings - Unrealistic, e.g., surgery vs. placebo - Unethical, e.g., forcing patients to smoke - How to estimate causal effects without randomization? - Exposure may be systematically related to outcome - Utilize propensity score method (Rosenbaum and Rubin, 1983) > .small[.dodger-blue[Propensity score] = Probability of receiving exposure given set of confounders] `\begin{align} \Pr(D=1\mid C) \end{align}` --- # Brief History of Propensity Score **Estimation** 1. Originally proposed by Rosenbaum and Rubin (1983) - Handled binary exposure only, i.e., exposed vs. control 1. Methods extended to categorical, or multiple, treatments by Imbens (2000) - Term "generalized propensity score" (GPS) is introduced 1. Adaptions for continuous treatments introduced by Hirano and Imbens (2004); Imai and Van Dyk (2004) - Use Gaussian densities for estimating probability of exposure level **Bias Removal** 1. Covariate adjustment 1. Subclassification/stratification 1. Matching 1. Inverse probability of treatment weighting (IPTW) ??? - Throughout we use GPS to refer to continuous rather than categorical treatment --- # Propensity Score with Continuous Exposure .small[ - Popular applications - *Economics*: difference in employment outcomes due to length of time in job training program (Flores, Flores-Lagunes, Gonzalez, and Neumann, 2012; Kluve, Schneider, Uhlendorff, and Zhao, 2012) - *Health outcomes*: childhood obesity and duration of breastfeeding (Jiang and Foster, 2013) - *Education policy*: transfer rate and number of credits taken (Doyle, 2011) - Methodology development - SuperLearner (Kreif, Grieve, Díaz, and Harrison, 2015) - Kernel density estimation (Flores, Flores-Lagunes, Gonzalez, and Neumann, 2012) - Gradient boosting (Zhu, Coffman, and Ghosh, 2015) - Covariate balancing generalized propensity score (CBGPS) (Fong, Hazlett, and Imai, 2018) - Entropy balancing (Vegetabile, Griffin, Coffman, Cefalu, and McCaffrey, 2020; Tübbicke, 2020) ] --- # Multivariate Continuous Exposures - All methodological development has focused on single univariate continuous exposure - Multiple exposures noted only briefly in Imai and Van Dyk (2004) - Need for methods to handle multivariate exposures - Identify potential combination therapies from observational studies - COVID-19 treatments (Sanders, Monogue, Jodlowski, and Cutrell, 2020) - Estimate combined effects of childhood obesity intervention programs in the community - Challenges: - Define multivariate densities for generalized propensity score - Multiple sets of confounders - Correlation of exposures - Assessing high dimensional balance - Properly defining estimable multivariate region for inference --- class: center, middle, inverse # Motivating Example --- # Project Goal - High obesity rates of low-income 2-5 year olds in Los Angeles County (PHFE WIC, 2010) - 20% classified as obese during period from 2003-2009 - Estimate causal effects of non-randomly assigned obesity interventions on WIC preschool-aged child obesity rates - Early Childhood Obesity Systems Science (ECOSyS) study funded by NIH [R01 HD072296](https://grantome.com/grant/NIH/R01-HD072296-01A1) - Intervention Period: 2010-2016 - Exposure: - WIC intervention programs - Outcome: - Change in obesity prevalence from post- to pre-intervention measured at census tracts

 ??? - In 2018 WIC served approximately half of all children under age 5 in Los Angeles County --- # Outcome Data .pull-left[ .small[ - Source: - WIC administrative data - Part of the [WIC Data Mining Project](https://lawicdata.org) - Pulled from 2007-2016 - Quantification: - Obesity prevalence at census tracts - Include only census tracts with at least 30 WIC children for all years - Total of 1079 included - Pre-intervention=2007-2009 - Post-intervention=2012-2016 - Allow for lagged treatment effect `$$Y=\bar{p}_{post}-\bar{p}_{pre}$$` ] ] .pull-right[  ] --- # Exposure Data .pull-left[ .small[ - Source: - Interviews with WIC staff - Total of 32 programs identified across 7 WIC agencies in LAC - Targeted 8 regions during interview process - Quantification: 1. Categorize intervention strategies used by program 2. Construct adapted "intervention dose index" 3. Identify clinics that implemented intervention 4. Map dose from clinics to census tracts ] ] .pull-right[  ] --- # Intervention Strategies - Classified interventions into 9 potential strategies - Grouped as **micro** (targeted individuals) or **macro** (general population)

  # 	  Name 	  Group 	  n (%)

  1 	  Government Policies 	  Macro 	  1 (3%)

  2 	  Institutional Polices 	  Macro 	  4 (12%)

  3 	  Infrastructure Investments 	  Macro 	  3 (9%)

  4 	  Business Practices 	  Macro 	  4 (12%)

  5 	  Group Education 	  Micro 	  21 (66%)

  6 	  Counseling 	  Micro 	  14 (44%)

  7 	  Health Communication 	  Micro 	  17 (53%)

  8 	  Home Visitation 	  Micro 	  8 (25%)

  9 	  Screening and Referral 	  Micro 	  14 (44%)

 ??? - Micro strategies were more frequently used than macro - Program could use multiple strategies --- # Intervention Dose Index .pull-left[ .footnotesize[ - Developed to quantify community exposure (Wang, Crespi, Jiang, Nobari, Roper-Fingerhut, Rauzon, Robles, Blocklin, Davoudi, Kuo, MacLeod, Seto, Whaley, and Prelip, 2018) `\begin{align} IDI = RS \times FS \times SS \end{align}` - `\(RS\in[0,1]\)` = reach score: - probability of receiving the intervention program - `\(FS\in[0,1]\)` = fidelity score: - degree to which program was followed during implementation - `\(SS\in[1,9]\)` = strength score: - effectiveness of strategy as rated by subject matter experts - Estimated for each strategy and then summed by group, macro and micro ] ] .pull-right[

Adapted IDI construction example

 ] ??? - We assume FS=1 for all programs and omit SS in our adapted version as we want to estimate this from the data --- # Catchment Areas .panelset[ .panel[.panel-name[Description] - Inherent geographic misalignment - Exposure data on intervention programs at **clinic locations** - Outcome data on obesity rates at **census tracts** - Construct mapping using catchment areas - Catchment area construction: 1. Based on client participation patterns of attendance at each clinic 1. Form a circle encompassing X% of clients who attend the clinic - Macro strategies: 80% - Micro strategies: 50% 1. Census tracts that overlap catchment area receive program IDI ] .panel[.panel-name[Comparison] .pull-left[ ***Micro***  ] .pull-right[ ***Macro***  ] ] ] ??? - Key feature is that macro catchment areas are larger than micro reflecting belief that they have broader impact than micro - Outlined we also see the 8 regions of interest where interviews were targeted --- # Exposure Dose  ??? - In red is the trimmed convex hull region at the 95th quantile - Each point represents a census tract --- class: center, middle, inverse # Multivariate Generalized Propensity Score ## mvGPS --- # Notation - `\(Y\)`: outcome of interest - `\(\mathbf{D}\)`: multivariate exposure of dimension `\(m\)` - In simulation study and application we fix `\(m=2\)`, i.e., bivariate exposure - `\(\mathcal{C}=\{\mathbf{C}_{1}, \dots, \mathbf{C}_{m}\}\)`: set of random variables of length `\(m\)` - Each `\(\mathbf{C}_{j}\)` for `\(j=1,\dots,m\)`, is a `\(p_{j}\)` vector of baseline confounders associated with the `\(j^{th}\)` exposure and outcome - `\(Y_{i}(\mathbf{d})\)`: potential outcome of `\(i^{th}\)` subject assigned exposure vector `\(\mathbf{d}=(d_{1},\dots,d_{m})\)` - `\(\mu(\mathbf{d})=\mathbb{E}[Y(\mathbf{d})]\)`: average dose-response function - `\(n\)`: total number of units - `\(C_{ijk}\)`: `\(k^{th}\)` confounder of the `\(j^{th}\)` exposure for the `\(i^{th}\)` individual - Observed data - `\((Y_{i}, D_{i1},\dots,D_{im}, C_{i11}, \dots, C_{i1p_{1}}, \dots, C_{im1}, \dots, C_{imp_{m}})\)` --- # Identifying Assumptions .panelset[ .panel[.panel-name[Overview] - Three key assumptions for valid causal quantities 1. Weak ignorability 1. Positivity 1. Stable-unit treatment value (SUTVA) ] .panel[.panel-name[Weak ignorability] - Exposure is conditionally independent of the potential outcomes given the appropriate set of confounders. `\begin{align} Y_{i}(\mathbf{d})\perp \!\!\! \perp\mathbf{D}_{i}\mid \mathcal{C} \quad \forall \quad \mathbf{d}\in\mathcal{D}. \end{align}` - Replace `\(\mathcal{C}\)` with `\(f_{\mathbf{D}\mid\mathcal{C}}\)` - Especially with high dimensional set and/or continuous confounders - Difficult to rationalize - Requires perfect knowledge *and* collection of confounders - We assume it holds, i.e., no unmeasured confounding - "Weak" refers to conditional independence for *each* level of exposure not *joint* distribution of exposures ] .panel[.panel-name[Positivity] .pull-left[ - All units have the potential to receive a particular level of exposure given any value of the confounders `\begin{align} 0<f_{\mathbf{D}\mid\mathcal{C}}(\mathbf{D}=\mathbf{d}\mid \mathcal{C})<1 \quad \forall \quad \mathbf{d}\in\mathcal{D} \end{align}` - Grid or **convex hull** - **Trimmed** or untrimmed ] .pull-right[  - `\(\text{Cov}(D_{1}, D_{2})=0.5\)` - .indian-red[Convex hull] and .dodger-blue[grid] ] ] .panel[.panel-name[SUTVA] - The potential outcome of each unit does not depend on the exposure that other units receive *and* that there exists only one version of each exposure - Assumes there is no interference between units - No herd immunity - No errors in defining the potential outcomes caused by **multiple versions** of the exposure - `\(Y_{i} = Y_{i}(\mathbf{d})\)` ] ] --- # mvGPS - Conditional probability of receiving multivariate exposure given set of confounders `\begin{align} f(\mathbf{D}|\mathbf{C}_{1},\dots,\mathbf{C}_{m}) \end{align}` - For bias removal construct inverse probability of treatment weights `\begin{align} w=\frac{f(\mathbf{D})}{f(\mathbf{D}|\mathbf{C}_{1},\dots,\mathbf{C}_{m})}, \end{align}` - Propose multivariate normal models `\begin{align} \mathbf{D}\sim \text{N}_{m}(\boldsymbol{\mu}, \boldsymbol{\Sigma}) \quad \mathbf{D}\mid \mathbf{C}_{1},\dots,\mathbf{C}_{m}\sim \text{N}_{m}\Bigg(\begin{bmatrix}\boldsymbol{\beta}_{1}^{T}\mathbf{C}_{1}\\ \vdots \\ \boldsymbol{\beta}_{m}^{T}\mathbf{C}_{m}\end{bmatrix}, \boldsymbol{\Omega}\Bigg), \end{align}` - Tractable, well-behaved asymptotics, full univariate conditionals - Estimate parameters using ordinary least squares --- # Properties of mvGPS weights - Returns consistent estimate of average dose-response function - `\(\mathbb{E}[wY\mid\mathbf{D}]=\mathbb{E}[Y(\mathbf{d})]\)` - Covariance between each exposure, `\(D_{j}\)` and confounder, `\(C_{jk}\)`, is zero - `\(\mathbb{E}[w(D_{j}-\mu_{D_j})(C_{jk}-\mu_{C_{jk}})]=0\)` - Weights are normalized and maintain marginal moments - `\(\mathbb{E}[w]=1\)` - `\(\mathbb{E}[w D_{j}]=\mathbb{E}[D_{j}]\)` - `\(\mathbb{E}[w\mathbf{C}_{j}]=\mathbb{E}[\mathbf{C}_{j}]\)` --- class: center, middle, inverse # Simulation Study --- # Design - Sample size : `\(n=200\)` - Repetitions: `\(B=1000\)` - Compare mvGPS to other univariate alternative methods - Covariate balancing generalized propensity score, CBGPS, (Fong, Hazlett, and Imai, 2018) - Entropy balancing (Tübbicke, 2020) - Generalized linear propensity score, PS - Simulate bivariate normal exposure - marginal correlation - overlap of confounding sets - Effect of trimming weights (Kang and Schafer, 2007) - None vs. 99th quantile vs 95th quantile ??? - Univariate methods may perform well when exposures are highly correlated and have the same confounders - Perform poorly with weakly correlated exposures and/or separate sets of confounders --- # Scenarios .pull-left[ .small[ - M1: No common confounding - Each exposure has separate set of confounders - `\(\mathbf{C}_{1}\)` and `\(\mathbf{C}_{2}\)` - M2: Partially common confounding - Each exposure have some unique confounders but also share set of common confounders - `\(\mathbf{C}_{1}\)`, `\(\mathbf{C}_{2}\)`, and `\(\mathbf{C}_{12}\)` - M3: Common confounding - Both exposures share exact same set of common confounders - `\(\mathbf{C}_{12}\)` ] ] .pull-right[  ] --- # Balance Results .panelset[ .panel[.panel-name[Setup] - Three balance metrics were assessed 1. Average exposure-covariate correlation 1. Maximum exposure-covariate correlation 1. Effective sample size, `\((\Sigma_i w_i)^{2}/\Sigma_i w_i^2\)` ] .panel[.panel-name[Avg Correlation]  ] .panel[.panel-name[Max Correlation]  ] .panel[.panel-name[ESS]  ] ] ??? - Average summarizes total balance on all confounders - Max describes the most imbalanced confounder - ESS is equivalent to the relative power for inference --- # Dose Response Results .panelset[ .panel[.panel-name[Setup] - Two performance metrics were assessed 1. Absolute total bias 1. Root mean squared error (RMSE) ] .panel[.panel-name[Bias]  ] .panel[.panel-name[RMSE]  ] ] --- # Takeaways - Multivariate methods are critical for achieving proper balance across multiple exposures - Protects against any single confounder being strongly imbalanced - Slight penalty of lower average balance in certain scenarios - Univariate methods achieved best balance with high overlap of confounders - Despite balance, high total bias of treatment effects - Using multivariate weights decreased ESS resulting in lower power and higher RMSE - Weight trimming reduced these effects, `\(q=0.99\)` --- class: center, middle, inverse # Application Results ## Estimating Causal Effect of WIC Intervention --- # Potential Confounders .small[ - Three data sources used: American Community Survey, WIC Admin, and NETS - All values for propensity equation are average of three years prior to intervention, i.e., 2007-2009 American Community Survey 1. % Spanish Speaking 1. Median Household Income 1. % with at least High School Diploma 1. % of population less than 5 years old WIC Admin 1. Obesity Prevalence 1. Overweight Prevalence NETS (National Establishment Time-Series) 1. Healthy Food Outlets per sq. mile 1. Unhealthy Food Outlets per sq. mile ] --- # Covariate Balance Total   --- # Covariate Balance Summary | **Max Abs. Corr.** | **Avg. Abs. Corr.** | **ESS** | **Method** | |:------------------:|:-------------------:|:-------:|:---------------:| | 0.12 | 0.04 | 637 | mvGPS | | 0.18 | 0.08 | 580 | CBGPS (Macro) | | 0.22 | 0.07 | 659 | PS (Macro) | | 0.25 | 0.08 | 541 | Entropy (Macro) | | 0.35 | 0.12 | 779 | Entropy (Micro) | | 0.37 | 0.14 | 828 | PS (Micro) | | 0.49 | 0.16 | 679 | CBGPS (Micro) | | 0.41 | 0.19 | 1079 | Unweighted | --- # Dose-Response Surface   --- # Takeaways **Balance** - Significant imbalance prior to weighting - mvGPS had greater reduction in imbalance than univariate methods - ESS for all methods are reduced but power is still reasonably high **Dose-Response** - *Unweighted* estimate was monotonic plane where effectiveness increased as you increased either exposure dose - *mvGPS* estimate was a saddle with optimal effectiveness using high micro and low macro - Showed that high levels of both exposures was less effective --- # Exploring Tail Behavior   --- # Discussion

 - Achieved balance across multiple simultaneous exposures - Adapted for confounding sets and/or correlation of exposures - Visualized and interpreted effect of two continuous interventions with dose-response surface - Defined high dimensional positivity space with convex hull - [mvGPS](https://cran.r-project.org/package=mvGPS) R package available now on CRAN ### Limitations - Multivariate normal parametric distribution - Investigation of higher dimensional exposure - Time-varying multivariate exposure - Multiple versions possible for macro and micro doses - Geographic interference (SUTVA violations) --- # References I .tiny[ Doyle, W. R. (2011). "Effect of increased academic momentum on transfer rates: an application of the generalized propensity score". In: _Economics of Education Review_ 30.1, pp. 191-200. Flores, C. A., A. Flores-Lagunes, A. Gonzalez, and T. C. Neumann (2012). "Estimating the effects of length of exposure to instruction in a training program: The case of job corps". In: _Review of Economics and Statistics_ 94.1, pp. 153-171. Fong, C., C. Hazlett, and K. Imai (2018). "Covariate balancing propensity score for a continuous treatment: application to the efficacy of political advertisements". In: _Annals of Applied Statistics_ 12.1, pp. 156-177. Hirano, K. and G. W. Imbens (2004). "The propensity score with continuous treatments". In: _Applied Bayesian Modeling and Causal Inference from Incomplete-Data Perspectives_. Ed. by A. Gelman and X. Meng. Hoboken, N.J.: John Wiley & Sons, pp. 73-84. Holland, P. W. (1986). "Statistics and Causal Inference". In: _Journal of the American Statistical Association_ 81.396, pp. 945-960. Imai, K. and D. A. Van Dyk (2004). "Causal inference with general treatment regimes: Generalizing the propensity score". In: _Journal of the American Statistical Association_ 99.467, pp. 854-866. Imbens, G. W. (2000). "The role of the propensity score in estimating dose-response functions". In: _Biometrika_ 87.3, pp. 706-710. Jiang, M. and E. M. Foster (2013). "Duration of breastfeeding and childhood obesity: a generalized propensity score approach". In: _Health Services Research_ 48.2.1, pp. 628-651. Kang, J. D. and J. L. Schafer (2007). "Demystifying double robustness: A comparison of alternative strategies for estimating a population mean from incomplete data". In: _Statistical Science_ 22.4, pp. 523-539. Kluve, J., H. Schneider, A. Uhlendorff, and Z. Zhao (2012). "Evaluating continuous training programmes by using the generalized propensity score". In: _Journal of the Royal Statistical Society: Series A_ 175.2, pp. 587-617. Kreif, N., R. Grieve, I. Díaz, and D. Harrison (2015). "Evaluation of the effect of a continuous treatment: A machine learning approach with an application to treatment for traumatic brain injury". In: _Health Economics_ 24.9, pp. 1213-1228. ] --- # References II .tiny[ Pearl, J. and D. Mackenzie (2018). _The Book of Why: The New Science of Cause and Effect_. New York: Basic Books. PHFE WIC (2010). _WIC data 2003-2009: A report on low income families with young children in Los Angeles County_. Technical Report. Special Supplemental Nutrition Assistance Program for Women, Infants and Children. Rosenbaum, P. R. and D. B. Rubin (1983). "The central role of the propensity score in observational studies for causal effects". In: _Biometrika_ 70.1, pp. 41-55. Sanders, J. M., M. L. Monogue, T. Z. Jodlowski, and J. B. Cutrell (2020). "Pharmacologic Treatments for Coronavirus Disease 2019 (COVID-19): A Review". In: _JAMA_ 323.18, pp. 1824-1836. Tübbicke, S. (2020). "Entropy Balancing for Continuous Treatments". In: _arXiv preprint arXiv:2001.06281_. arXiv: 2001.06281 [econ.EM]. Vegetabile, B. G., B. A. Griffin, D. L. Coffman, M. Cefalu, et al. (2020). "Nonparametric Estimation of Population Average Dose-Response Curves using Entropy Balancing Weights for Continuous Exposures". In: _arXiv preprint arXiv:2003.02938_. arXiv: 2003.02938 [stat.ME]. Wang, M. C., C. M. Crespi, L. H. Jiang, T. Nobari, et al. (2018). "Developing an index of dose of exposure to early childhood obesity community interventions". In: _Preventive Medicine_ 111, pp. 135-141. Zhu, Y., D. L. Coffman, and D. Ghosh (2015). "A boosting algorithm for estimating generalized propensity scores with continuous treatments". In: _Journal of Causal Inference_ 3.1, pp. 25-40. ] --- class: inverse # Thank You! .pull-right[

 <a<EMAIL_ADDRESS>.white[
<EMAIL_ADDRESS>  .white[
williazo]   .white[
ORCID]   .white[
arXiv]

 ]

 --- # Dose Refinements 1. Radius truncation 1. Micro exposure inverse distance weighting 1. Overlapping catchment area adjustment --- # Dose Refinement Example


PuTTY ssh key
Can import into PuTTY or work with it by installing:
apt install putty-tools
# puttygen *.ppk -O private-openssh -o ssh.pem


| Settings | - | |
|---|---|---|
| Hide unobtainable maps | ||
| Hide completed maps | ||
| Lock completion | ||
| Color completed maps | ||
| Alphabetic ordering | ||
| Column delimiter | ||
| Striped tables | ||
| Smaller font | ||
| Reset browser data | ||
| Use chrome extension or AHK script to get data. | ||
| Map data pulled from poedb.tw |
| Query / Import / Export | - | |||
|---|---|---|---|---|
| Query Import Export | ||||
| Account: | ||||
| League: | ||||
| Data: | ||||
| T1 | T5 | T9 | T13 | |
| T2 | T6 | T10 | T14 | |
| T3 | T7 | T11 | T15 | |
| T4 | T8 | T12 | T16 |
| Maps owned by tiers | - | |||
|---|---|---|---|---|
| Tier 1: | Tier 5: | Tier 9: | Tier 13: | |
| Tier 2: | Tier 6: | Tier 10: | Tier 14: | |
| Tier 3: | Tier 7: | Tier 11: | Tier 15: | |
| Tier 4: | Tier 8: | Tier 12: | Tier 16: |
| Maps in pool by tiers | - | |||
|---|---|---|---|---|
| Tier 1: | Tier 5: | Tier 9: | Tier 13: | |
| Tier 2: | Tier 6: | Tier 10: | Tier 14: | |
| Tier 3: | Tier 7: | Tier 11: | Tier 15: | |
| Tier 4: | Tier 8: | Tier 12: | Tier 16: |


Lighten-3
Lighten-2
Lighten-1
Primaries
Darken-1
Darken-2
Darken-3
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Paragraph
If you need to buy papers or custom essays, you have arrived at the ideal place! We offer guarantees that any essay work provided by our professional writing services will be entirely free of plagiarism and 100% freshly written. At BestEssayService.net, we make sure our customers are fully satisfied every time they use our custom term paper writing service.
Our essay and research paper writing services are provided by a large team of editing, writing and research specialists who can help you with all types of coursework, whether you have essays, term papers, research papers, theses or dissertations to complete. Our essay writers are able to help you with all subject matters for all education levels, no matter if you are a high school student or studying for a PhD or Master's degree.
List style
Subtitle
By utilizing elements and principles of Material Design, we were able to create a framework that incorporates
By utilizing elements and principles of Material Design, we were able to create a framework that incorporates
Quotation
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and
Normal Normal
Hover Hover
Active Active
Number of pages Number of pages
Dropdown normal Dropdown normal
Dropdown hover Dropdown hover
Dropdown active Dropdown active
Normal
Hover
Disabled
Normal
Hover
Disabled
Pagination
Information popup
Social pics