简体   繁体   中英

How do I use t-distribution with glm() in R?

I've established pretty conclusively that the residuals I'm generating with a standard lm() regression can be reasonably modeled by a t-distribution with 6-ish degrees of freedom. I'd like to use glm() with that error model, but I'm not seeing that the t fits into one of the families. Any recommendations on either alternatives to glm() that play well with t, or a family that would serve reasonably well as a substitute for (or superset of) t?

Package heavy can perform t-student regression models. Here is an example from the documentation:

library(heavy)
data(ereturns)
fit <- heavyLm(m.marietta ~ CRSP, data = ereturns, family = Student(df = 6))
summary(fit)
# Linear model under heavy-tailed distributions
# Data: ereturns; Family: Student(df = 2.83727) 
# 
# Residuals:
#  Min        1Q    Median        3Q       Max 
# -0.142237 -0.036156  0.003433  0.041310  0.546533 
# 
# Coefficients:
#  Estimate Std.Error Z value p-value
# (Intercept) -0.0072   0.0082   -0.8876  0.3748
# CRSP         1.2637   0.1902    6.6459  0.0000
# 
# Degrees of freedom: 60 total; 58 residual
# Scale estimate: 0.002520795
# Log-likelihood: 71.81294 on 3 degrees of freedom

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM