CovarianceMatrices stderr()


#1

this is a minor headscratcher:

julia> using GLM, CovarianceMatrices

julia> yb= [1.0:10.0;]; df= DataFrame( y=yb, x1= yb.^2, x2= yb.^3 );

julia> mylm= glm( @formula(y~x1+x2), df, Normal(), IdentityLink());

julia> vcov( mylm, HC3 )
3×3 Array{Float64,2}:
  0.133385     -0.00995492    0.000943407
 -0.00995492    0.000961188  -9.92315e-5
  0.000943407  -9.92315e-5    1.05389e-5

julia> stderr( mylm, HC3 )
ERROR: MethodError: no method matching (::Base.TTY)(::StatsModels.DataFrameRegressionModel{GeneralizedLinearModel{GlmResp{Array{Float64,1},Normal{Float64},IdentityLink},DensePredChol{Float64,LinearAlgebra.Cholesky{Float64,Array{Float64,2}}}},Array{Float64,2}}, ::Type{HC3})
Closest candidates are:
  TTY(::StatsBase.StatisticalModel) at /Users/ivo/.julia/packages/StatsBase/NzjNi/src/deprecates.jl:24
Stacktrace:
 [1] top-level scope at none:0

I would have thought stderr should just pick off the diagonal and squareroot it, and so it would work just the same as vcov. is this undesirable, or should stderr() have another method here, too?

PS: what is the (::Base.TTY) ?


#2

what is the (::Base.TTY)

It’s the standard error stream.

julia> print(stderr, "error")
error

The name has been claimed by Base so we had to change the name for the statistical standard error function. It’s now stderror. So you can do

julia> stderror(mylm, HC3)
3-element Array{Float64,1}:
 0.3652189222615689
 0.031003033896914146
 0.003246364827550289

#3

duh! of course. how could I have missed this.

suggestion—instead of the nondescript error, maybe you could overload stderr() to give a different error in specific situations, like “you probably mean stderror and not stderr.”