Shared posts

21 Jul 13:21

Undercover Economist: The laws of Rockonomics

by Sophy, for Tim
Undercover Economist

Three lessons on money and market forces derived from the music business

Economics and rock ’n’ roll don’t necessarily go hand in hand, but there’s something in the air this summer: my attention has been called to not one but three separate economics lessons from the music business.

Lesson one comes from the front line: according to NPR’s economics podcast Planet Money, the rap/country/rock crossover artist Kid Rock has been going to war against ticket touts.

The existence of touts has long been a puzzle for microeconomists: the entire tout business model of buying underpriced tickets and reselling them for a fat mark-up would appear to depend on irrationally low ticket pricing. Why don’t rock stars simply charge more?

There are a number of possible explanations but for Kid Rock, it’s simple: he produces blue-collar music and it doesn’t feel right to be charging a premium price. Fans might be willing to pay hundreds of dollars for a concert ticket, but would resent it if Kid Rock himself tried to charge that much.

Kid Rock’s four-part solution: flood the market with lots of shows to make sure that even at the low price of $20, there are still tickets available; have a small number of super-expensive tickets near the front; allocate the very best seats by lottery to people who bought the cheap tickets; and enforce it all with paperless tickets and an ID check to prevent resale. According to Planet Money, it’s all working: concerts are pretty full but you can still buy $20 tickets from official sources.

Lesson two is about globalisation. A new article in The Economic Journal from Fernando Ferreira and Joel Waldfogel asks whether in a world of MTV and YouTube, national musical cultures are being crushed by American imports. Ferreira and Waldfogel have assembled more than a million data points covering chart hits in 22 countries, in some cases going back to 1960. In practice this covers pretty much the entire global music market, and the data are used to estimate the value of music sales.

At first glance, worries about the cultural dominance of the US seem justified: US artists are responsible for 60 per cent of world music sales. But US artists were responsible for 80 per cent of world music sales in the early 1960s before dramatically losing market share to the British. (We are now, alas, in sharp decline.)

In the early 1980s, less than 50 per cent of music sales were by domestic artists – that is, French artists selling in France, or Brazilian artists selling in Brazil. By 2007 that figure was around two-thirds. Domestically produced music is having a renaissance – proof that globalisation has more complex effects than we tend to assume.

The final rockonomics lesson of the summer comes from Alan Krueger, the chairman of Barack Obama’s Council of Economic Advisers. In a recent speech Professor Krueger sought to draw a parallel between the music industry and the threat to the American middle class. The core of his argument: in music as in life, the rich are getting richer while the rest are being left behind.

Krueger argued that this is partly the result of technological change that allows a winner-takes-all distribution of rewards. He also argued, quite convincingly, that the difference between being one of these ever-wealthier winners and an also-ran is often a matter of luck.

But what to do? Krueger was keen to applaud President Obama’s priorities as being an antidote: reforming healthcare, encouraging pre-school education, revitalising distressed communities, increasing the minimum wage and raising a stink about high pay for bankers and chief executives. I agree with Krueger about the problems but I wonder whether such approaches will do much to solve them.

It isn’t easy to harness market forces, reward the middle class and make a profit into the bargain. Perhaps Professor Krueger should ask Kid Rock for advice.

Also published at ft.com.

08 Jun 14:11

FT chart of the day: The new leaders of economic...



FT chart of the day: The new leaders of economic growth
http://on.ft.com/14vm2tw

The shift in the global economy has been clear for some time, but this year is the pivot point. In 2013, for the first time since the industrialisation of the 19th century, emerging economies such as China and India will produce the majority of the world’s goods and services.

07 Jun 00:16

How I Taught Myself to Code in Eight Weeks

by Tessa Miller

How I Taught Myself to Code in Eight Weeks

To a lot of non-developers, learning to code seems like an impossibly daunting task. However, thanks to a number of great resources that have recently been put online for free— teaching yourself to code has never been easier. I started learning to code earlier this year and can say from experience that learning enough to build your own prototype is not as hard as it seems. In fact, if you want to have a functioning prototype within two months without taking a day off work, it’s completely doable.

Below, I’ve outlined a simple path from knowing nothing about software development to having a working prototype in eight weekends that roughly mirrors the steps I took.

Introduce Yourself to the Web Stack (10 Minutes)

The presence of unfamiliar terminology makes any subject seem more confusing than it actually is. Yipit founder/CEO Vin Vacanti has a great overview of some of the key terms you’ll want to be familiar with in language you’ll understand.

Get an Introductory Grasp of Python and General Programming Techniques (1 Weekend)

  • Learn Python the hard way: Despite the title, the straightforward format makes learning basic concepts really easy and most lessons take less than 10 minutes. However, I found that the format didn’t work as well for some of the more advanced topics, so I’d recommend stopping after lesson 42 and moving on.

  • Google’s Python class: Read the notes and / or watch the videos and do all of the associated exercises until you get them right—without looking at the answers. Struggling through the exercises I kept getting wrong was the best learning experience. I would have learned far less had I just looked at the answers and tried to convince myself that I understood the concepts.

These two resources are somewhat substitutable and complementary. I recommend doing the first few lessons from both to see which you like better. Once you’ve finished one, skim through the other looking for concepts you aren’t fully comfortable with as a way to get some extra practice.

Get an Introductory Understanding of Django (1 Weekend)

  • Work through the Django tutorial.

  • Delete all your code.

  • Work through the tutorial again, from scratch.

The first time I went through the tutorial I inevitably ended up just following the instructions step-by-step without really understanding what each step did since everything felt so new.

The second time through I wasn’t as focused on the newness of the concepts was better able to focus on understanding how all the parts work together.

Get a Deeper Understanding of Python/General Programming Concepts (2-4 Weekends)

Again, I would sample each and see which you like the best. I ended up doing both but that was probably overkill.

Practice Building Simple Web Applications (1 Weekend)

  • Work through a few of the exercises in Django by example. These exercises don’t hold your hand quite as much as the Django tutorial but they still provide a fair bit of guidance so I found it to be a nice way to start taking the training wheels off.

Build Your Prototype (1 Weekend)

That’s it. Eight weekends (or less) and you’ve gone from zero to a functioning prototype. Not so daunting after all is it?

Author's Note: It goes without saying that there's a huge difference between the relatively cursory amount of knowledge needed to build a simple prototype (the focus of this post) and the depth of knowledge and experience needed to be a truly qualified software engineer. If you want to learn all that it takes to build modern web applications at scale, getting professional web development experience at a fast-growing startup like Yipit is a great next step. If you’re smart, hard-working, and passionate about creating amazing consumer web experiences drop us a line at jobs@yipit.com—we’re always looking for great people to join our team.

How I Taught Myself to Code in 8 Weeks | Yipit Django Blog


David Sinsky started at Yipit without any prior coding knowledge. Before long, he was a full developer contributing features directly into the code base.

Yipit collects local deals and online sales from thousands of sources and puts them in one place. Over 1 million people use Yipit to get a daily digest of the deals in their city and the online sales from the stores they follow.

Image remixed from ollyy (Shutterstock).

Want to see your work on Lifehacker? Email Tessa.

02 Jun 08:48

Say Hello to PowerShell

by Doug Finke

PowerShell has been in development for over ten years. Microsoft continues to invest in its development and adoption. These investments have transformed the ease and robustness with which developers and admins can automate Windows tasks.


What is PowerShell?

PowerShell solves administration and adaptability challenges by seamlessly integrating the .NET Framework.

PowerShell is Microsoft’s task automation framework, consisting of a command-line shell, an integrated scripting environment (ISE), a scripting language built on .NET Framework, an API allowing you to host PowerShell in your .NET applications, and it is a distributed automation platform. PowerShell provides full access to COM and WMI, enabling you to perform tasks on both local and remote Windows systems.

PowerShell is a new breed platform for automation, in that it solves administration and adaptability challenges by seamlessly integrating the .NET Framework. It’s good for developers, administrators, testers and more. Based on .NET, the tool drives down costs, while providing developers and administrators a simple and enterprise-ready way to automate, measure and improve all of their processes.


Follow Along

In this intro, I’ll highlight some of the depth and breadth PowerShell brings to the table. Things like the game changing object pipeline, the REPL (read, eval, print loop), .NET integration and more.

If you’re running Windows 7 or 8, PowerShell is already installed. Download PowerShell v3 for Windows 7 here. You need Windows 7 SP1 and the download also works for Windows 2008 R2 SP1 and Windows 2008 SP2. If you’re running Vista, XP or Windows 2003, you’ll need to settle for PowerShell v2 here.


What is it Good For? Absolutely Everything!

From deploying multiple resources to Azure, to handling your software builds for continuous integration, accessing web services or REST endpoints. PowerShell has you covered and provides so much more.

  • Slice and dice text, XML, CSV, and JSON with ease
  • Embed PowerShell to provide scripting capabilities for your C# apps
  • Create GUI applications five to ten times faster with less code
  • Leverage PowerShell’s capabilities to work with the Internet
  • Interact with DLLs and create objects, automatically display properties, and call methods in live interactive sessions
  • Build domain-specific languages (DSLs) and vocabularies to express solutions more clearly
  • Work with Microsoft Office via the Component Object Model (COM)
  • PowerShell v3 features

Bootstrapping PowerShell

What is a cmdlet? A cmdlet is the fundamental building block in PowerShell and is expressed as a verb-noun pair, helping to make them self-descriptive. For example:

PS C:\> Get-Date

Sunday, May 26, 2013 8:46:16 AM

PowerShell includes hundreds of core cmdlets and you can write your own.

Memorize Two Cmdlets

PowerShell makes discoverability easy. Whenever you walk up to the blue screen of PowerShell and are not sure what to do, use Get-Command.

The Get-Command cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, workflows, filters, scripts, and applications.

In essence, Get-Command shows you all the things you can do in the current PowerShell session.

Get-Command

Get-Command supports wildcards. Let’s say I want to see all the cmdlets that have the verb, Invoke?

Get-Command Invoke*

Here is what I get after pressing enter.

CommandType Name                       ModuleName
----------- ----                       ----------
Function    Invoke-AsWorkflow          PSWorkflowUtility
Function    Invoke-Background          ShowUI
Function    Invoke-BrowserControl      AutoBrowse
Function    Invoke-Line                isepack
Function    Invoke-Line                PowerShellPack
Function    Invoke-Office365           Pipeworks
Function    Invoke-Pester              Pester
Function    Invoke-WebCommand          Pipeworks
Cmdlet      Invoke-CimMethod           CimCmdlets
Cmdlet      Invoke-Command             Microsoft.PowerShell.Core
Cmdlet      Invoke-Expression          Microsoft.PowerShell.Utility
Cmdlet      Invoke-History             Microsoft.PowerShell.Core
Cmdlet      Invoke-Item                Microsoft.PowerShell.Management
Cmdlet      Invoke-RestMethod          Microsoft.PowerShell.Utility
Cmdlet      Invoke-TroubleshootingPack TroubleshootingPack
Cmdlet      Invoke-WebRequest          Microsoft.PowerShell.Utility
Cmdlet      Invoke-WmiMethod           Microsoft.PowerShell.Management
Cmdlet      Invoke-WSManAction         Microsoft.WSMan.Management

What are the cmdlets ending in the noun Item?

Get-Command *-Item

Note that you start to see other verbs, like Clear, New, Remove and Set.

CommandType Name        ModuleName
----------- ----        ----------
Cmdlet      Clear-Item  Microsoft.PowerShell.Management
Cmdlet      Copy-Item   Microsoft.PowerShell.Management
Cmdlet      Get-Item    Microsoft.PowerShell.Management
Cmdlet      Invoke-Item Microsoft.PowerShell.Management
Cmdlet      Move-Item   Microsoft.PowerShell.Management
Cmdlet      New-Item    Microsoft.PowerShell.Management
Cmdlet      Remove-Item Microsoft.PowerShell.Management
Cmdlet      Rename-Item Microsoft.PowerShell.Management
Cmdlet      Set-Item    Microsoft.PowerShell.Management

Next I’ll use a few cmdlets to summarize what is available in my session on one of my boxes when I launch the PowerShell console.

Get-Command | Group CommandType -NoElement | Sort Count -Descending

I call Get-Command, group it, and sort it. Here, I can see that I have 1000+ Cmdlets to work with. I’m running PowerShell v3 with additional modules installed, so your mileage may vary.

Count Name
----- ----
 2487 Function
 1184 Cmdlet
   38 Alias
    1 Filter

What modules do these cmdlets come from? We can answer that question this way:

Get-Command -CommandType Cmdlet | Group ModuleName -NoElement | Sort Count -Descending

There is a lot I can get accomplished with PowerShell.

Count Name
----- ----
  379 ShowUI
  164 Hyper-V
  157 Azure
   92 Microsoft.PowerShell.Utility
   82 Microsoft.PowerShell.Management
   78 WebAdministration
   55 Microsoft.PowerShell.Core
   22 Dism
   18 International
   17 PKI
   16 PSScheduledJob
   13 Microsoft.WSMan.Management
   12 CimCmdlets
   10 Microsoft.PowerShell.Security
    9 TrustedPlatformModule
    8 BitsTransfer
    8 MsDtc
    6 Pipeworks
    6 Kds
    5 AppLocker
    5 SecureBoot
    5 Microsoft.PowerShell.Diagnostics
    4 NetSecurity
    4 Appx
    3 WindowsErrorReporting
    2 Microsoft.PowerShell.Host
    2 TroubleshootingPack
    1 PSWorkflow
    1 DnsClient

Get-Help

Get-Help does exactly that, it displays help for the cmdlet you are what to know more about. Not only is it easy to get help, it is easy to create/include help for the cmdlets/advanced functions you develop, a topic for another article. Having help at your fingertips is a huge time saver.

Get-Help Invoke-Command

Here is a Shortened version of the output.

NAME
    Get-Process

SYNOPSIS
    Gets the processes that are running on the local computer or a remote computer.

SYNTAX
    Get-Process [[-Name] <String[]>] [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module
    [<SwitchParameter>]] [<CommonParameters>]

    Get-Process [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module [<SwitchParameter>]] -Id
    <Int32[]> [<CommonParameters>]

    Get-Process [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module [<SwitchParameter>]]
    -InputObject <Process[]> [<CommonParameters>]

DESCRIPTION
    The Get-Process cmdlet gets the processes on a local or remote computer.
.
.
.
.

Easier still; there is a switch for this on the Get-Help cmdlet that takes you here.

Get-Help Get-Process -Online

Want to just see examples how to use the cmdlet? Use the -Examples switch. Plus, you can copy and paste example directly into the console and run it.

Get-Help Get-Process -Examples

It’s that easy and quick.

NAME
    Get-Process

SYNOPSIS
    Gets the processes that are running on the local computer or a remote computer.

    -------------------------- EXAMPLE 1 --------------------------

    PS C:\> Get-Process

    This command gets a list of all of the running processes running on the local computer. For a definition of each column, see the "Additional Notes" section of the Help topic for Get-Help.

    -------------------------- EXAMPLE 2 --------------------------

    PS C:\> Get-Process winword, explorer | format-list *

PowerShell Easily Works with Web Services

The W3C defines a “Web service” as:

[...] a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.

PowerShell makes quick work of Webservices, using the New-WebServiceProxy cmdlet. Change the $zipcode, run it and get the latest weather info.

$zipCode = "96826"

$svc = New-WebServiceProxy http://wsf.cdyne.com/WeatherWS/Weather.asmx
$result = $svc.GetCityForecastByZIP($zipCode)

# Transform the results
$result.ForecastResult |
    ForEach {
        [PSCustomObject]@{
            City        = $result.City
            State       = $result.State
            Date        = $_.Date.ToString("d")
            Description = $_.Desciption
            DaytimeHigh = $_.Temperatures.DaytimeHigh
        }
    }

Result

I store the proxy object in $svc and then call the GetCityForecastByZIP method, capturing the results in $result. Looping through the ForecastResult array, I transform the record on the data. Note that the City and DaytimeHigh are at different levels in the hierarchy.

The technique I am using is creating key/value pairs for the hashtable. @{} is PowerShell syntax for a new hashtable. Using [PSCustomObject] is a PowerShell accelerator, which allows me, for one thing, to create a custom object from a hashtable.

The Weather.asmx web service returned hierarchical XML. In a handful of PowerShell commands, I re-shaped the data and formatted it (the Date) to my liking. For this example, I chose to let PowerShell print it out. Once I have the data in my PowerShell session, I am now connected to the PowerShell ecosystem and can easily pipe this array of custom objects to other cmdlets to push it to another web service, generate HTML, save it to a file, create a CSV file or export it to a SQL database.

City     State Date      Description   DaytimeHigh
----     ----- ----      -----------   -----------
Honolulu HI    5/22/2013 Showers       76
Honolulu HI    5/23/2013 Partly Cloudy 76
Honolulu HI    5/24/2013 Partly Cloudy 77
Honolulu HI    5/25/2013 Partly Cloudy 77
Honolulu HI    5/26/2013 Partly Cloudy 77
Honolulu HI    5/27/2013 Partly Cloudy 77
Honolulu HI    5/28/2013 Partly Cloudy 77

Working with CSV, JSON and XML

Slicing and dicing text formats is a PowerShell sweet spot. Here, I’ll convert three common formats to a PowerShell object. For the CSV and JSON, I’ll use the correct ConvertFrom-* cmdlets, and for the XML, I’ll use the accelerator which takes XML and creates an XMLDocument.

# Use CSV
$csv = "Name,Age`r`nJohn,10" | ConvertFrom-Csv
$csv

Name Age
---- ---
John 10

# Use JSON
$json = "{Name:'Tom', Age:20}" | ConvertFrom-Json
$json

Name Age
---- ---
Tom   20

# Use XML
$xml = (1"<data><record><Name>Harry</Name><Age>30</Age></record></data>").data.record
$xml

Name  Age
----  ---
Harry 30

# Combine all three
$csv,$json,$xml

Name  Age
----  ---
John  10
Tom   20
Harry 30

# Add up the ages
$csv,$json,$xml | % {$sum=0} {$sum+=$_.age} {$sum}

60

So, we took three heterogeneous formats, and at the end, performed an aggregation over one of the fields. I could have retrieved each of these data feeds from various places, the CSV from a network share, the JSON for an REST query and the XML from a Web Service. Like I said, this is a PowerShell sweet spot.


Twitter Search

Let’s use Twitter’s search REST API at the command line. I construct the Url, which you could use in your browser, and then I use the PowerShell cmdlet Invoke-RestMethod. It sends a request to the REST service and determines if the response is XML or JSON. Here I’m requesting a JSON response so, Invoke-RestMethod converts the results to an array of PowerShell objects. I pipe them to the Select cmdlet (an alias of the verb-noun Select-Object) choosing to only three fields. Think of this as a projection, similar to LINQ or SQL.

$query = "PowerShell"
$url = "http://search.twitter.com/search.json?q=$query"

(Invoke-RestMethod $url).results |
    Select created_at, from_user_name, text

Result

It’s that easy. Check out a video I did for version 2: “PowerShell, ShowUI and the Twitter API”. A mini WPF Twitter app in handful of PowerShell.

created_at       from_user_name       text
----------       --------------       ----
Sat, 25 May 2013 vitor pombeiro       @brunomlopes a falar sobre Powershell "Ã  minha maneira"
Sat, 25 May 2013 Jeffery Hicks        Did you know the #PowerShell ISE has startup options? In
Sat, 25 May 2013 Pat Richard          @mwjcomputing Yeah - had always used $MyInvocation.MyCom
Sat, 25 May 2013 Rob Fairman          "#PowerShell Script for Clearing #Windows Event Logs" ht
Sat, 25 May 2013 Jim Priestley        Automating SharePoint Deployments in Windows #Azure usin
Sat, 25 May 2013 VT Technology        RT @jangwoo_park: “@VTTechnology: Export Multiple Virtua
Sat, 25 May 2013 Aryan Nava           Using PowerShell to view Site created on the previous da
Sat, 25 May 2013 Aryan Nava           PowerShell Tips for SQL Server http://t.co/lVW2AY5BYZ
Sat, 25 May 2013 Private Cloud Tech   The Journey to the Private Cloud Part 3 – The Infrastruc
Sat, 25 May 2013 Dr Tom Shinder       The Journey to the Private Cloud Part 3 – The Infrastruc
Sat, 25 May 2013 Jacob Daniels        RT @tech_faq: Windows Server Manager is based on Windows
Sat, 25 May 2013 CodeCruiser          10 Tips for the SQL Server PowerShell Scripter http://t.

Compiling C# on the Fly in PowerShell

PowerShell is an interpreted language. So, there will be a penalty. It is not a major concern, but, sometimes, you’ll need the speed of a compiled language. PowerShell lets you compile C# on the fly in memory in your PowerShell session, by using the -TypeDefinition parameter on the Add-Type cmdlet. Note the here-string identified by the @" "@. They are super useful when quoting text. I encourage you to explore more with Add-Type and PowerShell’s quoting rules.

Add-Type -TypeDefinition @"
public class TestInline
{
    public long Fibonacci(long n)
    {
        long a = 0;
        long b = 1;

        for (long idx = 0; idx < n; idx+=1)
        {
            long temp = a;
            a = b;
            b = temp + b;
        }
            return a;
        }
}
"@

$obj = New-Object TestInline

1..10 | ForEach { $obj.Fibonacci($_) }

Interacting with DLLS

Now, let’s say I didn’t give you the source code – just the compiled DLL. No problem: Add-Type has a -Path parameter.

Add-Type -Path .\FibLib.dll

$obj = New-Object TestInline
1..10 | ForEach { $obj.Fibonacci($_) }

Pay particular attention to this. Using Add-Type this way is how you easily wrap any .NET DLL coming from anybody, if they haven’t already provided a PowerShell interface. This is true whether the DLL is from Microsoft, DELL, Citrix or another developer.


In Closing

So that does it for now. Would you like to see more Powershell-specific content on Nettuts+? Let us know below!

01 Jun 14:23

Why weird science is all in a day’s work

by Sophy, for Tim
Since You Asked

Stories of the formula for the perfect penalty kick are cheaper than an ads, writes Tim Harford

‘People who have surgery towards the end of the week are more likely to die than those who have procedures earlier on, researchers say’ BBC.co.uk, May 29

This is presumably the National Health Service’s equivalent of Detroit’s lemons. If you buy a car that was assembled on a Friday afternoon, woe betide you . . . 

It is conceivable surgeons operate after a boozy Friday lunch. A more plausible explanation is the NHS is short-staffed at weekends and so if your surgery leads to complications you may be less likely to get prompt attention from experienced staff. Several studies have suggested it’s not a great idea to be stuck in hospital over the weekend, but there has been a suspicion the problem may not be the staff but the patients. Those who rock up for emergency surgery at three o’clock on a Saturday morning may just be different sorts of people with different conditions, compared to those who arrive at lunchtime on Wednesday. This research looked at planned surgery, not emergency surgery, which (one hopes) removes that source of confusion.

I’m sceptical. Haven’t we heard “researchers say” all sorts of things about different days of the week?

“Researchers say” the strangest things, at least according to the newspapers. You may be thinking of the “Blue Monday” equation, which purported to show the last Monday in January was, scientifically speaking, the year’s most depressing day.

That’s the one!

It’s nonsense. Harry Frankfurt’s essay “On Bullshit” pointed out while a liar knows the truth and is determined to conceal it, the bull merchant has no interest in whether something is true or not. This particular piece of nonsense is arbitrary pseudoscience.

Researchers publish nonsensical pseudoscience in the media all the time. Which is why I was sceptical about the “don’t get sick on Friday” study.

The problem is we constantly read that “researchers say” one thing or another. Perhaps that phrase once conveyed something meaningful – that experts had conducted a rigorous study on a topic and that we didn’t need to worry with the details, but could skip to the punchline. If so, public relations companies have hijacked the phrase, using it as a vector to infect the nervous systems of journalists and their editors. The Blue Monday study was paid for by a travel agency. Other nonsensical equations have been commissioned by ice cream makers, lingerie manufacturers, supermarkets and bookmakers. Some academic is persuaded to attach his good name to the sorry affair – and the definition of “academic” is often very loose. Nobody cares. Stories breathlessly relating the discovery of the mathematical formula for the perfect penalty kick, the perfect pair of breasts or the perfect weekend are routinely published. They are cheaper than paying for advertising.

But you’re going to tell me that the hospital mortality study was different, because it wasn’t sponsored by some corporate PR outfit?

You’re missing the point. The real flaw with Blue Monday wasn’t that it was commissioned by a corporation. It was that it had no scientific content. Science isn’t just whatever emerges from the mouth of someone with a tenuous university affiliation. Science is a process. The hospital study is part of that scientific process. It identified a hypothesis of importance. It gathered data – more than 4m inpatient admissions for every hospital in England over the course of three years. It analysed the data, with enough statistical power that the observed patterns were enormously unlikely to be the result of chance. It found an effect that was large enough to be of real practical concern. The research refers to, and supplements, previous studies in the area – and future studies will refer to, and supplement, this one. It was peer-reviewed and published in the British Medical Journal, an organ with a reputation to defend.

So the research checks out.

With apologies to Star Trek, I’m an economist, Jim, not a doctor. But it looks solid to me. Whether the BMJ study ultimately turns out to be correct, it is a world away from Blue Monday or the equation for the beer-goggles effect. Yet to the casual consumer of newspaper reporting, the difference is far from clear. So now half the country is credulous about pseudoscience, while the other half is disbelieving of perfectly good research. It’s all far more disheartening than a Monday morning.

Also published at ft.com.