All About Statistics Tue, 17 Nov 2015 01:14:54 +0000 en-US hourly 1 http://wordpress.org/?v=3.4.2 statsblogshttps://feedburner.google.com Just Filling in the Bubbles http://feedproxy.google.com/~r/statsblogs/~3/1s62XyJ3QZs/ /2015/11/17/just-filling-in-the-bubbles/#comments Tue, 17 Nov 2015 01:14:54 +0000 Andrew http://andrewgelman.com/?p=28093

Collin Hitt writes: I study wrong answers, per your blog post today. My research focuses mostly on surveys of schoolchildren. I study the kids who appear to be just filling in the bubbles, who by accident actually reveal something of use for education researchers. Here’s his most recent paper, “Just Filling in the Bubbles: Using […]

The post Just Filling in the Bubbles appeared first on Statistical Modeling, Causal Inference, and Social Science.

The post Just Filling in the Bubbles appeared first on All About Statistics.

]]>
(This article was originally published at Statistical Modeling, Causal Inference, and Social Science, and syndicated at StatsBlogs.)

Screen Shot 2015-11-16 at 8.14.14 PM

Collin Hitt writes:

I study wrong answers, per your blog post today. My research focuses mostly on surveys of schoolchildren. I study the kids who appear to be just filling in the bubbles, who by accident actually reveal something of use for education researchers.

Here’s his most recent paper, “Just Filling in the Bubbles: Using Careless Answer Patterns on Surveys as a Proxy Measure of Noncognitive Skills,” which concludes:

Using two national longitudinal datasets, I [Hitt] show that careless answer patterns from adolescent respondents are negatively predictive of later educational attainment, independent of cognitive ability and other traditionally-measured noncognitive skills. I posit that careless answers, as I have quantified them, proxy as a behavioral measure of a negative noncognitive trait.

No graphs, though. Gotta work on the graphs. Need some graphs. graphs graphs graphs

The post Just Filling in the Bubbles appeared first on Statistical Modeling, Causal Inference, and Social Science.



Please comment on the article here: Statistical Modeling, Causal Inference, and Social Science

The post Just Filling in the Bubbles appeared first on All About Statistics.

]]>
/2015/11/17/just-filling-in-the-bubbles/feed/ 0 /2015/11/17/just-filling-in-the-bubbles/
Paret’oothed importance sampling and infinite variance [guest post] http://feedproxy.google.com/~r/statsblogs/~3/nguidwkHyjw/ /2015/11/16/paretoothed-importance-sampling-and-infinite-variance-guest-post/#comments Mon, 16 Nov 2015 23:15:52 +0000 xi'an http://xianblog.wordpress.com/?p=29021 [Here are some comments sent to me by Aki Vehtari in the sequel of the previous posts.] The following is mostly based on our arXived paper with Andrew Gelman and the references mentioned  there. Koopman, Shephard, and Creal (2009) proposed to make a sample based estimate of the existence of the moments using generalized Pareto […]

The post Paret’oothed importance sampling and infinite variance [guest post] appeared first on All About Statistics.

]]>
(This article was originally published at Xi'an's Og » R, and syndicated at StatsBlogs.)

IS_vs_PSIS_k09[Here are some comments sent to me by Aki Vehtari in the sequel of the previous posts.]

The following is mostly based on our arXived paper with Andrew Gelman and the references mentioned  there.

Koopman, Shephard, and Creal (2009) proposed to make a sample based estimate of the existence of the moments using generalized Pareto distribution fitted to the tail of the weight distribution. The number of existing moments is less than 1/k (when k>0), where k is the shape parameter of generalized Pareto distribution.

When k<1/2, the variance exists and the central limit theorem holds. Chen and Shao (2004) show further that the rate of convergence to normality is faster when higher moments exist. When 1/2≤k<1, the variance does not exist (but mean exists), the generalized central limit theorem holds, and we may assume the rate of convergence is faster when k is closer to 1/2.

In the example with “Exp(1) proposal for an Exp(1/2) target”, k=1/2 and we are truly on the border. IS_vs_PSIS_k05

In our experiments in the arXived paper and in Vehtari, Gelman, and Gabry (2015), we have observed that Pareto smoothed importance sampling (PSIS) usually converges well also with k>1/2 but k close to 1/2 (let’s say k<0.7). But if k<1 and k is close to 1 (let’s say k>0.7) the convergence is much worse and both naïve importance sampling and PSIS are unreliable.

Two figures are attached, which show the results comparing IS and PSIS in the Exp(1/2) and Exp(1/10) examples. The results were computed with repeating 1000 times a simulation with 10000 samples in each. We can see the bad performance of IS in both examples as you also illustrated. In Exp(1/2) case, PSIS is also to produce much more stable results. In Exp(1/10) case, PSIS is able to reduce the variance of the estimate, but it is not enough to avoid a big bias.

It would be interesting to have more theoretical justification why infinite variance is not so big problem if k is close to 1/2 (e.g. how the convergence rate is related to the amount of fractional moments).

I guess that max ω[t] / ∑ ω[t] in Chaterjee and Diaconis has some connection to the tail shape parameter of the generalized Pareto distribution, but it is likely to be much noisier as it depends on the maximum value instead of a larger number of tail samples as in the approach by Koopman, Shephard, and Creal (2009).IS_vs_PSIS_exp19A third figure shows an example where the variance is finite, with “an Exp(1) proposal for an Exp(1/1.9) target”, which corresponds to k≈0.475 < 1/2. Although the variance is finite, we are close to the border and the performance of basic IS is bad. There is no sharp change in the practical behaviour with a finite number of draws when going from finite variance to infinite variance. Thus, I think it is not enough to focus on the discrete number of moments, but for example, the Pareto shape parameter k gives us more information. Koopman, Shephard, and Creal (2009) also estimated the Pareto shape k, but they formed a hypothesis test whether the variance is finite and thus discretising the information in k, and assuming that finite variance is enough to get good performance.


Filed under: Kids, pictures, R, Statistics, University life Tagged: central limit theorem, generalised Pareto distribution, importance sampling, infinite variance estimators, Pareto distribution, Pareto smoothed importance sampling, smoothing



Please comment on the article here: Xi'an's Og » R

The post Paret’oothed importance sampling and infinite variance [guest post] appeared first on All About Statistics.

]]>
/2015/11/16/paretoothed-importance-sampling-and-infinite-variance-guest-post/feed/ 0 /2015/11/16/paretoothed-importance-sampling-and-infinite-variance-guest-post/
HOFs, closures, partial application and currying to solve the function environment problem in Scala http://feedproxy.google.com/~r/statsblogs/~3/erbPnuqeStc/ /2015/11/16/hofs-closures-partial-application-and-currying-to-solve-the-function-environment-problem-in-scala/#comments Mon, 16 Nov 2015 16:38:13 +0000 darrenjw http://darrenjw.wordpress.com/?p=1643 Introduction Functional programming (FP) is a programming style that emphasises the use of referentially transparent pure functions and immutable data structures. Higher order functions (HOFs) tend to be used extensively to enable a clean functional programming style. A HOF is just a function that either takes a function as an argument or returns a function. … Continue reading HOFs, closures, partial application and currying to solve the function environment problem in Scala

The post HOFs, closures, partial application and currying to solve the function environment problem in Scala appeared first on All About Statistics.

]]>
(This article was originally published at Darren Wilkinson's research blog, and syndicated at StatsBlogs.)

Introduction

Functional programming (FP) is a programming style that emphasises the use of referentially transparent pure functions and immutable data structures. Higher order functions (HOFs) tend to be used extensively to enable a clean functional programming style. A HOF is just a function that either takes a function as an argument or returns a function. For example, the default List type in Scala is immutable. So, if one defines a list via

val l1 = List(1,2,3)

we add a new value to the front of the list by creating a new list from the old list and leaving the old list unchanged:

val l2 = 4 :: l1
// List(4, 1, 2, 3)

We can create a new list the same length as an existing list by applying the same function to each element of the list in turn using map:

val l3 = l2 map { x => x*x }
// List(16, 1, 4, 9)

We could write this slightly differently as

val l4 = l2.map(x => x*x)

which makes it clearer that map is a higher order function on lists. In fact, the presence of a map method on List[_] makes it a functor, but that is a topic for another post.

HOFs are ubiquitous in FP, and very powerful. But there are a few techniques for working with functions in Scala (and other FP languages) which make creating and using HOFs more convenient.

Plotting a function of one scalar variable

There are many, many reasons for using functions and HOFs in scientific and statistical computing (optimising, integrating, differentiating, or sampling, to name just a few). But the basic idea can be illustrated simply by considering the problem of plotting a function of one scalar variable.

All of the code associated with this post is available in the curry directory of my blog repo. Full instructions for running the code are included in the README. The code includes a simple short method, plotFun which uses breeze to produce a simple plot of a user supplied function. For example:

import Currying._

plotFun(x => x*x)

produces the plot:

Quadratic Plot

We can use this method to plot other functions, for example:

def myQuad1(x: Double): Double = x*x - 2*x + 1
plotFun(myQuad1)
def myQuad2(x: Double): Double = x*x - 3*x - 1
plotFun(myQuad2)

Now technically, myQuad1 and myQuad2 are methods rather than functions. The distinction is a bit subtle, and they can often be used interchangeably, but the difference does sometimes matter, so it is good to understand it. To actually define a function and plot it, we could instead use code like:

val myQuad3: (Double => Double) = x => -x*x + 2
plotFun(myQuad3)

Note that here myQuad3 is a value whose type is a function mapping a Double to a Double. This is a proper function. This style of function declaration should make sense to people coming from other functional languages such as Haskell, but is potentially confusing to those coming from O-O languages such as Java. Note that is is easy to convert a method to a function using an underscore, so that, for example, myQuad2 _ will give the function corresponding to myQuad2. Note that there is no corresponding way to get a method from a function, so that is one reason for preferring method declaration syntax (and there are others, such as the ability to parametrise method declarations with generic types).

Now, rather than defining lots of specific instances of quadratic functions from scratch, it would make more sense to define a generic quadratic function and then just plot particular instances of this generic quadratic. It is simple enough to define a generic quadratic with:

def quadratic(a: Double, b: Double, c: Double, x: Double): Double = 
  a*x*x + b*x + c

But we clearly can’t pass that in to the plotting function directly, as it has the wrong type signature (not Double => Double), and the specific values of a, b and c need to be given. This issue crops up a lot in scientific and statistical computing – there is a function which has some additional parameters which need to be fixed before the function can actually be used. This is referred to as the “function environment problem” by Oliveira and Stewart (section 8.5). Fortunately, in functional languages it’s easy enough to use this function to create a new “partially specified” function and pass that in. For example, we could just do

plotFun(x => quadratic(3,2,1,x))

We can define another function, quadFun, which allows us to construct these partially applied function closures, and use it as follows:

def quadFun(a: Double, b: Double, c: Double): Double => Double = 
  x => quadratic(a,b,c,x)
val myQuad4 = quadFun(2,1,3)
plotFun(myQuad4)
plotFun(quadFun(1,2,3))

Here, quadFun is a HOF in the sense that it returns a function closure corresponding to the partially applied quadratic function. The returned function has the type Double => Double, so we can use it wherever a function with this signature is expected. Note that the function carries around with it its lexical “environment”, specifically, the values of a, b and c specified at the time quadFun was called. This style of constructing closures works in most lexically scoped languages which have functions as first class objects. I use this style of programming a lot in several different languages. In particular, I’ve written previously about lexical scope and function closures in R.

Again, the intention is perhaps slightly more explicit if we re-write the above using function syntax as:

val quadFunF: (Double,Double,Double) => Double => Double = 
  (a,b,c) => x => quadratic(a,b,c,x)
val myQuad5 = quadFunF(-1,1,2)
plotFun(myQuad5)
plotFun(quadFunF(1,-2,3))

Now, this concept of partial application is so prevalent in FP that some languages have special syntactic support for it. In Scala, we can partially apply using an underscore to represent unapplied parameters as:

val myQuad6 = quadratic(1,2,3,_: Double)
plotFun(myQuad6)

In Scala we can also directly write our functions in curried form, with parameters (or parameter lists) ordered as they are to be applied. So, for this example, we could define (partially) curried quad and use it with:

def quad(a: Double, b: Double, c: Double)(x: Double): Double = a*x*x + b*x + c
plotFun(quad(1,2,-3))
val myQuad7 = quad(1,0,1) _
plotFun(myQuad7)

Note the use of an underscore to convert a partially applied method to a function. Also note that every function has a method curried which turns an uncurried function into a (fully) curried function. So in the case of our quadratic function, the fully curried version will be a chain of four functions.

def quadCurried = (quadratic _).curried
plotFun(quadCurried(1)(2)(3))

Again, note the strategic use of an underscore. The underscore isn’t necessary if we have a true function to start with, as the following illustrates:

val quadraticF: (Double,Double,Double,Double) => Double = (a,b,c,x) => a*x*x + b*x + c
def quadCurried2 = quadraticF.curried
plotFun(quadCurried2(-1)(2)(3))

Summary

Working with functions, closures, HOFs and partial application is fundamental to effective functional programming style. Currying functions is one approach to handling the function environment problem, and is the standard approach in languages such as Haskell. However, in Scala there are other possible approaches, such as using underscores for partial application. The preferred approach will depend on the context. Currying is often used for HOFs accepting a function as argument (as it can help with type inference), and also in conjunction with implicits (beyond the scope of this post – pun intended). In other contexts partial application using underscores seems to be more commonly used.

References




Please comment on the article here: Darren Wilkinson's research blog

The post HOFs, closures, partial application and currying to solve the function environment problem in Scala appeared first on All About Statistics.

]]>
/2015/11/16/hofs-closures-partial-application-and-currying-to-solve-the-function-environment-problem-in-scala/feed/ 0 /2015/11/16/hofs-closures-partial-application-and-currying-to-solve-the-function-environment-problem-in-scala/
Is 8+4 less than 3? 11% of respondents say Yes! http://feedproxy.google.com/~r/statsblogs/~3/m7ruNouOlyI/ /2015/11/16/is-84-less-than-3-11-of-respondents-say-yes/#comments Mon, 16 Nov 2015 15:38:15 +0000 Andrew http://andrewgelman.com/?p=27580

Shane Frederick shares some observations regarding junk survey responses: Obviously, some people respond randomly. For open ended questions, it is pretty easy to determine the fraction who do so. In some research I did with online surveys, “asdf” was the most common and “your mama” was 9th. This fraction is small (maybe 1-2%). But the […]

The post Is 8+4 less than 3? 11% of respondents say Yes! appeared first on Statistical Modeling, Causal Inference, and Social Science.

The post Is 8+4 less than 3? 11% of respondents say Yes! appeared first on All About Statistics.

]]>
(This article was originally published at Statistical Modeling, Causal Inference, and Social Science, and syndicated at StatsBlogs.)

Shane Frederick shares some observations regarding junk survey responses:

Obviously, some people respond randomly. For open ended questions, it is pretty easy to determine the fraction who do so. In some research I did with online surveys, “asdf” was the most common and “your mama” was 9th. This fraction is small (maybe 1-2%). But the fraction of random responses is harder to identify (and is likely higher) for items with binary and multichotomous response options, since many respondents must realize their random responding can go undetected. Hence, you can’t use the random response rate from open ended questions to assess this. You can do other things to try to estimate it (like ask them “Is 8+4 less than 3?” YES NO). But two problems remain: the fraction saying YES is a blend of random and perverse responding and both of these things vary across items. Dramatically.

I put up a few questions on Google Consumer Surveys with large samples. Random + perverse response rates differ dramatically:

Do you have a fraternal twin? YES NO
4% Yes. *Pretty close to truth*

Do you have an identical twin? YES NO
8% Yes. *Pretty far from truth, but funnier to lie about?*

Is 8+4 less than 3? YES NO
11% Yes. *Profound innumeracy, confusion, or just fucking with me?*

Were you born on the planet Neptune? YES NO
17% Yes. *Perhaps using it metaphorically, as in “My friends say I’m a weird guy”?*

In a recent published paper I [Frederick] averred that you could just multiply the number of people who endorse something crazy by the number of response options to estimate the fraction of random responders. But this is obviously wrong.

So, basically, I’m not sure what to do. You could look at response latencies or something, but then you end up imposing some arbitrary thresholds which are unsatisfying, much like removing outliers without any good justification that the responses are not sincere.

My reply: These responses are hilarious. I believe there is some literature on this sort of thing but I’m not the expert on it. I’ve looked a bit into list experiments (you can search my blog, I have a post with a title like, A list of reasons not to trust list experiments) but there seems to be a lot of information on the actual responses. Maybe you could learn something by regressing these on demographics, also see if the same people who give wrong answers for some of these, give wrong answers for others.

The post Is 8+4 less than 3? 11% of respondents say Yes! appeared first on Statistical Modeling, Causal Inference, and Social Science.



Please comment on the article here: Statistical Modeling, Causal Inference, and Social Science

The post Is 8+4 less than 3? 11% of respondents say Yes! appeared first on All About Statistics.

]]>
/2015/11/16/is-84-less-than-3-11-of-respondents-say-yes/feed/ 0 /2015/11/16/is-84-less-than-3-11-of-respondents-say-yes/
So you are getting crushed on the internet? The new normal for academics. http://feedproxy.google.com/~r/statsblogs/~3/IBOtt_Q2oN8/ /2015/11/16/so-you-are-getting-crushed-on-the-internet-the-new-normal-for-academics/#comments Mon, 16 Nov 2015 14:49:04 +0000 Jeff Leek http://simplystatistics.org/?p=4426 Roger and I were just talking about all the discussion around the Case and Deaton paper on death rates for middle class people. Andrew Gelman discussed it among many others. They noticed a potential bias in the analysis and did some re-analysis. Just yesterday an economist blogger wrote a piece about academics versus blogs and

The post So you are getting crushed on the internet? The new normal for academics. appeared first on All About Statistics.

]]>
(This article was originally published at Simply Statistics, and syndicated at StatsBlogs.)

Roger and I were just talking about all the discussion around the Case and Deaton paper on death rates for middle class people. Andrew Gelman discussed it among many others. They noticed a potential bias in the analysis and did some re-analysis. Just yesterday an economist blogger wrote a piece about academics versus blogs and how many academics are taken by surprise when they see their paper being discussed so rapidly on the internet. Much of the debate comes down to the speed, tone, and ferocity of internet discussion of academic work - along with the fact that sometimes it isn't fully fleshed out.

I have been seeing this play out not just in the case of this specific paper, but many times that folks have been confronted with blogs or the quick publication process of f1000Research. I think it is pretty scary for folks who aren't used to "internet speed" to see this play out and I thought it would be helpful to make a few points.

  1. Everyone is an internet scientist now. The internet has arrived as part of academics and if you publish a paper that is of interest (or if you are a Nobel prize winner, or if you dispute a claim, etc.) you will see discussion of that paper within a day or two on the blogs. This is now a fact of life.
  2. The internet loves a fight. The internet responds best to personal/angry blog posts or blog posts about controversial topics like p-values, errors, and bias. Almost certainly if someone writes a blog post about your work or an f1000 paper it will be about an error/bias/correction or something personal.
  3. Takedowns are easier than new research and happen faster. It is much, much easier to critique a paper than to design an experiment, collect data, figure out what question to ask, ask it quantitatively, analyze the data, and write it up. This doesn't mean the critique won't be good/right it just means it will happen much much faster than it took you to publish the paper because it is easier to do. All it takes is noticing one little bug in the code or one error in the regression model. So be prepared for speed in the response.

In light of these three things, you have a couple of options about how to react if you write an interesting paper and people are discussing it - which they will certainly do (point 1), in a way that will likely make you uncomfortable (point 2), and faster than you'd expect (point 3). The first thing to keep in mind is that the internet wants you to "fight back" and wants to declare a "winner". Reading about amicable disagreements doesn't build audience. That is why there is reality TV. So there will be pressure for you to score points, be clever, be fast, and refute every point or be declared the loser. I have found from my own experience that is what I feel like doing too. I think that resisting this urge is both (a) very very hard and (b) the right thing to do. I find the best solution is to be proud of your work, but be humble, because no paper is perfect and thats ok. If you do the best you can , sensible people will acknowledge that.

I think these are the three ways to respond to rapid internet criticism of your work.

  • Option 1: Respond on internet time. This means if you publish a big paper that you think might be controversial  you should block off a day or two to spend time on the internet responding. You should be ready to do new analysis quickly, be prepared to admit mistakes quickly if they exist, and you should be prepared to make it clear when there aren't. You will need social media accounts and you should probably have a blog so you can post longer form responses. Github/Figshare accounts make it better for quickly sharing quantitative/new analyses. Again your goal is to avoid the personal and stick to facts, so I find that Twitter/Facebook are best for disseminating your more long form responses on blogs/Github/Figshare. If you are going to go this route you should try to respond to as many of the major criticisms as possible, but usually they cluster into one or two specific comments, which you can address all in one.
  • Option2 : Respond in academic time. You might have spent a year writing a paper to have people respond to it essentially instantaneously. Sometimes they will have good points, but they will rarely have carefully thought out arguments given the internet-speed response (although remember point 3 that good critiques can be faster than good papers). One approach is to collect all the feedback, ignore the pressure for an immediate response, and write a careful, scientific response which you can publish in a journal or in a fast outlet like f1000Research. I think this route can be the most scientific and productive if executed well. But this will be hard because people will treat that like "you didn't have a good answer so you didn't respond immediately". The internet wants a quick winner/loser and that is terrible for science. Even if you choose this route though, you should make sure you have a way of publicizing your well thought out response - through blogs, social media, etc. once it is done.
  • Option 3: Do not respond. This is what a lot of people do and I'm unsure if it is ok or not. Clearly internet facing commentary can have an impact on you/your work/how it is perceived for better or worse. So if you ignore it, you are ignoring those consequences. This may be ok, but depending on the severity of the criticism may be hard to deal with and it may mean that you have a lot of questions to answer later. Honestly, I think as time goes on if you write a big paper under a lot of scrutiny Option 3 is going to go away.

All of this only applies if you write a paper that a ton of people care about/is controversial. Many technical papers won't have this issue and if you keep your claims small, this also probably won't apply. But I thought it was useful to try to work out how to act under this "new normal".



Please comment on the article here: Simply Statistics

The post So you are getting crushed on the internet? The new normal for academics. appeared first on All About Statistics.

]]>
/2015/11/16/so-you-are-getting-crushed-on-the-internet-the-new-normal-for-academics/feed/ 0 /2015/11/16/so-you-are-getting-crushed-on-the-internet-the-new-normal-for-academics/
Internet use and religious affiliation in Europe http://feedproxy.google.com/~r/statsblogs/~3/4GRXDKocw8E/ /2015/11/16/internet-use-and-religious-affiliation-in-europe/#comments Mon, 16 Nov 2015 14:42:00 +0000 Allen Downey /?guid=deb612c31381fc44c701ba4288ecd123 A few years ago I wrote a paper about Internet use and religious affiliation using data from the General Social Survey (GSS).  After controlling for things like education, income, and religious upbringing, I found that people who use the Internet ...

The post Internet use and religious affiliation in Europe appeared first on All About Statistics.

]]>
(This article was originally published at Probably Overthinking It, and syndicated at StatsBlogs.)

A few years ago I wrote a paper about Internet use and religious affiliation using data from the General Social Survey (GSS).  After controlling for things like education, income, and religious upbringing, I found that people who use the Internet more are less likely to have a religious affiliation; that is, they are more likely to be "Nones".  I made an argument for why I think this effect is plausibly causative and, if so, I estimated that it accounts for about 20% of the decrease in religious affiliation in the U.S. between 1990 and 2010.  Last April it got some media attention (including this brief discussion on Fox News); here is the blog post I wrote about it at the time.

Since then, I have been planning to replicate the study using data from the European Social Survey, but I didn't get back to it until a few weeks ago.  I was reminded about it because they recently released data from Round 7, conducted in 2014.  I am always excited about new data, but in this case it doesn't help me: in Rounds 6 and 7 they did not ask about Internet use.

But they did ask in Rounds 1 through 5, collected between 2002 and 2010.  So that's something.  I downloaded the data, loaded it into Pandas dataframes, and started cleaning, validating, and doing some preliminary exploration.  This IPython notebook shows what the first pass looks like.

In the interest of open, replicable science, I am posting preliminary work here, but at this point we should not take the results too seriously.

Data inventory

The dependent variables I plan to study are

rlgblg: Do you consider yourself as belonging to any particular religion or denomination?

rlgdgr: Regardless of whether you belong to a particular religion, how religious would you say you are?

The explanatory variables are

yrbrn: And in what year were you born?

hinctnta: Using this card, please tell me which letter describes your household's total income, after tax and compulsory deductions, from all sources? If you don't know the exact figure, please give an estimate. Use the part of the card that you know best: weekly, monthly or annual income.

eduyrs: About how many years of education have you completed, whether full-time or part-time? Please report these in full-time equivalents and include compulsory years of schooling.

tvtot: On an average weekday, how much time, in total, do you spend watching television?

rdtot: On an average weekday, how much time, in total, do you spend listening to the radio?

nwsptot: On an average weekday, how much time, in total, do you spend reading the newspapers?

netuse: Now, using this card, how often do you use the internet, the World Wide Web or e-mail - whether at home or at work - for your personal use?

Recodes

Income: I created a variable, hinctnta5, which subtracts 5 from hinctnta, so the mean is near 0.  This shift makes the parameters of the model easier to interpret.

Year born: Similarly, I created yrbrn60, which subtracts 1960 from yrbrn.

Years of education: The distribution of eduyrs includes some large values that might be errors, and the question was posed differently in the first few rounds.  I will investigate more carefully later, but for now I am replacing values greater than 25 years with 25, and subtracting off the mean, 12, to create eduyrs12.


Results

Just to get a quick look at things, I ran a logistic regression with rlgblg as the dependent variable, using data Rounds 1-5 and including all countries.  The sample size is 229,307.  Here are the estimated parameters (computed by StatsModels):
coefstd errzP>|z|[95.0% Conf. Int.]
Intercept0.98110.01470.0140.0000.954 1.009
yrbrn60-0.00780.000-27.8260.000-0.008 -0.007
eduyrs12-0.03760.001-29.6190.000-0.040 -0.035
hinctnta5-0.02200.002-12.9340.000-0.025 -0.019
tvtot-0.01610.002-7.2050.000-0.021 -0.012
rdtot-0.01490.002-8.8260.000-0.018 -0.012
nwsptot-0.03200.004-8.9240.000-0.039 -0.025
netuse-0.07580.002-42.0620.000-0.079 -0.072

The parameters are all statistically significant with very small p-values.  And they are all negative, which indicates:

  • Younger people are less likely to report a religious affiliation.
  • More educated people are less likely...
  • People with higher income are less likely...
  • People who consume more media (television, radio, newspaper) are less likely...
  • People who use the Internet more are less likely...
The effect of Internet use (per hour per week) appears to be about twice the effect of reading the newspaper, which is about twice the effect of television or radio.

The effect of the Internet is comparable to about a decade of age, two years of education, or 3 deciles of income.


Most of these results are consistent with what I saw in my previous study and what other studies have shown.  One exception is income: in other studies, the usual pattern is that people in the lowest income groups are less likely to be affiliated, and after that, income has no effect.  We'll see if this preliminary result holds up.

I ran a similar model using rlgdgr (degree of religiosity) as the dependent variable:
coefstd errtP>|t|[95.0% Conf. Int.]
Intercept5.66680.019300.0710.0005.630 5.704
yrbrn60-0.01800.000-47.3520.000-0.019 -0.017
eduyrs12-0.06880.002-40.1590.000-0.072 -0.065
hinctnta5-0.02660.002-11.3970.000-0.031 -0.022
tvtot-0.08010.003-26.3340.000-0.086 -0.074
rdtot-0.01790.002-7.7910.000-0.022 -0.013
nwsptot-0.05310.005-10.8730.000-0.063 -0.044
netuse-0.10200.002-40.9420.000-0.107 -0.097

The results are similar.  Again, this IPython notebook has the details.

Limitations

Again, we should not take these results too seriously yet:

  1. So far I am not taking into account the weights associated with respondents, either within or across countries.  So for now I am oversampling people in small countries, as well as some groups within countries.
  2. At this point I haven't done anything careful to fill missing values, so the results will change when I get that done.
  3. And I think it will be more meaningful to break the results down by country.
Stay tuned.  More coming soon!







Please comment on the article here: Probably Overthinking It

The post Internet use and religious affiliation in Europe appeared first on All About Statistics.

]]>
/2015/11/16/internet-use-and-religious-affiliation-in-europe/feed/ 0 /2015/11/16/internet-use-and-religious-affiliation-in-europe/
Label markers in graphs by using the values of several variables http://feedproxy.google.com/~r/statsblogs/~3/kDtht-6suuA/ /2015/11/16/label-markers-in-graphs-by-using-the-values-of-several-variables/#comments Mon, 16 Nov 2015 10:24:44 +0000 Rick Wicklin http://blogs.sas.com/content/iml/?p=15220

In many procedures, the ID statement is used to identify observations by specifying an identifying variable, such as a name or a patient ID. In many regression procedures, you can specify multiple ID variables, and all variables are copied into output data sets that contain observation-wise statistics such as predicted […]

The post Label markers in graphs by using the values of several variables appeared first on The DO Loop.

The post Label markers in graphs by using the values of several variables appeared first on All About Statistics.

]]>
(This article was originally published at The DO Loop, and syndicated at StatsBlogs.)

In many procedures, the ID statement is used to identify observations by specifying an identifying variable, such as a name or a patient ID. In many regression procedures, you can specify multiple ID variables, and all variables are copied into output data sets that contain observation-wise statistics such as predicted values and residuals.

Values of an ID variable can also be used to label markers on a graph. For example, the following call to PROC REG models the weights of 19 students as a linear function of their heights. The PLOTS=COOKSD(LABEL) option requests a plot of Cook's D statistic, which gives information about observations that appear to have a large influence on the parameter estimates. The LABEL option requests that extreme values of the Cook's D statistic be labeled by using the ID variable. Let's see what happens if you specify two variables on the ID statement:

proc reg data=sashelp.class plots(only)=cooksd(label);
model weight = height;
id name age;             /* specify TWO ID variables */
ods select CooksDPlot;
quit;
concatID1

I've added a red rectangle that surrounds the labeled marker. Although two variables (NAME and AGE) were specified in the ID statement, the graph clearly shows that only the first variable (NAME) was used as a label. The documentation for the PLOTS= option tells us that this is the expected behavior: "If you specify one or more ID variables..., then the first ID variable [that] you specify is used for the labeling."

Most procedures exhibit a similar behavior, although a few (LOGISTIC, TRANSREG, ...) provide tooltips or other support for multiple ID variables.

For the procedures that support labeling by only one variable, there is an easy workaround: create a new ID variable by concatenating several other variables.

Concatenating multiple ID variables

You can use the concatenation operator (||) in the DATA step to concatenate two variables together. The following statements concatenate values of the NAME and AGE variables. The TRIM function can be used to remove trailing blanks from the NAME variable. In many cases, the DATA step will automatically convert the numeric AGE variable to a character value, but the following statements use the PUT function to explicitly convert a numeric variable to a character value prior to concatenation:

/* concatenate NAME and AGE to make new ID variable */
data class;
set sashelp.class;
length labl $12;    /* NAME holds 8 characters. Allow for delimiter and age */
labl = trim(Name) || ": " || put(age, 2.);  /* convert two-digit age to character */
run;
 
proc reg data=class plots(only)=cooksd(label);
model weight = height;
id labl;               /* label by using new variable */
ods select CooksDPlot;
quit;
concatID2

With this change, each extreme point in the graph is labeled with the values of the NAME and AGE variables.

Labeling markers in ODS graphics

You can use the same trick to label a marker in a graph created by PROC SGPLOT. The canonical example is a scatter plot in which you want to label all observations. Because the DATALABEL= option supports only a single variable, you have to use concatenation if you want to see the values of multiple variables:

proc sgplot data=class;
scatter x=height y=weight / datalabel = labl;
run;
concatID3

A drawback of the "concatenation technique" is that most graphs do not have room to display long labels for many points. The DATALABEL= option uses a collision-avoidance algorithm to avoid overplotting labels, but if you have hundreds or thousands of markers, it is best to use another mechanism for labeling markers.

One option to display multiple labels is to label only certain observations in the graph, such as observations that have extreme values. Another option, which works if you are going to examine the graph on your computer, is to use the TIP= option to create a tooltip for the scatter plot. With a tooltip, you can hover a pointer over a marker and view a pop-up window that displays the values of multiple variables.

tags: Statistical Graphics

The post Label markers in graphs by using the values of several variables appeared first on The DO Loop.



Please comment on the article here: The DO Loop

The post Label markers in graphs by using the values of several variables appeared first on All About Statistics.

]]>
/2015/11/16/label-markers-in-graphs-by-using-the-values-of-several-variables/feed/ 0 /2015/11/16/label-markers-in-graphs-by-using-the-values-of-several-variables/
Tapestry 2016 Open For Applications http://feedproxy.google.com/~r/statsblogs/~3/drYBKBpnLSQ/ /2015/11/16/tapestry-2016-open-for-applications/#comments Mon, 16 Nov 2015 07:06:49 +0000 Robert Kosara https://eagereyes.org/?p=9066 tapestry16-teaserTapestry 2016 will take place March 9 next year in a historic hotel near Denver, CO. We have put together another exciting line-up of keynote speakers and are looking for applications from people who want to attend or speak. The goal behind Tapestry is to connect people who are interested in storytelling with data. It’s a small … Continue reading Tapestry 2016 Open For Applications

The post Tapestry 2016 Open For Applications appeared first on All About Statistics.

]]>
(This article was originally published at eagereyes, and syndicated at StatsBlogs.)

tapestry16-teaser

Tapestry 2016 will take place March 9 next year in a historic hotel near Denver, CO. We have put together another exciting line-up of keynote speakers and are looking for applications from people who want to attend or speak.

The goal behind Tapestry is to connect people who are interested in storytelling with data. It’s a small conference (about 130 people), and very focused. We are very picky about speakers and attendees, but that also means that we get a density of conversations about storytelling and data that you won’t find anywhere else.

If you want to attend, fill out the request an invite form on the website and you should hear back from us within about two weeks. This is also the place to suggest a topic for a presentation or a demo. As I said, we are very picky, and we are trying to find a good mix between the different kinds of people who want to attend. So giving us more information about what you do and why you want to attend helps us tremendously (and increases your chances of being accepted).

The main audience for Tapestry are journalists, designers, and people working in government or non-profits who are trying to communicate with data. Academics are another group we want to encourage, and perhaps the most underrepresented group so far. We always mix in interesting people from industry, etc., though, to keep things from getting stale.

We also like to pick unusual and topical venues. Next year’s is a doozy: The Stanley Hotel inspired Stephen King to write The Shining. It is located in the mountains near Denver (where NICAR will take place right after Tapestry), in a stunningly beautiful environment.

Keynote Speakers

The format of the conference includes three hour-long keynotes, six short stories, as well as a demo session and ample time for socializing and discussions.

Our first speaker at the 2016 conference will be Scott Klein, Assistant Managing Editor at ProPublica. Scott has a lot of experience in building incredible news applications, and has won many awards for his work. He is also a history buff, interested in the way data has was used for finding and reporting stories long before computers. I linked to his incredible piece on Horace Greeley a while ago, and I expect him to discuss a variety of interesting and colorful characters and examples.

Jessica Hullman is a professor at University of Washington’s iSchool. She has done some groundbreaking work exploring the use of data visualization for narrative, in particular on visual rhetoric and sequence in data stories. Her work on the potential usefulness of visual difficulties has also generated a lot of interest and discussion. I don’t know much about her planned talk yet, but I’m sure it will be thought-provoking and interesting.

Nick Sousanis is a post-doc at the University of Calgary, and the author of the amazing book/comic/Ph.D. thesis Unflattening. His thinking about images and words, how they relate to each other, and how we can go beyond our entrenched ways of seeing the world is unique and inspiring. There are some parallels with Scott McCloud’s ideas (besides the obvious one of both dealing with comics), which will provide food for thought and conversations at the end of the conference.

Social Events

An important part of Tapestry are the breaks and happy hours. We have a reception the night before the actual conference, which helps break the ice and get people acquainted so there is more interaction during the actual event. We also have generous breaks and a happy hour after all the talks. The latter is mainly for the people who are staying the night and not taking off to go to NICAR (we provide transportation for those who do).

Need more details and only trust what’s written in peer-reviewed journals? I wrote a CG&A Vis Viewpoints article on Tapestry earlier this year.



Please comment on the article here: eagereyes

The post Tapestry 2016 Open For Applications appeared first on All About Statistics.

]]>
/2015/11/16/tapestry-2016-open-for-applications/feed/ 0 /2015/11/16/tapestry-2016-open-for-applications/
Asking the question is the most important step http://feedproxy.google.com/~r/statsblogs/~3/JE6Y_hzABlE/ /2015/11/16/asking-the-question-is-the-most-important-step/#comments Mon, 16 Nov 2015 02:28:45 +0000 Andrew http://andrewgelman.com/?p=28063

In statistics, the glamour often comes to those who perform a challenging data analysis that extracts signal from noise, as in Aki Vehtari’s decomposition of the famous birthday data which led to the stunning graphs on the cover of BDA3. But, from a social-science point of view, the biggest credit has to go to whoever […]

The post Asking the question is the most important step appeared first on Statistical Modeling, Causal Inference, and Social Science.

The post Asking the question is the most important step appeared first on All About Statistics.

]]>
(This article was originally published at Statistical Modeling, Causal Inference, and Social Science, and syndicated at StatsBlogs.)

john

In statistics, the glamour often comes to those who perform a challenging data analysis that extracts signal from noise, as in Aki Vehtari’s decomposition of the famous birthday data which led to the stunning graphs on the cover of BDA3.

But, from a social-science point of view, the biggest credit has to go to whoever asked the question in the first place. For the birthday example, that credit goes to Becca Levy, Pil Chung, and Martin Slade who were the ones who noticed the pattern of excess births on Valentine’s day and fewer on Halloween. From a statistics perspective, the challenge began there. But nothing would’ve been done without the question being asked.

I’ve been thinking about this recently in the context of the recent discussion of trends in mortality rates among middle-aged whites:

focus_group_3

I worked super-hard to make the graph above, along with lots of other displays like this grid that helped me understand what was going on in the data. And people such as this anonymous commenter have been looking carefully into issues of data quality.

All of this work is useful and relevant, I do believe. But, from the social science perspective, what’s far more important is asking the question in the first place, which is what Case and Deaton did in their recent article. The data have been out there for any of us to grab and graph and analyze. But we didn’t. Case and Deaton did, and that’s what got the ball rolling. (And, to be fair, they also rolled the ball most of the way.) I’m happy to have refined their analyses and, as noted yesterday, I wasn’t so thrilled by one of Case’s offhand remarks, but let me emphasize that all this discussion is predicated on their effort, on their knowing what to look at, which in turn derives from their justly well-respected research on public health and economic development.

That’s the big picture. Acknowledging a statistical bias correction is fine, and statisticians such as myself have our place in the research ecosystem, but all the bias correction and modeling and clever graphics in the world won’t help you if you don’t know what to look at. And in this particular example, I had no idea of looking at any of this until I was pointed to Case and Deaton’s work. Aggregation bias was an entry point for me into this problem, just as analyzing all 366 days was an entry point for Aki into the birthday problem. If we can correct and improve and expand existing analyses, that’s great, but in these cases none of our contributions could’ve happened without the work by the original authors.

It’s not Us vs. Them. It’s never Us vs. Them. It’s Us and Them. Or, perhaps more accurately, THEM followed by a little bit of us. And that’s one reason I want them to respect and understand us, not to fear us and be defensive. We want to be useful, which we can do by building upon their work and motivating them (not just the original researchers, but the whole field) to do more.

The point of a bias correction is not “gotcha!” Rather, the point of the bias correction is that the original researchers are studying something interesting and important, and we want to help them do better.

The post Asking the question is the most important step appeared first on Statistical Modeling, Causal Inference, and Social Science.



Please comment on the article here: Statistical Modeling, Causal Inference, and Social Science

The post Asking the question is the most important step appeared first on All About Statistics.

]]>
/2015/11/16/asking-the-question-is-the-most-important-step/feed/ 0 /2015/11/16/asking-the-question-is-the-most-important-step/
November Reading http://feedproxy.google.com/~r/statsblogs/~3/uIcIWzn2g0s/ /2015/11/15/november-reading/#comments Sun, 15 Nov 2015 23:03:00 +0000 Dave Giles /?guid=81c22cde715e819d686d161c7601db59 Somewhat belatedly, here is some suggested reading for this month:Al-Sadoon, M. M., 2015. Testing subspace Granger causality. Barcelona GSE Working Paper Series, Working Paper nº 850.Droumaguet, M., A. Warne, & T. Wozniak, 2015. Granger causality ...

The post November Reading appeared first on All About Statistics.

]]>
(This article was originally published at Econometrics Beat: Dave Giles' Blog, and syndicated at StatsBlogs.)

Somewhat belatedly, here is some suggested reading for this month:
  • Al-Sadoon, M. M., 2015. Testing subspace Granger causality. Barcelona GSE Working Paper Series, Working Paper nº 850.
  • Droumaguet, M., A. Warne, & T. Wozniak, 2015. Granger causality and regime influence in Bayesian Markov-switching VAR's. Department of Economics, University of Melbourne. 
  • Foroni, C., P. Guerin, & M. Marcellino, 2015. Using low frequency information for predicting high frequency variables. Working Paper 13/2015, Norges Bank.
  • Hastie, T., R. Tibshirani, & J. Friedman, 2009. The Elements of Statistical Learning: data Mining, Inference, and Prediction (2nd. ed.). Springer, New York. (Legitimate download.) 
  • Hesterberg, T. C., 2015. What teachers should know about the bootstrap: Resampling in the undergraduate statistics curriculum. American Statistician, in press. 
  • Uribe, R. Q. & G. Rodríguez, 2015. Data-dependent methods for the lag selection in unit root tests with structural change. Documento de Trabajo No. 404, Departmento de Economía, Pontificia Universidad Católica del Perú.


© 2015, David E. Giles



Please comment on the article here: Econometrics Beat: Dave Giles' Blog

The post November Reading appeared first on All About Statistics.

]]>
/2015/11/15/november-reading/feed/ 0 /2015/11/15/november-reading/