# CovarianceMatrices stderr()

**URL:** <https://discourse.julialang.org/t/covariancematrices-stderr/17216>\
**Category:** Statistics\
**Created:** [November 6, 2018, 5:38pm UTC](https://discourse.julialang.org/t/covariancematrices-stderr/17216 "2018-11-06T17:38:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [November 6, 2018, 5:38pm UTC](https://discourse.julialang.org/t/covariancematrices-stderr/17216/1 "2018-11-06T17:38:28Z")

</div>

this is a minor headscratcher:

```julia
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) ?

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [November 6, 2018, 6:56pm UTC](https://discourse.julialang.org/t/covariancematrices-stderr/17216/2 "2018-11-06T18:56:03Z")

</div>

> what is the (::Base.TTY)

It’s the standard error stream.

```julia
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
julia> stderror(mylm, HC3)
3-element Array{Float64,1}:
 0.3652189222615689
 0.031003033896914146
 0.003246364827550289

```

---

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [November 6, 2018, 7:09pm UTC](https://discourse.julialang.org/t/covariancematrices-stderr/17216/3 "2018-11-06T19:09:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/julialang/original/3X/1/2/12829a7ba92b924d4ce81099cbf99785bee9b405.png) [@system](https://discourse.julialang.org/u/system)\
**Post date:** [November 18, 2018, 7:09pm UTC](https://discourse.julialang.org/t/covariancematrices-stderr/17216/4 "2018-11-18T19:09:35Z")

</div>

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