Creating the Component Tag Handler
After you create your component and renderer classes, you’re ready to define how a tag handler processes the tag representing the component and renderer combination.
In JavaServer Faces applications, the tag handler class associated with a component drives the Render Response phase of the JavaServer Faces lifecycle. For more information on the JavaServer Faces lifecycle, see The Lifecycle of a JavaServer Faces Application.
The first thing that the tag handler does is to retrieve the type of the component associated with the tag. Next, it sets the component’s attributes to the values given in the page. It then returns the type of the renderer (if there is one) to the JavaServer Faces implementation so that the component’s encoding can be performed when the tag is processed. Finally, it releases resources used during the processing of the tag.
The image map custom component includes two tag handlers: AreaTag and MapTag. To see how the operations on a JavaServer Faces tag handler are implemented, let's take a look at MapTag.
The class extends javax.faces.webapp.UIComponentELTag, the base class for all JavaServer Faces tags that correspond to a component.
Retrieving the Component Type
As explained earlier, the first thing the MapTag tag handler class does is to retrieve the type of the component. It does this by using the getComponentType method:
@Override public String getComponentType() { return ("DemoMap"); }
The value returned from getComponentType must match the value configured for the component with the componentType attribute of the @FacesComponent annotation. (Registering a Custom Component explains how to configure a component in the application configuration resource file.)
Setting Component Property Values
After retrieving the type of the component, the tag handler sets the component’s property values to those supplied as tag attributes values in the page. This section assumes that your component properties are enabled to accept expressions, as explained in Enabling Component Properties to Accept Expressions.
Getting the Attribute Values
Before setting the values in the component class, the tag handler first gets the attribute values from the page by means of JavaBeans component properties that correspond to the attributes. The following code shows the property used to access the value of the immediate attribute.
private ValueExpression immediate = null; public void setImmediate(ValueExpression immediate) { this.immediate = immediate; }
As this code shows, the setImmediate method takes a javax.el.ValueExpression object. This means that the immediate attribute of the tag accepts value expressions.
Similarly, the setActionListener and setAction methods take javax.el.MethodExpression objects, which means that these attributes accept method expressions. The following code shows the properties used to access the values of the actionListener and the action attributes.
private MethodExpression actionListener = null; public void setActionListener( MethodExpression actionListener) { this.actionListener = actionListener; } private MethodExpression action = null; public void setAction(MethodExpression action) { this.action = action; }
Setting the Component Property Values
To pass the value of the tag attributes to the component, the tag handler implements the setProperties method. The way setProperties passes the attribute values to the component class depends on whether the values are value expressions or method expressions.
Setting Value Expressions on Component Properties
When the attribute value is a value expression, setProperties first checks if it is not a literal expression. If the expression is not a literal, setProperties stores the expression into a collection, from which the component class can retrieve it and resolve it at the appropriate time. If the expression is a literal, setProperties performs any required type conversion and then does one of the following:
If the attribute is renderer-independent, meaning that it is defined by the component class, setProperties calls the corresponding setter method of the component class.
If the attribute is renderer-dependent, setProperties stores the converted value into the component’s map of generic renderer attributes.
The following piece of the MapTag handler's setProperties method sets the renderer-dependent property, styleClass, and the renderer-independent property, immediate:
if (styleClass != null) { if (!styleClass.isLiteralText()) { map.setValueExpression("styleClass", styleClass); } else { map.getAttributes().put("styleClass", styleClass.getExpressionString()); } } ... if (immediate != null) { if (!immediate.isLiteralText()) { map.setValueExpression("immediate", immediate); } else { map.setImmediate( Boolean.valueOf(immediate.getExpressionString()).booleanValue()); } }
Setting Method Expressions on Component Properties
The process of setting the properties that accept method expressions is done differently depending on the purpose of the method. The actionListener attribute uses a method expression to reference a method that handles action events. The action attribute uses a method expression either to specify a logical outcome or to reference a method that returns a logical outcome, which is used for navigation purposes.
To handle the method expression referenced by actionListener, the setProperties method must wrap the expression in a special action listener object called MethodExpressionActionListener. This listener executes the method referenced by the expression when it receives the action event. The setProperties method then adds this MethodExpressionActionListener object to the list of listeners to be notified when the event of a user clicking on the map occurs. The following piece of setProperties does all of this:
if (actionListener != null) { map.addActionListener( new MethodExpressionActionListener(actionListener)); }
If your component fires value change events, your tag handler’s setProperties method does a similar thing, except it wraps the expression in a MethodExpressionValueChangeListener object and adds the listener using the addValueChangeListener method.
In the case of the method expression referenced by the action attribute, the setProperties method uses the setActionExpression method of ActionSource2 to set the corresponding property on MapComponent:
if (action != null) { map.setActionExpression(action); }
Providing the Renderer Type
After setting the component properties, the tag handler provides a renderer type (if there is a renderer associated with the component) to the JavaServer Faces implementation. It does this using the getRendererType method:
@Override public String getRendererType() { return ("DemoMap"); }
The renderer type that is returned is the name under which the renderer is registered with the application. See Delegating Rendering to a Renderer for more information.
If your component does not have a renderer associated with it, getRendererType should return null. In this case, the rendererType element in the @FacesRenderer annotation should also be set to null.
Releasing Resources
It’s recommended practice that all tag handlers implement a release method, which releases resources allocated during the execution of the tag handler by first calling the UIComponentTag.release method, then setting the resource values to null. The release method of MapTag is as follows:
@Override public void release() { super.release(); current = null; styleClass = null; actionListener = null; action = null; immediate = null; styleClass = null; }


Organ and Tissue Donation
Points
Be a donator
Click to get 20 points daily!
Daily Click
Organ Need
WAITING Number
Donator Table
| No. |
First Name |
Last Name |
Donated Organ |
<{foreach $donators as $donator}>
| <{$donator.id}> |
<{$donator.first_name}> |
<{$donator.last_name}> |
<{$donator.organ}> |
<{/foreach}>


Welcome to the Kingdom
Make me an instrument of your peace...
Welcome, friend. You've stumbled on the website of the Kingdom of Cyprus, a sovereign subject of international law, a movement dedicated to preserving the treasures of both Christianity and the English-speaking peoples in these troubled times.
Interesting Pages
There are so many ways you could begin your journey...
- A description of the Kingdom;
- Hosker's Canons;
- Search this site.


home
our menu
about us
contact us
Cart
Cart is empty
Total:
Confirm order
Your order will be delivered in x minutes


One viewport before flying carpet.
Scroll down to see demo.
Should collapse, Doubleclick / Doesn't exits Ad
↓ advertisement ↓
↑ advertisement ↑
Keep Scrolling for another ad
Should Collapse, Collapsing Test _ping_ Ad
↓ advertisement ↓
↑ advertisement ↑
Keep Scrolling for another ad
Should not collapse, even though _ping_ Ad Collapses
↓ advertisement ↓
↑ advertisement ↑
Keep Scrolling for another ad
Should not collapse, even though _ping_ Ad Collapses, in a complex case
↓ advertisement ↓
I am a text node in the flying carpet
↑ advertisement ↑
One viewport after flying carpet


Hanging Up * (out of * * * * )
Directed by Diane Keaton. Cast: Meg Ryan, Walter Matthau, Lisa Kudrow, Diane Keaton, Adam Arkin, Jesse James, Cloris Leachman, Edie McClurg. 2000 - 92 minutes Rated PG-13 (for profanity). Reviewed by Dustin Putman, February 19, 2000.
"Meg Ryan is irresistible in the comedy that celebrates sisterhood!," screams the television ads for "Hanging Up," disastrously written by real-life sisters Delia and Nora Ephron and sloppily directed by Diane Keaton.  Not only is "Hanging Up" misadvertised, since the film wholeheartedly focuses on middle sister Meg Ryan and gives her two co-stars, Lisa Kudrow and Diane Keaton, little more than extended cameos, but they don't actually come together until the final ten to fifteen minutes. And we are supposed to believe their strong bond, and smile in the last scene when they rekindle their rocky relationship, despite them being apart for the majority of the running time? Excuse me, again, while I almost bust a gut at that truly delusional notion.
Eve Marks (Meg Ryan) is the middle Mozzell sister, still living in the California town where she grew up, and with a husband (Adam Arkin) and pre-teen son (Jesse James). Her elderly, wisecracking father, Lou (Walter Matthau, in his brightest performance in years) has just recently been put into the hospital, in the final stages of what I assume is Alzheimer's (even though the film never enlightens us on exactly what is wrong with him). While Eve's relationship with her mother (Cloris Leachman) is nearly nonexistent, since she ran out on Lou and her children years ago, she has had her fair share of up's and down's with Lou, who used to be an alcoholic. Her older sister is Georgia (Diane Keaton), an editor for the self-titled magazine, "Georgia," while Maddy (Lisa Kudrow) is the youngest, a soap opera actress. Interestingly, their professions are given, but we not once ever see them working at their jobs, or, for that matter, learn much of anything about them. Maddy, Georgia, and Eve do not see each other much anymore, their adult lives gradually causing them to drift apart, but they do manage to consistently talk on the phone to one another. And they talk. And talk. And talk...
In fact, the telephone is the major star of the film, even more so than Ryan, as it appears in virtually every scene of this interminable 92-minute catastrophe that feels like its three hours long. If you are able to get through the opening half-hour, in which phones ring so much you feel like jumping through the screen and taking a sledgehammer to them, you will surely survive the rest. The question is, who would want to subject themselves to this resolutely irritating, self-involved pat-on-the-back?
How could a comedy-drama that has the star-power of Meg Ryan, Lisa Kudrow, and Diane Keaton be so very bad in so many different ways? Issues from the past involving the possible jealousy each has had for one of the others is fleetingly brought up, but the film isn't mature enough to deal with such a thing in a thoughtful manner, and since we learn next to nothing about their childhood, it is a lost cause that comes off as nothing more than an afterthought. Also, it is expected that the viewer quickly catch on to the tricky dynamic that the three sisters have with one another, but no dynamic metamorphosizes. And when they do reunite in the finale, their whole consanguinity is reduced to a repulsively annoying three-minute scene in which they argue like little children. You can see the impending death coming a mile away, and it conveniently occurs in the next scene, so that the three can quickly come to terms with themselves, and with each other. You think to yourself: "The only thing left for them to do is have a playful food-fight," and like clockwork, it also occurs by the end credits.
Meg Ryan is a versatile actress (look no further than 1998's "Hurlyburly" or 1994's "When a Man Loves a Woman"), despite her various detractors who stubbornly believe all she can do is romantic comedies. With "Hanging Up," the only thing she needs to do is completely sever her filmmaking ties with Nora Ephron, a writer/director/hack who shouldn't be allowed to work in Hollywood again after this big-budget, high-profile debacle. Even if she knew what she was making was not exactly up to par in the quality department, she nonetheless is very good, and the two scenes that work, flashbacks to Christmas 1988, when she had a heartbreaking run-in with her mother, and to Halloween 1993, when Lou crashed her son's birthday party in a drunken stupor, are effective because of the realism Ryan brings to the situations.
Diane Keaton, as Georgia, is better as an actress than a director here, but that is a wildly feeble compliment. What is more than a little far-fetched is that Keaton is distinctly older than Ryan and Kudrow, although in the very brief glimpses we get at them as children, she is no more than five years Ryan's senior. Yeah, right.
Lastly, poor Lisa Kudrow has been wasted once again in a big-screen venture, after her even more thin role in 1999's "Analyze This." Kudrow isn't given enough time to create a full personality with Maddy, so it isn't her fault she doesn't register until a few quiet moments sprinkled throughout where she is actually blessed with being given dialogue. If anything, though, Kudrow is a real talent, and I anxiously await the next time she is given a role more deserving of her time, as in her brilliantly nuanced, Oscar-caliber work in 1998's "The Opposite of Sex." If you are a fan of Kudrow's (and who isn't?), do yourself a favor and rent this gem that puts more good use to Kudrow in sixty seconds than "Hanging Up" does in its entirety.
As Eve's hardworking husband, Adam Arkin is, predictably, squandered with a role that gives him next to nothing to do, until a subplot reveals itself midway through, only to never be mentioned again. Cloris Leachman, as with Ryan and Matthau, makes a small, but noticeable impression with her, albeit, very brief appearance, while Edie McClurg, as a rosy-cheeked woman Lou had an affair with in the Christmas 1988 flashback, manages one of the few laughs in this otherwise joyless production.
Nearly all the emotions displayed within "Hanging Up" are patently manufactured, and despite the movie wanting the viewer to care about the characters, aside from Eve, why would you want to when they are all spoiled brats? If, for some bizarre, "Twilight Zone"-type of reason, you find yourself in a movie theater showing this film, my suggestion would be to hang up on it before the opening credits are over. Saying it is a waste of time is an understatement of epic proportions.
- Copyright 2000 by Dustin Putman Http://www.young-hollywood.com Http://www.atnzone.com
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


fun setNightMode(forceNight: Boolean, delay: Long = 0L): Unit
Force AppCompatDelegate Mode to night/notnight.
forceNight - Boolean that force night mode otherwise notnight is configured.
forceNight
delay - Delay to apply mode changes.
delay


{{record.Title}}
404
The link you are trying to access doesn't exist anymore.
This can happen due to link expiration period, or the link didn't exist in the first place.
This link is private.
If you are the owner of this link, please login so you can view it's contents.


{% extends "base.html" %} {% load url from future %} {% block script %} {% endblock %} {% block content %}
This service offers IPython notebook instances to participants in the San Diego Regional Data Library's Practical Data Analysis Program. To use the server, you will need to be a member of the SDRDL Data Analysts Github orgnaization.


ライセンス
openFrameworksは、MIT Licenseの元で配布しています。これは、いかなる文脈においても - 商用か非商用か、公的か私的か、ソースが公開か非公開か - に関わらず、全ての人が自由に使用できることを意味しています。
Copyright (c) 2004- openFrameworks Community
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Tell us about your desired role by clicking the button above. This will take not more than two minutes.
We will connect you with a professional experienced in your desired role who will help you in: understanding the role in detail; aligning your resume with the aspired role; and some interview tips
Guide someone aspiring your current/past role by sharing your knowledge and experience
Get connected with many mentors frequently to understand different perspectives about the role


class: center, top, title-slide # STAT 302, Lecture Slides 5 ## Statistical Inference ### Bryan Martin --- # Outline 1. Hypothesis Testing 2. Linear Models #### Appendices:

Probability

Random Variables

 .middler[**Goal:** Understand and learn how to apply statistical tests and models with real data!] --- class: inverse .sectionhead[Part 1. Hypothesis Testing] --- layout: true # Hypothesis Testing --- ## Motivation Hypothesis testing always begins with a scientific question of interest. Suppose we have a coin, and we want to test whether or not it is fair. We might flip the coin over and over and record the results, and then measure the proportion of times we got a heads. We can state this experiment more formally. Let `\(X_1,...,X_n\)` be `\(n\)` random variables corresponding to an indicator of whether a coin flip is heads (i.e. `\(X_i = 1\)` if the `\(i\)`th flip is heads, `\(0\)` if tails). We don't know the *true* probability that our coin lands on heads, so we may say that `$$X_i \stackrel{iid}{\sim} Bin(1, p),$$` with unknown probability parameter `\(p\)`.1 .footnote[[1] A binomial distribution with `\(n=1\)` is sometimes also denoted `\(Bernoulli(p)\)`] --- We are interested in whether our coin is fair, which corresponds to `\(p=\dfrac{1}{2}\)`. This hypothesis we are interested in testing will be our **null hypothesis**, denoted `\(H_0\)` (pronounced "H-naught" or "H-zero"). Alternatively, we may think that our coin is biased in either direction (i.e. either lands on heads too often or lands on tails too often). This corresponds to `\(p \neq \dfrac{1}{2}\)`. This is our **alternative hypothesis**, denoted `\(H_a\)` (or sometimes `\(H_1\)`). Thus, our hypothesis test is as follows: `\begin{align} H_0: p&=\dfrac{1}{2}\\ H_a: p&\neq \dfrac{1}{2} \end{align}` --- ## The hypotheses In general, we can think of * **Null hypothesis** `\(H_0\)`: our default assumption to be tested, our baseline, no relationships/differences/values of our parameters of interest. *Assumed to be true unless evidence suggests otherwise!* * **Alternative hypothesis** `\(H_a\)`: the alternative to our null, something interesting is happening in our data, our scientific hypothesis of interest An important note: for the most part, these are broad generalizations, not formal definitions! It is not always the case that the alternative is "interesting" and the null is not. However, we do typically set up our hypothesis tests so that this is the case! --- ## The testing .center[**We always assume that our null hypothesis is true!**] Our question is whether our data provides sufficient evidence to **reject the null** `\(H_0\)`. For example, if we flipped our coin 100 times and observed 99 heads, we probably would reject our null hypothesis that the coin is fair. If instead we flipped our coin 100 times and observed 52 heads, we probably would not conclude that we have enough evidence to reject our null hypothesis, and maintain our baseline assumption that the coin is fair. .center[**This style of thinking is key in all of statistics!**] Where we assume something is true, and then observe whether or not the evidence (data) supports this assumption. In hypothesis testing, we never, ever, ever examine whether our evidence supports our scientific hypothesis (the alternative)! We only examine whether it supports rejecting a baseline assumption (the null). --- layout: false # Populations and Samples * The difference between a **population** and a **sample** is fundamental in statistics! * **Inferential statistics:** using information from a sample to infer something about a population * "something about a population": we call this a **parameter**. A parameter is a numerical characteristic describing a population/model. * Example of a model/population: coin flips distributed `\(Bin(1, p)\)` * Example of a parameter: the probability of heads `\(p\)` --- # Populations and Samples * **Key idea:** the sample is not the population! * **Inferential statistics:** using information from a sample to infer something about a population * Use observed data to estimate the parameters --- # Estimates and Estimators We use **estimators** to calculate **estimates** for our **parameters** * **Estimator:** a function of our data (the mean, the sum, the number of heads) * **Estimate:** the number calculated from our data (an observed sample mean of 52, an observed sum of 117, 61 observed heads) --- layout: true # Example --- Back to our example, recall that we aim to test `\begin{align} H_0: p&=\dfrac{1}{2}\\ H_a: p&\neq \dfrac{1}{2} \end{align}` using a random variable representing a heads `$$X_i \stackrel{iid}{\sim} Bin(1, p).$$` Let's assume that we have the patience to flip our coin `\(n=100\)` times. --- Let's code this in R! (Who has time to flip 100 coins??) ```r # set the seed for reproducibility! set.seed(302) # the true population parameter, considered unknown! p <- 0.6 # simulate 100 coin flips coin_flips <- rbinom(100, size = 1, prob = p) head(coin_flips) ``` ``` ## [1] 1 0 0 1 1 1 ``` ```r sum(coin_flips) ``` ``` ## [1] 61 ``` We observed 61 heads out of 100 coin flips! This is our **test statistic**, a random variable calculated from our sample data which we will use to evaluate our hypotheses. --- We observed 61 heads out of 100 coin flips! Is this unusual enough to reject `\(H_0\)`? In order to answer this, we must ask ourselves: if we assume `\(H_0\)` is true, how unlikely is what we observed? *Before* we conduct our experiment, we must decide what cut-off we would like to use to determine whether or not to reject `\(H_0\)`. This cut-off is typically denoted by the greek letter `\(\alpha\)`. Typically, we reject `\(H_0\)` if the probability of observing a test statistic *as or more extreme* than what we observed is less than 5%. We will use this cut-off, even though it is arbitrary! Thus, we set `\(\alpha = 0.05\)`. --- We can use `pbinom()` to calculate the probability of observing a test statistic as extreme or more extreme than 61. * *"as extreme or more extreme"*: Our alternative `\(H_a: p \neq \frac{1}{2}\)` means that we are interested in bias in *either* direction. Thus, we must consider not only the probability of observing *more than* 61 heads, but also the probability of observing *less than* 39 heads, because this is just as extreme in the other direction! --- Note that `lower.tail = TRUE` is the default, and returns the probability of observing a value *less than or equal to* the value that we input. Thus, when `lower.tail = FALSE`, we return the probability of observing a value *strictly greater than* the value that we input. We want the probability of observing a value *greater than or equal to* the value that we input. Thus, we subtract 1 to make sure this value is included in our probability. ```r # record test statistic test_stat <- sum(coin_flips) # record how "extreme" our test statistic is diff_from_exp <- abs(50 - test_stat) # first component: probability of observing a test statistic as or more extreme # than ours less than the expected value # second component: probability of observing a test statistic as or more extreme # than ours more than the expected value p_val <- pbinom(50 - diff_from_exp, size = 100, prob = 0.5) + pbinom(50 + diff_from_exp - 1, size = 100, prob = 0.5, lower.tail = FALSE) round(p_val, 3) ``` ``` ## [1] 0.035 ``` `\(P(\text{observing a test statistic as or more extreme than what we observed}|H_0) =\)` 0.035! --- `\(P(\text{observing a test statistic as or more extreme than what we observed}|H_0) =\)` 0.035 This is less than our pre-determined cut-off of 0.05, so we conclude that our results are **statistically significant**! This means that we reject `\(H_0\)` and have evidence to support our alternative hypothesis `\(H_a\)`, that our coin is biased. With that conclusion, we have completed our hypothesis test! Note that we do **not** conclude that `\(H_0\)` is false, or that `\(H_a\)` is true! We only state our conclusion in terms of sufficient evidence to reject the null or insufficient evidence to reject the null! --- layout: false layout: true # P-values --- We've already defined a p-value, without explicitly naming the term. .middler[**p-value:** probability of observing a result as or more extreme than what we observed, assuming the null hypothesis is true] --- .middler-nocent[ * Tells us whether our results/hypothesis is right or wrong? ] --- .middler-nocent[ * ~~Tells us whether our results/hypothesis is right or wrong?~~ ] --- .middler-nocent[ * ~~Tells us whether our results/hypothesis is right or wrong?~~ * Probability the null hypothesis is true? ] --- .middler-nocent[ * ~~Tells us whether our results/hypothesis is right or wrong?~~ * ~~Probability the null hypothesis is true?~~ ] --- .middler-nocent[ * ~~Tells us whether our results/hypothesis is right or wrong?~~ * ~~Probability the null hypothesis is true?~~ * Inverse probability of a publication? ] --- .middler-nocent[ * ~~Tells us whether our results/hypothesis is right or wrong?~~ * ~~Probability the null hypothesis is true?~~ * ~~Inverse probability of a publication?~~ ] --- .middler[**p-value:** probability of observing a result as or more extreme than what we observed, assuming the null hypothesis is true] --- .middler[**p-value:** probability of observing a result *as or more extreme* than what we observed, assuming the null hypothesis is true] --- **p-value:** probability of observing a result *as or more extreme* than what we observed, assuming the null hypothesis is true .center[] --- .middler[**p-value:** probability of observing a result as or more extreme than what we observed, assuming the null hypothesis is true] --- .middler[**p-value:** probability of observing a result as or more extreme than what we observed, *assuming the null hypothesis is true*] --- **p-value:** probability of observing a result as or more extreme than what we observed, *assuming the null hypothesis is true* .center[] --- **p-value:** probability of observing a result as or more extreme than what we observed, assuming the null hypothesis is true **Premise:** If our results are extreme under the assumption of the null hypothesis, then perhaps our assumption is wrong That's it. Nothing more, nothing less, and every part of the definition is important. --- layout: false # Why is 0.05 so special? --- # Why is 0.05 so special? ## It isn't. A cut-off of 0.05 was deemed by Ronald Fisher1 in 1925 to indicate that "either there is something in the treatment, or a coincidence has occurred such as does not occur more than once in twenty trials." Academia has decided that this value is of critical importance for reasons that frustrate statisticians to this day. .footnote[[1] Historical note: Fisher is considered by many to be the father of modern statistics, and his contributions to the field cannot be denied.  I mention this to acknowledge and highlight the historical context of statistics research. Fisher's views were extreme, even by the admittedly different standards of the time. We can appreciate the magnitude of his contributions to statistics while also recognizing and understanding the problematic views he actively supported and how those views might have impacted the people and the development of the field around him.] --- layout: true # Type 1 error --- .middler[## Why we should be cautious about small p-values] --- .middler[## Why we should be cautious about small p-values] **Type 1 errors** are "false positives". We commit a type 1 error if we incorrectly reject the null hypothesis when the null hypothesis is actually true. --- .middler[ `\(\LARGE \alpha = P(\text{reject } H_0 | H_0)\)` `\(\LARGE 1-\alpha = P(\text{don't reject } H_0 | H_0)\)` ] --- .middler[ `\(\LARGE .05 = P(\text{reject } H_0 | H_0)\)` `\(\LARGE .95 = P(\text{don't reject } H_0 | H_0)\)` ] --- .center[] --- layout: false .middler-nocent[ * Why we should be cautious about small p-values ] --- .middler-nocent[ * Why we should be cautious about small p-values * Why we should be cautious about large p-values ] --- layout: true # Type 2 Error --- .middler[## Why we should be cautious about large p-values] --- .middler[## Why we should be cautious about large p-values] **Type 2 errors** are "false negatives". We commit a type 2 error if we incorrectly fail to reject the null hypothesis when the null hypothesis is actually false. --- .middler[ `\(\LARGE P(\text{fail to reject } H_0 | H_0 \text{ is false})\)` ] --- Type 2 error also gives us the concept of **power**, the probability of correctly rejecting the null. .middler[ `\(\Large \text{Power} = P(\text{reject } H_0 | H_0 \text{ is false}) = 1 - P(\text{type 2 error})\)` ] --- layout: false # Type 1 and 2 Errors .middler-nocent[ * We can decrease the probability of a Type 2 errors by increasing our Type 1 error. * Why? * We can decrease the probability of a Type 2 error *without sacrificing* Type 1 error by increasing our sample size. * Why? ] --- # Type 1 and 2 Errors .middler[  ] --- layout: true # Hypothesis Testing --- .middler-nocent[ * Why we should be cautious about small p-values * Why we should be cautious about large p-values ] --- .middler-nocent[ * Why we should be cautious about small p-values * Why we should be cautious about large p-values ] .middler[  ] --- .middler-nocent[ * Why we should be cautious about small p-values * Why we should be cautious about large p-values * Why we should be cautious about medium p-values ] --- layout: true # Hypothesis Testing --- There are many different types of hypothesis tests, but the most common tests have a very simple premise: take your **estimate**, compare it to your **null hypothesized value**, and weight the difference by the **standard error**. (Note: a standard error is just an estimate of the standard deviation) --- ## What does this look like? Let's say you are estimating the mean of some data, which you are calling `\(\mu\)`. You are testing whether the mean is different than 10. Your **test statistic** is `$$T=\dfrac{\hat{\mu}-10}{\text{se}(\hat{\mu})},$$` Note: we put hats on our parameters to indicate our estimates of those parameters. For example, `\(\mu\)` is a parameter that represents some unknown population mean. `\(\hat{\mu}\)` is our estimate of `\(\mu\)`, perhaps a sample mean of 11.2. --- More generally, a common test statistic for an arbitrary parameter `\(\theta\)` is `$$T = \dfrac{\hat{\theta}-\theta_0}{\text{se}(\hat{\theta})},$$` where `\(\theta_0\)` is the hypothesized value of `\(\theta\)` under `\(H_0\)`. We can also test multiple parameters at once (for example `\(H_0: \beta_1 = \beta_2 = 0\)`), but we will not go into the details in this course. --- ## Difference in Means We can also test for functions of our parameters. For example, pretend we are interested in comparing the average height of two different species of trees. We denote the true average height of tree type 1 and 2 as `\(\mu_1\)` and `\(\mu_2\)`, respectively. Our null hypothesis, as usual, is that there is no difference. Thus we set up our hypothesis test `$$\begin{align*} H_0: \mu_1 &= \mu_2\\ H_a: \mu_1 &\neq \mu_2 \end{align*}$$` Note that this is equivalent to `$$\begin{align*} H_0: \mu_1 - \mu_2 &= 0\\ H_a: \mu_1 -\mu_2 &\neq 0 \end{align*}$$` Then one possibility for our test statistic is `$$T = \dfrac{\hat{\mu}_1 - \hat{\mu_2}-0}{\text{se}(\hat{\mu}_1 - \hat{\mu_2})}$$` --- ## Bias **Bias:** The bias of an estimate is the expected difference between the estimate and the true value. `$$\text{Bias}(\hat{\theta}) = \mathbb{E}(\hat{\theta}) - \theta$$` Let's say we have `\(T\)` from any of our examples above of the form `$$T = \dfrac{\hat{\theta}-\theta_0}{\text{se}(\hat{\theta})}.$$` Our estimate is called **unbiased** if the expectation of our estimate is equal to the true parameter value, that is, `$$\mathbb{E}[\hat{\theta}]=\theta.$$` --- ## We have a test statistic, now what? If we have a test statistic of the form `$$T = \dfrac{\hat{\theta}-\theta_0}{\text{se}(\hat{\theta})},$$` it is very common to model `$$T \stackrel{H_0}{\sim} N(0,1).$$` We won't get into the reasons why in this course1. Modeling the test statistic with a standard normal distribution is sometimes called a **z-test**. This means that, *under the null hypothesis*, our test statistic is distributed `\(N(0,1).\)` .footnote[[1] Commonly, it is due to either the central limit theorem or properties of maximum likelihood estimators.] --- `$$T \stackrel{H_0}{\sim} N(0,1)$$` What does the pdf of this distribution look like? .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-3-1.png) ] --- `$$T \stackrel{H_0}{\sim} N(0,1)$$` What if we calculate a test statistic `\(T=1.64\)`? .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-4-1.png) ] --- If our test is `$$\begin{align*} H_0: \theta &= \theta_0\\ H_a: \theta &> \theta_0 \end{align*}$$` Then our p-value looks like .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-5-1.png) ] --- If our test is `$$\begin{align*} H_0: \theta &= \theta_0\\ H_a: \theta &\neq \theta_0 \end{align*}$$` Then our p-value looks like .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-6-1.png) ] --- layout: false # t-tests Sometimes, instead of using a normal distribution to model our test statistic, we use a **t distribution**. Typically, this is done when the sample size is small (such as less than 30) or when we estimate our population standard deviation. A t distribution has heavier tails than a normal distribution, meaning the density is higher in the extreme regions away from the mean. Thus, using a t distribution is more conservative than using a normal distribution. *Why?* --- # t-tests In the real world, we almost always estimate our population standard deviation. However, both t-tests and z-tests are commonly used. This is because as our sample size increases, the difference between a t-test and a z-test goes to `\(0\)`. In practice, we often have sample sizes large enough where there difference is marginal, and normal distributions are nicer to work with than t-distributions. .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-7-1.png) ] --- # <TT>t.test()</TT>: t-tests in R Conducting t-tests in R is very easy! Just use the function `t.test()`. For a **two sample t-test** to compare the means of two samples, just provide the two samples in R. Here I use randomly simulated data. This performs a test of the form: \\[ `\begin{align} H_0: \mu_x &= \mu_y\\ H_a: \mu_x &\neq \mu_y \end{align}` \\] ```r set.seed(302) x <- rnorm(10, mean = 0, sd = 1) y <- rnorm(10, mean = 1.5, sd = 1) t.test(x, y) ``` ``` ## ## Welch Two Sample t-test ## ## data: x and y ## t = -1.5143, df = 16.95, p-value = 0.1484 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -1.627018 0.267543 ## sample estimates: ## mean of x mean of y ## 0.3492983 1.0290359 ``` --- # <TT>t.test()</TT>: t-tests in R Note that we can also test **one-sided** hypotheses: \\[ `\begin{align} H_0: \mu_x &= \mu_y\\ H_a: \mu_x &< \mu_y \end{align}` \\] ```r t.test(x, y, alternative = "less") ``` ``` ## ## Welch Two Sample t-test ## ## data: x and y ## t = -1.5143, df = 16.95, p-value = 0.07419 ## alternative hypothesis: true difference in means is less than 0 ## 95 percent confidence interval: ## -Inf 0.1012809 ## sample estimates: ## mean of x mean of y ## 0.3492983 1.0290359 ``` --- # <TT>t.test()</TT>: t-tests in R We can also use a **one sample t-test** to compare the means of one sample to some hypothesized value. This performs a test of the form: \\[ `\begin{align} H_0: \mu_x &= 0\\ H_a: \mu_x &\neq 0 \end{align}` \\] ```r t.test(x, mu = 0) ``` ``` ## ## One Sample t-test ## ## data: x ## t = 0.98472, df = 9, p-value = 0.3505 ## alternative hypothesis: true mean is not equal to 0 ## 95 percent confidence interval: ## -0.4531331 1.1517298 ## sample estimates: ## mean of x ## 0.3492983 ``` --- class: inverse .sectionhead[Part 2. Linear Models] --- # Regression Let's assume we have some data `\(X_1,\ldots,X_p, Y\)` where `\(X_1,\ldots,X_p\)` are `\(p\)` **independent variables/explanatory variables/covariates/predictors** and `\(Y\)` is the **dependent variables/response/outcome**. We want to know the relationship between our covariates and our response, we can do this with a method called **regression**. Regression provides us with a statistical method to conduct * **inference:** assess the relationship between our variables, our statistical model as a whole, predictor importance * What is the relationship between sleep and GPA? * Is parents' education or parents' income more important for explaining income? * **prediction:** predict new/future outcomes from new/future covariates * Can we predict test scores based on hours spent studying? --- # Intermission: History of "Regression" The linguistic history of "regression", much like the history of the field of statistics, is marred in the history of eugenics and racism. .center[[See my Twitter thread for my information about this.](https://twitter.com/BryanDMartin_/status/1317135999412113410)] --- # Intermission: History of "Regression" The linguistic history of "regression", much like the history of the field of statistics, is marred in the history of eugenics and racism. .center[[See my Twitter thread for my information about this.](https://twitter.com/BryanDMartin_/status/1317135999412113410)] .center[You can follow me for more statistics hot takes.] --- layout: false # Linear Regression Given our response `\(Y\)` and our predictors `\(X_1, \ldots, X_p\)`, a **linear regression model** takes the form: \\[ \LARGE `\begin{eqnarray} &Y &= \beta_0 + \beta_1 X_1 + \cdots + \beta_p X_p + \epsilon,\\ &\epsilon &\sim N(0,\sigma^2) \end{eqnarray}` \\] --- # `\(\large \epsilon\)`: Error term `\(\epsilon\)`, pronounced epsilon, represents the **error term** of our model. We can model `\(Y\)` as a linear function of the `\(X\)`'s, but in the real world, the relationship won't always be perfect. There is noise! It can come from * Measurement error in the `\(X\)`'s * Measurement error in the `\(Y\)`'s * Unobserved/missing variables in the model * Deviations in the true model from linearity * True randomness In linear regression, we assume that this error term is normally distributed with mean zero and variance `\(\sigma^2\)`. --- # `\(\large \beta_0\)`: Intercept `\(\beta_0\)` is the **intercept term** of our model. Notice that `$$\large \mathbb{E}[Y|X_1 = X_2 = \cdots = X_p = 0] = \beta_0$$` Thus, `\(\beta_0\)` is the expected value of our response if all the covariates are equal to `\(0\)`! This is also known as the y-intercept of our model. --- # `\(\large X_j\)`: Independent variable `\(X_j\)` represents the `\(j\)`th independent variable in our model. Notice that `$$\large \mathbb{E}[Y|X_1,\ldots, X_p] = \beta_0 + \beta_1 X_1 + \cdots + \beta_p X_p$$` What happens to this expectation if we increase `\(X_j\)` by 1 unit, holding everything else constant? -- The conditional expectation of `\(Y\)` increases by `\(\beta_j\)`! --- # `\(\large \beta_j\)`: Coefficient `\(\beta_j\)` represents the `\(j\)`th regression coefficient in our model. From the previous slide, we saw that for every 1 unit increase in `\(X_j\)`, holding all other variables constant, the expected value of the response increases by `\(\beta_j\)`. From this we can derive an interpretation. **Interpretation of `\(\beta_j\)`:** the expected difference in the response between two observations differing by one unit in `\(X_j\)`, with all other covariates identical. --- # Linear Regression \\[ \LARGE `\begin{eqnarray} &Y &= \beta_0 + \beta_1 X_1 + \cdots + \beta_p X_p + \epsilon,\\ &\epsilon &\sim N(0,\sigma^2) \end{eqnarray}` \\] * `\(Y\)`: dependent variable, outcome, response * `\(X_j\)`: independent variable, covariate, predictor * `\(\beta_0\)`: Intercept * `\(\beta_j\)`: coefficient, the expected difference in the response between two observations differing by one unit in `\(X_j\)`, with all other covariates identical. * `\(\epsilon\)`: error, noise, with mean `\(0\)` and variance `\(\sigma^2\)` --- # <TT>lm():</TT> Linear Model We fit a linear regression model in R using `lm()`. The first argument is a **formula**, which is a type of R object. Formula's typically take the following form1: `Y ~ X_1 + X_2 + ... + X_p`. The dependent variable, `Y` goes on the left-hand side of the tilde `~`, which marks the formula. The independent variables are added on the right-hand side. Using this formula will give us a model in the form of \\[ `\begin{eqnarray} &Y &= \beta_0 + \beta_1 X_1 + \cdots + \beta_p X_p + \epsilon,\\ &\epsilon &\sim N(0,\sigma^2) \end{eqnarray}` \\] .footnote[[1] Strictly speaking, neither the dependent variable nor the independent variables are necessary to create a formula object.] --- # <TT>lm():</TT> Linear Model ```r data(mtcars) my_lm <- lm(mpg ~ hp + wt, data = mtcars) class(my_lm) ``` ``` ## [1] "lm" ``` ```r my_lm ``` ``` ## ## Call: ## lm(formula = mpg ~ hp + wt, data = mtcars) ## ## Coefficients: ## (Intercept) hp wt ## 37.22727 -0.03177 -3.87783 ``` We can see from `names()` that `lm` objects contain a lot more than they print out by default. ```r names(my_lm) ``` ``` ## [1] "coefficients" "residuals" "effects" "rank" ## [5] "fitted.values" "assign" "qr" "df.residual" ## [9] "xlevels" "call" "terms" "model" ``` --- # <TT>summary():</TT> Model summaries `summary()` gives us a summary of our `lm` object in R. * The quantiles of the residuals: hopefully, they match a normal distribution! * Coefficients, their standard errors, and their individual significances * (Adjusted) R-squared value: how much of the overall variability in the response is explained by the model? * F-statistic: hypothesis test for the significance of the overall model --- # <TT>summary():</TT> Model summaries ```r summary(my_lm) ``` ``` ## ## Call: ## lm(formula = mpg ~ hp + wt, data = mtcars) ## ## Residuals: ## Min 1Q Median 3Q Max ## -3.941 -1.600 -0.182 1.050 5.854 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 37.22727 1.59879 23.285 < 2e-16 *** ## hp -0.03177 0.00903 -3.519 0.00145 ** ## wt -3.87783 0.63273 -6.129 1.12e-06 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 2.593 on 29 degrees of freedom ## Multiple R-squared: 0.8268, Adjusted R-squared: 0.8148 ## F-statistic: 69.21 on 2 and 29 DF, p-value: 9.109e-12 ``` --- # <TT>plot():</TT> Regression model diagnostics Calling `plot(my_lm)` will return several diagnostic plots. Remember that we want our error term to look normally distributed with mean zero. Interpreting these is both a science and an art. We won't go into all the details for this class, but here are some tips: * **Residuals vs Fitted:** these are your errors (residuals) plotted over the predicted outcome (fitted). Errors should be random, so here you want to see randomly scattered points with no discernable pattern. You want the trend line to be approximately horizontal. * **Normal Q-Q plot:** These are the quantiles of your errors against the quantiles of a normal distribution. In theory, your errors should be normally distributed, so you are hoping that points are mostly along the 45-degree `\(y=x\)` line. * **Scale-location:** This looks at the magnitude of standardized residuals over the predicted outcome. Similar interpretation as residuals vs fitted. This can make it slightly easier to identify undesireable patterns. * **Residuals vs leverage:** This can help identify highly influential points, such as outliers. If points are outside dotted red lines, then removing them would noticeably alter your results. *Never just remove outliers!* If it's real data, it's valid and removing it will bias your results. If it's clearly mis-entered data, fine. It is much more important to understand why outliers are there than to remove them. --- # <TT>plot():</TT> Regression model diagnostics ```r plot(my_lm) ``` .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-15-1.png) ] --- # <TT>plot():</TT> Regression model diagnostics ```r plot(my_lm) ``` .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-17-1.png) ] --- # <TT>plot():</TT> Regression model diagnostics ```r plot(my_lm) ``` .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-19-1.png) ] --- # <TT>plot():</TT> Regression model diagnostics ```r plot(my_lm) ``` .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-21-1.png) ] --- # <TT>coef():</TT> Extract coefficients Use `coef()` to extract estimated coefficients as a vector. ```r coef(my_lm) ``` ``` ## (Intercept) hp wt ## 37.22727012 -0.03177295 -3.87783074 ``` --- # <TT>fitted():</TT> Extract fitted values Use `fitted()` to extract the fitted/estimated values for the response. This can be useful to compare how our fitted values compare to the estimated values to help assess model fit. ```r mod_fits <- fitted(my_lm) my_df <- data.frame(actual = mtcars$mpg, fitted = mod_fits) ggplot(my_df, aes(x = fitted, y = actual)) + geom_point() + geom_abline(slope = 1, intercept = 0, col = "red", lty = 2) + theme_bw(base_size = 15) + labs(x = "Fitted values", y = "Actual values", title = "Actual vs. Fitted") + theme(plot.title = element_text(hjust = 0.5)) ``` .center[ ![](lectureslides_inference_files/figure-html/unnamed-chunk-24-1.png) ] --- # <TT>predict():</TT> Predict new outcomes Use `predict()` to predict new outcomes given new explanatory variables. For example, pretend we observe two new cars with horsepowers of `100` and `150`, respectively, and weights of `3000` and `3500`, respectively. ```r # Note: wt is in 1000s of lbs! new_obs <- data.frame(hp = c(100, 150), wt = c(3, 3.5)) predict(my_lm, new_obs) ``` ``` ## 1 2 ## 22.41648 18.88892 ``` We'll come back to prediction in future lectures! --- layout: true # Formula Tools --- ## `- 1` Use `- 1` to remove an intercept from your model. Only do this if you are very sure that what you are doing is appropriate! I don't recommend doing this in practice. ```r no_intercept <- lm(mpg ~ hp + wt - 1, data = mtcars) summary(no_intercept) ``` ``` ## ## Call: ## lm(formula = mpg ~ hp + wt - 1, data = mtcars) ## ## Residuals: ## Min 1Q Median 3Q Max ## -19.407 -2.382 2.511 7.091 23.885 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## hp -0.03394 0.03940 -0.861 0.3959 ## wt 6.84045 1.89425 3.611 0.0011 ** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 11.32 on 30 degrees of freedom ## Multiple R-squared: 0.7264, Adjusted R-squared: 0.7082 ## F-statistic: 39.83 on 2 and 30 DF, p-value: 3.599e-09 ``` --- ## `:` Use `X1:X2` to include an interaction effect in your model. This is useful if you have reason to believe two covariates interact, such as gender and education in a wage model. In our case, we'll assume horsepower and weight interact in their effect on mpg. Typically (always?), you if you include an interaction effect, you also want to include the marginal effects. You can do this automatically using `X1*X2`. --- ```r interact <- lm(mpg ~ hp:wt, data = mtcars) summary(interact) ``` ``` ## ## Call: ## lm(formula = mpg ~ hp:wt, data = mtcars) ## ## Residuals: ## Min 1Q Median 3Q Max ## -4.8831 -2.0952 -0.4577 1.2262 7.9282 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 27.745642 1.062236 26.12 < 2e-16 *** ## hp:wt -0.014872 0.001727 -8.61 1.32e-09 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 3.288 on 30 degrees of freedom ## Multiple R-squared: 0.7119, Adjusted R-squared: 0.7023 ## F-statistic: 74.14 on 1 and 30 DF, p-value: 1.321e-09 ``` --- ```r interact <- lm(mpg ~ hp*wt, data = mtcars) summary(interact) ``` ``` ## ## Call: ## lm(formula = mpg ~ hp * wt, data = mtcars) ## ## Residuals: ## Min 1Q Median 3Q Max ## -3.0632 -1.6491 -0.7362 1.4211 4.5513 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 49.80842 3.60516 13.816 5.01e-14 *** ## hp -0.12010 0.02470 -4.863 4.04e-05 *** ## wt -8.21662 1.26971 -6.471 5.20e-07 *** ## hp:wt 0.02785 0.00742 3.753 0.000811 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 2.153 on 28 degrees of freedom ## Multiple R-squared: 0.8848, Adjusted R-squared: 0.8724 ## F-statistic: 71.66 on 3 and 28 DF, p-value: 2.981e-13 ``` --- ## `.` Use `~ .` to include all non-response variables in the input data as independent variables. ```r include_all <- lm(mpg ~ ., data = mtcars) summary(include_all) ``` ``` ## ## Call: ## lm(formula = mpg ~ ., data = mtcars) ## ## Residuals: ## Min 1Q Median 3Q Max ## -3.4506 -1.6044 -0.1196 1.2193 4.6271 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 12.30337 18.71788 0.657 0.5181 ## cyl -0.11144 1.04502 -0.107 0.9161 ## disp 0.01334 0.01786 0.747 0.4635 ## hp -0.02148 0.02177 -0.987 0.3350 ## drat 0.78711 1.63537 0.481 0.6353 ## wt -3.71530 1.89441 -1.961 0.0633 . ## qsec 0.82104 0.73084 1.123 0.2739 ## vs 0.31776 2.10451 0.151 0.8814 ## am 2.52023 2.05665 1.225 0.2340 ## gear 0.65541 1.49326 0.439 0.6652 ## carb -0.19942 0.82875 -0.241 0.8122 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 2.65 on 21 degrees of freedom ## Multiple R-squared: 0.869, Adjusted R-squared: 0.8066 ## F-statistic: 13.93 on 10 and 21 DF, p-value: 3.793e-07 ``` --- layout: false # Matrix Notation We can fully write out a linear regression model \\[ `\begin{equation} \begin{bmatrix} y_1 \\ y_2\\ \vdots \\ y_n \end{bmatrix} = \begin{bmatrix} 1 & x_{1,1} & \cdots & x_{1,k}\\ 1 & x_{2,1} & \cdots & x_{2, k}\\ \vdots & \vdots & \ddots & \vdots \\ 1 & x_{n,1} & \cdots & x_{n, k}\end{bmatrix} \begin{bmatrix} \beta_0 \\ \beta_1 \\ \vdots \\ \beta_{k} \end{bmatrix} + \begin{bmatrix} \epsilon_1 \\ \epsilon_2 \\ \vdots \\ \epsilon_{n} \end{bmatrix} \end{equation}` \\] This can also be expressed in matrix form: \\[ `\begin{align} \mathbf{Y} &= \mathbf{X}\beta + \epsilon,\\ \epsilon&\sim N(0,1) \end{align}` \\] * `\(\mathbf{Y} \in \mathbb{R}^{n \times 1}\)`: an n-dimensional vector of the response * `\(\mathbf{X} \in \mathbb{R}^{n \times (k+1)}\)`: a `\(((k+1)\times n)\)` matrix of the predictors (including intercept) * `\(\beta \in \mathbb{R}^{((k+1)\times 1)}\)`: a `\((k+1)\)`-dimensional vector of regression parameters * `\(\epsilon \in \mathbb{R}^{n \times 1}\)`: an n-dimensional vector of the error term This will be helpful for Lab 3! --- class: inverse .sectionhead[Generalized Linear Models (very, very briefly)] --- # Generalized Linear Models Linear models are powerful, but they are not always appropriate! For example, we typically wouldn't want to model a binary outcome using a linear model, because the noise term would not make sense in the context of a binary outcome. For this, we use **logistic regression**, which models the relationship $$ \LARGE \log \dfrac{P(Y = 1|X)}{P(Y = 0|X)} = \beta_0 + \beta_1 X_1 + \cdots + \beta_p X_p $$ --- # Generalized Linear Models Logistic regression is an example of a **generalized linear model**, which extend the linear model beyond the assumptions of linear models, such as iid normal errors. Other examples include: * Poisson regression * Binomial regression * Beta regression * Gamma regression We model these using `glm()` in R, which also works with calls to `summary()`, `fitted()`, `predict()`, and other utility functions. Importantly, the interpretations of the coefficients is different when you use a generalized linear model! --- class: inverse .sectionhead[Appendix A. Probability] --- .middler[A *very* brief overview...] --- # Sample Space A **sample space**, commonly denoted `\(\Omega\)` or `\(S\)`, is the set of all possible outcomes from a random experiment. For example * Coin flip: `\(\Omega = \{H, T\}\)` * Two coin flips: `\(\Omega = \{HH, HT, TH, TT\}\)` * Rolling a 6-sided die: `\(\Omega = \{1, 2, 3, 4, 5, 6\}\)` * Hours spent sleeping in day: `\(\Omega = \{x: x\in \mathbb{R}, 0 \leq x \leq 24\}\)` * A simulation from a normal distribution: `\(\Omega = (-\infty, \infty)\)` The elements of `\(\Omega\)` must be **mutually exclusive** and **collectively exhaustive**. --- # Events An **event**, which we will call `\(A\)`, can be any subset of your sample space. For example * Heads in a coin flip: `\(A = \{H\}\)` * At least one heads in two coin flips: `\(A = \{HT, HT, TH\}\)` * Rolling an even number on a 6-sided die: `\(A = \{2, 4, 6\}\)` * Sleeping at least 8 hours in a day: `\(A = \{x: x \in \mathbb{R}, 8 \leq x \leq 24\}\)` * Simulating a number between 1 and 2, inclusive, from a normal distribution: `\(A = [1, 2]\)` --- # Probability Informally, probability `\(P\)` is often defined as the chance of something happening. More formally, it is a function that goes from an event `\(A\)` to the real line. (You might see this written `\(P: A \mapsto \mathbb{R}\)`) * `\(P(\text{heads in a fair coin flip}) = \dfrac{1}{2}\)` * `\(P(\text{at least one heads in two fair coin flips}) = \dfrac{3}{4}\)` * `\(P(\text{rolling an even number on a fair dice}) = \dfrac{1}{2}\)` --- # Axioms of Probability Probability allows follows three basic principles, known as the **axioms of probability**. 1. The probability of any event `\(A\)` must be between 0 and 1, inclusive. * `\(0 \leq P(A)\leq 1\)` 2. The probability of the sample space is equal to 1. * `\(P(\Omega) = 1\)` 3. If events `\(A\)` and `\(B\)` are **mutually exclusive**/**disjoint**, then the probability of *either* `\(A\)` *or* `\(B\)` is the same as the sum of the probability of `\(A\)` and the probability of `\(B\)`. * `\(A \cap B = \emptyset \ \ \Rightarrow \ \ P(A\cup B) = P(A) + P(B)\)` --- layout: true # Probability Notation --- ## Intersection: `\(\cap\)` `\(P(A \cap B)\)`: *joint* probability of `\(A\)` *and* `\(B\)`. .center[] --- ## Intersection: `\(\cap\)` `\(P(A \cap B)\)`: *joint* probability of `\(A\)` *and* `\(B\)`. .center[] --- ## Union: `\(\cup\)` `\(P(A \cup B)\)` probability of `\(A\)` *or* `\(B\)`. .center[] --- ## Union: `\(\cup\)` `\(P(A \cup B)\)` probability of `\(A\)` *or* `\(B\)`. .center[] --- ## Complement: `\(A^c, A'\)` `\(P(A^c)\)` probability of *not* `\(A\)` .center[] --- ## Complement: `\(A^c, A'\)` `\(P(A^c)\)` probability of *not* `\(A\)` .center[] --- ## Difference: `\(A\setminus B\)` `\(P(A\setminus B)\)` probability of `\(A\)` *and not* `\(B\)` .center[] --- ## Difference: `\(A\setminus B\)` `\(P(A\setminus B)\)` probability of `\(A\)` *and not* `\(B\)` .center[] --- ## Conditional: `\(A | B\)` `\(P(A | B)\)` probability of `\(A\)` *conditional on*/*given* `\(B\)` .center[] --- ## Conditional: `\(A | B\)` `\(P(A | B)\)` probability of `\(A\)` *conditional on*/*given* `\(B\)` .center[] --- ## Subset: `\(A \subseteq \Omega\)` `\(A \subseteq \Omega\)`: `\(A\)` is a *subset* of `\(\Omega\)` `\(A \subset \Omega\)`: `\(A\)` is a *proper subset* of `\(\Omega\)` .center[] --- ## Subset: `\(A \subseteq \Omega\)` `\(A \subseteq \Omega\)`: `\(A\)` is a *subset* of `\(\Omega\)` `\(A \subset \Omega\)`: `\(A\)` is a *proper subset* of `\(\Omega\)` .center[] --- ## Superset: `\(\Omega \supseteq A\)` `\(\Omega \supseteq A\)`: `\(A\)` is a *superset* of `\(\Omega\)` `\(\Omega \supset A\)`: `\(A\)` is a *proper superset* of `\(\Omega\)` .center[] --- ## Superset: `\(\Omega \supseteq A\)` `\(\Omega \supseteq A\)`: `\(A\)` is a *superset* of `\(\Omega\)` `\(\Omega \supset A\)`: `\(A\)` is a *proper superset* of `\(\Omega\)` .center[] --- ## Element of: `\(X \in A\)` `\(X \in A\)`: `\(X\)` is an *element of* `\(A\)` .center[] --- ## Empty set: `\(\varnothing\)` `\(A\cap E = \varnothing\)`: the intersection of `\(A\)` and `\(E\)` is the empty set .center[] --- layout: false # Identities of Probability * The probability of `\(A^c\)` is `\(1\)` minus the probability of `\(A\)` * `\(P(A^c) = 1-P(A)\)` * If `\(A\)` is a subset of `\(B\)`, then the probability of `\(A\)` is less than or equal to the probability of `\(B\)` * `\(A \subseteq B \implies P(A)\leq P(B)\)` * The probability of a union is equal to the sum of the probabilities minus the probability of an intersection * `\(P(A \cup B) = P(A) + P(B) - P(A\cap B)\)` --- # De Morgan's Laws * Complement of the union is equal to the intersection of the complements .center[] --- # De Morgan's Laws * Complement of the intersection is equal to the union of the complements .center[] --- # De Morgan's Laws 1. Complement of the union is equal to the intersection of the complements * `\((A \cup B)^c = A^c \cap B^c\)` 2. Complement of the intersection is equal to the union of the complements * `\((A \cap B)^c = A^c \cup B^c\)` .center[ ] --- # Independence We say that two events `\(A\)` and `\(B\)` are independent, `\(A\perp \!\!\! \perp B\)`, *if and only if* * `\(P(A \cap B) = P(A) P(B)\)` * `\(P(A|B) = P(A)\)` * `\(P(B|A) = P(B)\)` This is an *extremely* important concept in statistics! --- # Conditional Probability The conditional probability of `\(A\)` given `\(B\)` is equal to the joint probability of `\(A\)` and `\(B\)` divided by the marginal probability of `\(B\)` `$$P(A|B) = \dfrac{P(A\cap B)}{P(B)}$$` Note that this implies `$$P(A\cap B) = P(A|B) P(B)$$` --- # Bayes' Rule `$$P(A|B) = \dfrac{P(A\cap B)}{P(B)}$$` also implies `$$P(A|B) = \dfrac{P(B|A)P(A)}{P(B)}$$` commonly known as **Bayes' rule**! We won't get into the details in this class, but this can be a very useful result for reversing the conditions in your analysis. For example: There is a big difference between the probability of having a disease given a positive screening, and the probability of a positive screening given a disease! These concepts are often confused in popular media! --- # Law of Total Probability We say that a set of events is a **partition** if: * The set does not contain the empty set * The union of the events in the set is equal to the sample space * The intersection of any two distinct events in the set is equal to the empty set Note that an event and its complement always define a partition! .center[] --- # Law of Total Probability The **law of total probability** states that given a partition `\(P_1, P_2, \ldots, P_n\)`, then `$$P(A) = P(A|P_1)P(P_1) + P(A|P_2)P(P_2) + \cdots + P(A|P_n)P(P_n)$$` Commonly, our partition is some event `\(B\)` and its complement! `$$P(A) = P(A|B)P(B) + P(A|B^c)P(B^c)$$` .center[] --- class: inverse .sectionhead[Appendix B. Random Variables] --- # Random Variables Typically, we don't care about specific events occuring. Instead, we tend to focus on functions of our events. These functions are called **random variables**. More formally1, a random variable `\(X\)` can be defined as function `\(X: \Omega \mapsto \mathbb{R}\)`. * the number of heads out of 10 coin flips * the sum of 8 standard die rolls * the average value of 1,000 simulations from a `\(\mathcal{N}(0,1)\)` Typically, a random variable is denoted by a uppercase letter, such as `\(X\)`, and values that the random variable takes is denoted by a lowercase letter, such as `\(x\)`. For example, we might ask the `\(P(X=x)\)` for multiple values of `\(x\)`. We call the set of all values a random variable can take the **support** of that random variable. .footnote[[1] still not all the way formal] --- # Random Variables Random variables are **not** events! This can be confusing because often use similar notation with random variables and events. Think of an event as an outcome that can lead to a certain value of a random variable. For example: * Event in 10 coinflips: `\(\{THHTTTHTTH\}\)`. * Random variable representing the number of heads `\(X = 4\)`. * Event in 8 standard die rolls: `\(\{2, 4, 2, 1, 5, 4, 2, 6\}\)`. * Random variable representing the sum `\(X = 25\)`. --- # Discrete Random Variables Random variables are **discrete** if there are a finite1 number of values in the support. We've already seen some examples of this in class from the binomial distribution! We define the **probability mass function**, or **PMF**, of a discrete random variable `\(X \sim Bin(n,p)\)` as `$$P(X=k|n,p) = \begin{pmatrix} n\\ k\end{pmatrix} p^k(1-p)^{n-k}$$` Probability mass functions must satisfy: 1. `\(0 \leq P(X=x) \leq 1\)` for all `\(x\)` 2. `\(\sum_{x \in support(X)} P(X = x) = 1\)` 3. For any set `\(A\subseteq support(X)\)`, `\(P(X \in A) = \sum_{x \in A} P(X = x)\)` .footnote[[1] or countably infinite] --- # Continuous Random Variables Random variables are **continuous** if the support is uncountably infinite. We've already seen some examples of this in class from the normal distribution! We define the **probability density function**, or **PDF** of a continuous random variable `\(X \sim \mathcal{N}(\mu, \sigma^2)\)` as `$$f_X(x) = \dfrac{1}{\sqrt{2\pi\sigma^2}} e^{-\dfrac{1}{2}\left(\dfrac{x-\mu}{\sigma}\right)^2}$$` Probability density functions must satisfy: 1. `\(f_X(x) > 0\)` for all `\(x \in support(X)\)` 2. The area under the curve of the pdf in the support is equal to `\(1\)`. That is, `\(\int_{support(X)} f_X(x)dx = 1\)` 3. If `\(A\)` is some interval in the support of `\(X\)`, then `\(P(X \in A) = \int_A f_X(x)dx\)` Note that the second and third properties are essentially the continuous versions of the corresponding properties of discrete pmfs! --- # Expected Value The **expected value** or expectation of a random variable, denoted `\(E[X]\)` or `\(\mathbb{E}[X]\)`, is the mean of the random variable. Intuitively, it can be thought of as a weighted average of all values in the support, weighted by their value in the pdf/pmf. Expected values satisfy the following properties for random variables `\(X\)`, `\(Y\)` and constants `\(a\)`, `\(b\)`: * `\(\mathbb{E}[a] = a\)` * `\(\mathbb{E}[aX + b] = a \mathbb{E}[X] + b\)` * `\(\mathbb{E}[X + Y] = \mathbb{E}[X] + \mathbb{E}[Y]\)` If `\(X\)` and `\(Y\)` are independent, then * `\(\mathbb{E}[XY] = \mathbb{E}[X]\mathbb{E}[Y]\)` --- # Variance The **variance** of a random variable is the expected difference between a random variable and its mean, squared. `$$\mathbb{E}[(X - \mathbb{E}[X])^2]$$` Intuitively, this measures how far the values of `\(X\)` are from their mean, on average. It is a measure of spread, or variability. Variances satisfy the following properties for a random variable `\(X\)` and constants `\(a, b\)`: * `\(Var(a) = 0\)` * `\(Var(aX + b) = a^2Var(X)\)` The square root of the variance is known as the **standard deviation**, because it is the expected (standard) magnitude of the difference (deviation) between a random variable and its mean.


There are certain rules in Hollywood involving the portrayal of romantic relationships on the big screen. Certain combinations of leads naturally go together handsome men and beautiful women being the predominant pairing. Lately, a trend has emerged involving cute young adult males and lovable teenage females (usually with shows on Fox or the WB) and, once in a while, moviegoers are treated to the unlikely affairs of rickety old men and chicks half their age. Stars are always fit, have great teeth, skin and hair, and are usually white.
Films that stray from these templates of success are generally resounding box office failures. Why? Because people won't line up for Number 18 with Hunan Foot, the touching story of a Chinese guy with a really large head who falls in love with a 70-year-old lady leper.
Howard Stern has made a career out of shining a spotlight on those aforementioned oddities. Until now, if you wanted to hear a drunk dwarf, paranoid stutterers or alien lesbians, Howard was the only place to go. Hollywood could only ignore his phenomenal ratings for so long.
So, along comes The Other Sister (* 1/2), a film that bills itself as `a romantic comedy for the emotionally challenged.' Translation a love story about two retards. They meet. They fall in love. The have a fight. They get back together. They get married.  Okay, I made that last part up, but it would have been more original than anything in Sister's tiresome script.
The film opens with Carla (Juliette Lewis, Natural Born Killers) having just graduated from the Roselake, a school for mentally-challenged children. Carla flies home to San Francisco, where her father (Tom Skerritt) and overbearing mother (Diane Keaton) seem intent on keeping her at home under a watchful eye. They live in a giant house with a live-in maid and a gate, so one has to wonder why they didn't just lock her in the attic. Like the Kennedys.
But Carla has other plans. She wants to enroll in a public vocational school. Her parents say no but eventually give in. She wants her own apartment. Her parents say no but eventually give in. She wants a boyfriend. Her parents say no but hey! Are you tired of reading this yet? Try sitting through 130 minutes of it.
Lewis is remarkably unremarkable as Carla. But, then again, Carla isn't too far off of the roles that she usually plays. Her love interest Daniel (Giovanni Ribisi, Saving Private Ryan) is much better, but also not much different from his recurring role of Phoebe's brother on Friends. Actually, the only difference is fake teeth.
Sister was written and directed by Garry Marshall, who hit the big time with 70s television shows like Mork and Mindy and Laverne & Shirley. His resume as of late boasts the blockbusters Dear God and Exit to Eden. This is the first script he has written since 1984's The Flamingo Kid, proving that writing must not be like riding a bike. But, hey if you watch with your eyes closed, it sounds just like Howard.
2:10 R for adult situations and mild language
PLANET SICK-BOY: http://home.eznet.net/~jpopick
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


src.clustering package¶
Subpackages¶
Submodules¶
src.clustering.apps module¶
src.clustering.clustering module¶
clustering methods and functionalities
-
class
src.clustering.clustering.
Clustering
(clustering)¶ Bases:
object
clustering related tasks, stores both the clustered data and the models trained on each cluster
-
cluster_data
(input_df)¶ clusters the input DataFrame
Parameters: input_df ( DataFrame
) – input DataFrameReturn type: dict
Returns: dictionary containing the clustered data
-
fit
(training_df)¶ clusters the input DataFrame
Parameters: training_df ( DataFrame
) – training DataFrameReturn type: None
-
classmethod
load_model
(job)¶
-
predict
(test_df)¶ TODO: complete
Parameters: test_df ( DataFrame
) – testing DataFrameReturn type: Series
Returns: TODO: complete
-
src.clustering.methods_default_config module¶
-
src.clustering.methods_default_config.
clustering_kmeans
()¶
src.clustering.models module¶
-
class
src.clustering.models.
Clustering
(*args, **kwargs)¶ Bases:
src.common.models.CommonModel
Container of Classification to be shown in frontend
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
clustering_method
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_clustering_method_display
(*, field=<django.db.models.fields.CharField: clustering_method>)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
static
init
(clustering='noCluster', configuration={})¶
-
job_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
kmeans
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
model_path
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
nocluster
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
objects
= <model_utils.managers.InheritanceManager object>¶
-
to_dict
()¶
-
exception
-
class
src.clustering.models.
ClusteringMethods
¶ Bases:
enum.Enum
An enumeration.
-
KMEANS
= 'kmeans'¶
-
NO_CLUSTER
= 'noCluster'¶
-
-
class
src.clustering.models.
KMeans
(id, model_path, clustering_method, clustering_ptr, n_clusters, init, n_init, max_iter, tol, precompute_distances, random_state, copy_x, algorithm)¶ Bases:
src.clustering.models.Clustering
-
exception
DoesNotExist
¶ Bases:
src.clustering.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.clustering.models.MultipleObjectsReturned
-
algorithm
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
clustering_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
clustering_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
copy_x
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_algorithm_display
(*, field=<django.db.models.fields.CharField: algorithm>)¶
-
get_init_display
(*, field=<django.db.models.fields.CharField: init>)¶
-
get_precompute_distances_display
(*, field=<django.db.models.fields.CharField: precompute_distances>)¶
-
max_iter
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
n_clusters
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
n_init
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
precompute_distances
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
random_state
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
to_dict
()¶ Return type: dict
-
tol
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
src.clustering.models.
NoCluster
(id, model_path, clustering_method, clustering_ptr)¶ Bases:
src.clustering.models.Clustering
-
exception
DoesNotExist
¶ Bases:
src.clustering.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.clustering.models.MultipleObjectsReturned
-
clustering_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
clustering_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception


|
Boost.Locale
|
This class holds external data beyond existing fmtflags that std::ios_base holds. More...
#include <boost/locale/formatting.hpp>
Public Member Functions | |
| void | display_flags (uint64_t flags) |
| Set flags that define how to format data, e.g. number, spell, currency etc. | |
| uint64_t | display_flags () const |
| Get flags that define how to format data, e.g. number, spell, currency etc. | |
| void | currency_flags (uint64_t flags) |
| Set flags that define how to format currency. | |
| uint64_t | currency_flags () const |
| Get flags that define how to format currency. | |
| void | date_flags (uint64_t flags) |
| Set flags that define how to format date. | |
| uint64_t | date_flags () const |
| Get flags that define how to format date. | |
| void | time_flags (uint64_t flags) |
| Set flags that define how to format time. | |
| uint64_t | time_flags () const |
| Get flags that define how to format time. | |
| void | domain_id (int) |
| Set special message domain identification. | |
| int | domain_id () const |
| Get special message domain identification. | |
| void | time_zone (const std::string &) |
| Set time zone for formatting dates and time. | |
| std::string | time_zone () const |
| Get time zone for formatting dates and time. | |
| template<typename CharType > | |
| void | date_time_pattern (const std::basic_string< CharType > &str) |
| Set date/time pattern (strftime like) | |
| template<typename CharType > | |
| std::basic_string< CharType > | date_time_pattern () const |
| Get date/time pattern (strftime like) | |
Static Public Member Functions | |
| static ios_info & | get (std::ios_base &ios) |
| Get ios_info instance for specific stream object. | |
This class holds external data beyond existing fmtflags that std::ios_base holds.
You should almost never create this object directly. Instead, you should access it via ios_info::get(stream_object) static member function. It automatically creates default formatting data for that stream


How to survive/thrive in Data Era
by Hung Lin @hunglin
Before answering this question...
Imaging your life without Google
Imaging your life without World Wide Web
Date Era = CIA
Computers (desktops, laptops, tablets, smart phones) +
Internet (ethernet, wifi, 3G, 4G LTE, ...) +
App (Google, Facebook, Twitter, ...)
In Data Era, we have the unprecedented speed to
In Data Era, we can do things only possible in myth
Like, knowing what people are talking about right now?
No, we still cannot!
But...
We know what people are searching right now
We know what people are tweeting right now
Political strategists
Marketing reseachers
That's cool, but what about me?
How much time do I spend on commute?
How much electricity does my dryer use?
Me + Us + Everyone
What's the real time traffic?
The power plants can plan ahead for the peak time
That's SUPER AWESOME!
Piracy
Privacy


| PostgreSQL 9.0.10 Documentation | ||||
|---|---|---|---|---|
| Prev | Up | Chapter 9. Functions and Operators | Next |
For enum types (described in Section 8.7), there are several functions that allow cleaner programming without hard-coding particular values of an enum type. These are listed in Table 9-29. The examples assume an enum type created as:
CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple');
Table 9-29. Enum Support Functions
| Function | Description | Example | Example Result |
|---|---|---|---|
| enum_first(anyenum) | Returns the first value of the input enum type | enum_first(null::rainbow) | red |
| enum_last(anyenum) | Returns the last value of the input enum type | enum_last(null::rainbow) | purple |
| enum_range(anyenum) | Returns all values of the input enum type in an ordered array | enum_range(null::rainbow) | {red,orange,yellow,green,blue,purple} |
| enum_range(anyenum, anyenum) | Returns the range between the two given enum values, as an ordered array. The values must be from the same enum type. If the first parameter is null, the result will start with the first value of the enum type. If the second parameter is null, the result will end with the last value of the enum type. | enum_range('orange'::rainbow, 'green'::rainbow) | {orange,yellow,green} |
| enum_range(NULL, 'green'::rainbow) | {red,orange,yellow,green} | ||
| enum_range('orange'::rainbow, NULL) | {orange,yellow,green,blue,purple} |
Notice that except for the two-argument form of enum_range
,
these functions disregard the specific value passed to them; they care
only about its declared data type. Either null or a specific value of
the type can be passed, with the same result. It is more common to
apply these functions to a table column or function argument than to
a hardwired type name as suggested by the examples.


Captain
Developer
Resume
captain@mich: ~
Welcome to Mich portfolio — Type
help
for a list of supported commands.
captain
@
mich
~


Home
menu
place order
Contact
About us
WELCOME
TO PIZZA HUT DEVINES
come have a nice tasty pizza from our nice resturant
Types of pizza
Neopolitant pizza
Chicago pizaa
Califonia pizza
New york pizza
silica pizza
Thank you for choosing on us go to to the menu bar and place your oder right now


a lightweight(1KB) jquery plugin to create a true sticky navbar
This is a very simple plugin to make navbars sticky, without any visible jump as the state of the navbar changes.
You want to include jQuery, then this plugin within your page and then call it upon the nav you want to make sticky.
Check out the minimal example below.
<!DOCTYPE html>

<title>Your Page</title>
<link href="css/style.css" rel="stylesheet">

My awesom header

Item
Item
Item

the plugin will measure the height of your navigation and then create a placeholder element of the exact same height behind the navigation.
Then as soon as the top of the element has reached the top of the window, the position of the navbar will be changed to fixed, while the placeholder element remains in place.
This will ensure that you won't see a visible little "jump", which sometimes happens with other solutions.
Yes, the options you can pass are
wrapperClass: the navbar will be wrapped, this is the class added to the element. Default is 'sticky-nav-wrapper'.
placeholderClass: the class of the placeholder element. Default is 'sticky-nav-placeholder'.
elementClass the sticky element itself will get a new class. Default is 'sticky-nav-element'.
zIndexValue the element will get a z-index value. The default is 10 you might want to amp it up a little maybe.
Options are passed like this:
$('.my-navigation').stickyNav({
wrapperClass: 'sticky-wrapper',
placeholderClass: 'sticky-placeholder',
elementClass: 'sticky-element',
zIndexValue: 99
});
Just open an issue and let me know.


Beatriz Nonato
Web Full Stack
Skills
HTML5
CSS3
JavaScript (ES6)
React Native
NodeJS
MongoDB
Python3
Design Thinking
Projects
Movie Trailer
Freety
App Feed


Question 1 Create a webpage containing an image and three buttons
- On click of the second button a change the existing image to a new image
- On click of the third button change it once again
- On click of first, the first image should come back
Question 2 Create a webpage containing two input fields and a button.
- Write something in the first input
- On click of the button, the content of input one should be copied in the second input
Question 3 Create an array of objects with objects having the following properties.
- {name (string), age (number), country (string), hobbies array (string [ ] ) }
- Write a function to display all the objects on the console
Question 4 Following the 3rd question.
- Write a function to display all the objects having age less than 30
- Write a function to display all the objects having country India


Enter numbers below (separated by commas) and then click Shuffle to randomize the numbers:
Results will appear below
:
Shuffle
Sort
Clear


Volunteers (hangs around EngineersMY slack)
https://engineersmy.herokuapp.com
Monthly meetup announced on meetup.com
Get in touch via meetup.com
or
Slack us to volunteer / speak / sponsor
DevKami curated meetups: https://devkami.com/meetups/
KL meetups by Azuan (@alienxp03): http://malaysia.herokuapp.com/#upcoming
Screwdriver began as a hack for simplified interfacing with Jenkins at Yahoo in 2012.
In 2016, we rebuilt Screwdriver from scratch in open source with our best coding practices and CICD goals in mind.
Screwdriver is executor- and SCM-agnostic, meaning you can choose whichever plugin better suits your need or build your own.
Github | SiteEnterprise-Grade Continuous Delivery & DevOps Automation Platform written in Go(lang)
Extending Vector with eBPF to inspect host and container performance
Building containers in unprivileged environments
Buildah is a tool and library for building Open Container Initiative (OCI) container images that is complementary to Podman.Blog...
If you want to use a traditional container engine, and use Dockerfile's for builds, then you should probably just use Podman. But if you want to experiment with building container images in new ways without using Dockerfile, then you should really take a look at Buildah.
P2P Docker registry capable of distributing TBs of data in seconds
...a simple Docker registry setup with sharding and caches couldn’t keep up with the throughput required to distribute Docker images efficiently.Blog | Github
To solve performance issues with our legacy Docker registry stack, Uber’s Cluster Management team developed Kraken, an open source, peer-to-peer (P2P) Docker registry.
fast, reliable docker image builder for Mesos & k8s
Lightweight k8s. A binary of less than 40 MB. Only 512 MB of RAM required to run.
Managed Databases for PostgreSQL
BlogDiscover and deploy preconfigured One-Click Applications
SiteProxySQL is a high performance, high availability, protocol aware proxy for MySQL and forks (like Percona Server and MariaDB). All the while getting the unlimited freedom that comes with a GPL license.
Site | GithubAfter about 2 years in discussion
Blogbash tool to store private data inside git repo
Free for startups for 2 years
SiteIETF has standardized the ACME protocol as RFC 8555
Site


Flames of Hope is program we offer that acknowledges people’s other needs in life. We have volunteers that help fill other’s needs for free. A few topics that we aid in are health care, car repair, and thrift shopping. We also sign petitions, help pledge support, and contribute money or other resources to help reunite kids with their families. Sometimes, we Outreach to the Forest Park and Babcock Communities on the UNH campus. To get involved in this program, stop by our house on Mill Road!
Our biggest service we offer is Cornucopia Food Pantry. Our Food Pantry offers food on a weekly basis to those in need. We also provide food baskets three times a year. We currently serve about 1,500 customers a year which feeds about 6,000 people. For more information on receiving food or helping, visit here.
Hours of Operation:
Summer (Jun-Aug): Tuesdays, 4:00-5:30 PM
Academic Year (Sept-May): Tuesdays, 4:00-5:30 PM, and Fridays, 12:00-2:00PM
One of our niche services that we offer is a variation of relaxation, mindfulness mediation. Some benefits of this is better memory, greater self-awareness, and improved learning. We have many repeat customers that come weekly because of the benefits that this meditation reaps. We welcome everyone here regardless of race, religion, and cultures you are. Meditation is always beneficial to your mental health, making your life clearer and giving you a positive spirit. Give us a call or stop by to learn more about how to get involved!
Another service we offer is group drum circles and community dinners. Our drum circles are a celebration of life, community, and music-making in the moment. Our circles are run by our very own volunteers. Some benefits our customers have from coming to these are accelerated physical healing and boosting of their immune system. People have also told us that they have reduced stress, anxiety, and tension after attending our sessions. Besides group drum circles, we also offer community dinners. These help us reach out to the community to connect and get feedback from everyone. Reach out to us if you want to get involved with dinner planning or if you want to attend. We hope to see you all there!


About Me
Carrie Young
꧁•⊹٭𝙲𝙻𝙴𝚅𝙴𝚁 𝙶𝙸𝚁𝙻٭⊹•꧂
Greetings! My name is Carrie Young, a budget and finance professional, currently delving into the world of full stack development to master new skills, and challenge my creativity and adaptability.
During my 20+ years of work experience, I have come across and utilized small bits of code. I have found that I really enjoy when I am given opportunities to create useful tools/interfaces or automating tasks/processes using code, and programming calculations that display the results people need or making someone's vision reality (e.g. dashboards and connecting/automating data review from canned ERP reports).
My Work


UD for Croatian and Serbian
Tokenization and Word Segmentation
- In general, words are delimited by whitespace characters. In cases where a word is immediately followed or preceded by a punctuation sign (comma, full stop, parentheses, etc.), a white space is inserted between the word and the punctuation. In this way, punctuation signs are treated as separate tokens, with a few exceptions:
- Full stops separating digits in a large number (“65.000” stands for sixty-five-thousand, one token)
- Hyphens in compounds such as etno-selo “ethnic (traditional) village” (one tokens) and for abbreviations such as atd. “etc.” (two tokens).
Morphology
Tags
- All 17 universal POS categories are used.
- Pronominal quantifiers (which the traditional grammar includes in numerals) are DET.
- There are two auxiliary verbs (AUX), biti (“to be”, past tense) and ht(j)eti (“will”, future tense); the latter can be attached to a verb in Serbian (e.g. pružiće “will provide”), but NOT in Croatian (e.g. pružit će “will provide”).
Nominal Features
- Nominal words (NOUN, PROPN and PRON) have an inherent Gender feature with one of three values:
Masc
,Fem
orNeut
. In some cases the masculine gender is further subclassified by the Animacy valuesAnim
andInan
. Feminine and neuter nominals do not distinguish animacy grammatically. - There are two values of the Number feature are
Sing
andPlur
. The following parts of speech inflect for number: NOUN, PROPN, PRON, ADJ, DET, VERB, AUX (finite, participles and converbs), marginally NUM. - Case has 7 possible values:
Nom
,Gen
,Dat
,Acc
,Voc
,Loc
,Ins
.
Degree and Polarity
- Degree applies to adjectives (ADJ) and adverbs (ADV) and has one of three possible values:
Pos
,Cmp
,Sup
. - Polarity has two values,
Pos
andNeg
, and applies primarily to verbs (VERB, AUX), adjectives (ADJ) and adverbs (ADV) that can be negated using the bound morpheme ne-.- Typically ne occurs as an independent negation particle (PART) and is marked with
Polarity=Neg
. - Negated nouns are rare and considered lexical derivations (e.g nepravda “injustice”)
- The
Polarity
feature is not used with pronouns and determiners, although there is a subset of negative pronouns and determiners. ThePronType=Neg
feature is used there instead.
- Typically ne occurs as an independent negation particle (PART) and is marked with
Verbal Features
- Although verbs have a lexical Aspect, either imperfective (
Imp
) or perfective (Perf
), like in Czech, this category is not included in the language-specific features. - Finite verbs always have one of three values of Mood:
Ind
,Imp
orCnd
. - Verbs in the indicative mood always have one of three values of Tense:
Past
,Pres
orFut
.- There are two values of the Voice feature:
Act
andPass
. Only the passive participle hasVoice=Pass
. All other verb forms haveVoice=Act
.
- There are two values of the Voice feature:
Pronouns, Determiners, Quantifiers
- PronType is used with pronouns (PRON), determiners (DET) and adverbs (ADV).
- NumType is used with numerals (NUM) and adjectives (ADJ).
- The Poss feature marks possessive personal determiners (e.g. moj “my”), possessive interrogative and possessive relative determiners (e.g. čiji “whose”) and possessive adjectives (e.g. očev “father’s”).
- The Reflex feature marks reflexive particles (se, si) and determiners (svoj). It is always used together with
PronType=Prs
. - Person is a lexical feature of personal pronouns (PRON) and has three values,
1
,2
and3
. With personal possessive determiners (DET), the feature actually encodes the person of the possessor. Person is not marked on other types of pronouns and on nouns, although they can be almost always interpreted as the 3rd person. - There are two layered features, Gender[psor] and Number[psor]. They appear with certain possessive adjectives and determiners and encode the lexical gender/number of the possessor. The extra layer is needed to distinguish these lexical features from the inflectional gender and number that mark agreement with the modified (possessed) noun.
Syntax
This is an overview of the implementation of the general UD guidelines for Croatian and Serbian. As the syntax of these two languages is very similar to Czech, Czech-specific examples scattered across the general UD guidelines might be helpful too.
Core Arguments, Oblique Arguments and Adjuncts
- Nominal subject (nsubj) is a noun phrase in the nominative case, without preposition.
- If the noun phrase is quantified, it may be in the genitive, which is required by the quantifier. If this is the case, then the quantifier is attached using a special relation, either nummod:gov or det:numgov.
- An infinitive verb may serve as the subject and is labeled as clausal subject, csubj.
On the other hand, verbal nouns as subjects are just
nsubj
. - A finite subordinate clause may serve as the subject and is labeled
csubj
.
- While traditional grammars distinguish between direct and indirect objects (like in Czech), we do not annotate any indirect object, but distinguish between objects labeled obj and oblique constituents labeled obl.
- Bare accusative phrases considered objects.
- All other constituents (bare phrases in oblique cases, prepositional phrases) are considered oblique.
- Accusative objects of some verbs alternate with finite clausal complements, which are labeled ccomp.
- If a verb subcategorizes for the infinitive (e.g. modal verbs or verbs of control), the infinitival complement is labeled xcomp.
- Adjuncts (adverbial modifiers realized as noun phrases) are usually prepositional phrases, but they can be bare noun phrases as well. These dependencies , including temporal modifiers (e.g. svake godine “every year” are all labeled obl.
- Extra attention has to be paid to clitic forms of reflexive pronouns se (accusative) and si (dative, more used in Croatian than in Serbian). Traditional grammars distinguish many different functions of these words, including (but not limited to) those listed in the documentation for Czech. We do not distinguish between most of these functions and label these words as expl unless they clearly function as obj. This decision is motivated by theoretical finings showing that traditional distinctions do not hold in most of the cases. Instead, the common function of the reflexive particle across different uses is to mark a reduction in the number of core arguments of the verb (either object or subject is not expressed).
- Passive voice is not marked in syntactic relations (e.g. no distinction between active and passive subjects), only in verbal features (as described above).
Non-verbal Clauses
- The copula verb biti/jeste (be) is used in equational, attributional, locative, possessive and benefactory nonverbal clauses.


?'
°
The
New
York
copyright
reserved
Botanical
Garden
Haenianthus
salicifolius
Grisebach
var.
obovatus
(Krug
&
Urban)
Knoblauch
det.
Scott
Zona
(RSA)
March
1990
.
THE
NEW
YORK
BOTANICAL
GARDEN
EXPLORATION
OF
PORTO
RICO
Sierra
de
Naguabo
Summit
of
Loma
la
Mina
—
Alt.
about
945
M.
No
3MŽ
COLLECTED
BY
J.
A.
SHAFER
JUUY
20.
1914
ZMAGED
NEW
YORK
BOTANICAL
GARDEN
01071728
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Russia to return navy vessels seized from Ukraine
Russian authorities have moved three Ukrainian military ships from their Crimean port in order to return them to Ukraine officials. The navy vessels were seized during a clash in the Kerch Strait last year.
Three Ukrainian ships are to be returned almost a year after the Russian navy seized the vessels in the Kerch Strait.
Tug boats were seen towing the vessels through the strait, which separates Crimea from the Russian mainland, a photographer working for the Reuters news agency reported.
Separately, Russia's security service FSB said that the three vessels would be handed over to Ukraine on Monday.
The move was "in accordance with the agreements reached with the Ukrainian side," sources from FSB's Crimean branch told Russian news agency Interfax.
Trouble in Kerch Strait
Russia's military had captured one tugboat and two small artillery vessels last November after the Ukrainian crews tried to gain access to the Sea of Azov through the Kerch Strait. The strait is the only naval access point to two of Ukraine's biggest ports, Mariupol and Berdyansk. Russia accused the Ukrainian navy of trying to stage a "provocation" and illegally entering Russian territorial waters, while Ukraine describes the incident as an act of Russian aggression.
Read more: What you need to know about the conflict in the Sea of Azov
Russian troops opened fire during the incident and one of their vessels rammed a Ukrainian boat. Several Ukrainian crew members were injured. Russian authorities eventually arrested all 24 sailors and later put them on trial for "illegally crossing the border."
Sailors free, but still on trial
A United Nations tribunal ruled in May that Russia must release the sailors and ships.
The sailors were freed in a landmark prisoner swap this September, which also saw Russia sending filmmaker Oleg Sentsov back to Ukraine. However, the legal case against the Ukrainian sailors remains ongoing in Russia.
"After the return of the detained sailors and their ships to Ukraine, ending the case against the sailors should be a natural and reasonable ending for this entire story in Russia," the head of their legal team, Nikolai Polozov, said on his Facebook page.
Waiting for 'Normandy'
The return of the ships should serve as another trust-building measure between Moscow and Kyiv, as Ukrainian President Volodymyr Zelenskiy pushes for a top-level meeting in the so-called Normandy format, with the presence of France and Germany.
While the relationship between Moscow and Kyiv remains tense, Zelenskiy's unexpected victory this April signaled a change in the long-running conflict.
dj/bk (Interfax, Reuters, Ukrainski Novini)


{% include 'header.html' %}
Thank you for subscribing to OctoGames! The best mobile content portal on the web, with 833 mobile-optimized games, and more added daily.
Cancel Subscription to Octogames?
 You'll have to re-active your subscription in order to access new releases.
Are you sure you want to cancel?


Now what?
The docs
Check out the guides, try the sample apps or study the API docs.
Read the docs
Contribute
Fork Genie on GitHub and add your favorite new features or squash some bugs.
Visit GitHub page
Get in touch
Come say "Hi!" -- join Genie's community on Gitter.
Go to Gitter


Earth’s average surface temperature has risen
~1.92 degrees Fahrenheit/0.9 degrees Celsius
since the late 19th century, because of increased
carbon dioxide and other man made emissions into
the atmosphere.
Oceans have absorbed much of the increased heat,
with the top 700 meters showing a warming of 0.302
degrees Fahrenheit since 1969.
Greenland has lost 281 billion tons of ice per year
from 1993 and 2016 and Antarctica lost 119 billion
tons in the same time period.
Global sea level rose about 8 inches in the last
century. The rate in the last two decades was almost
double the last century.
The amount of carbon dioxide absorbed by the upper
layer of the oceans is increasing by 2 billion tons
per year.


◦Describe your current brand in the template.
◦Develop your desired brand in the template. Ensure that answers in all categories (core values, strengths, brand personality, brand image and brand promise) align to provide a consistent brand view.
◦Note the gaps between current brand and desired brand—or those areas you have asterisked in your desired brand. (How to improve your brand will be addressed in the Action Plan in chapter 6.)
◦On a separate sheet of paper (or a reminder file in your smartphone), list your key brand descriptors. Refer to this list daily to keep you “on brand.”