CovarianceMatrices stderr()


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
 [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) ?


what is the (::Base.TTY)

It’s the standard error stream.

julia> print(stderr, "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}:


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.”


This topic was automatically closed 12 days after the last reply. New replies are no longer allowed.