这个问题确实非常广泛,应该稍微集中一点,但这里有一小部分函数可以用来处理线性模型:
x <- rnorm(seq(1,100,1))
y <- rnorm(seq(1,100,1))
model <- lm(x~y)
#general summary
summary(model)
#Visualize some diagnostics
plot(model)
#Coefficient values
coef(model)
#Confidence intervals
confint(model)
#predict values
predict(model)
#predict new values
predict(model, newdata = data.frame(y = 1:10))
#Residuals
resid(model)
#Standardized residuals
rstandard(model)
#Studentized residuals
rstudent(model)
#AIC
AIC(model)
#BIC
BIC(model)
#Cook's distance
cooks.distance(model)
#DFFITS
dffits(model)
#lots of measures related to model fit
influence.measures(model)
Run Code Online (Sandbox Code Playgroud)
可以使用推荐的软件包引导来计算模型参数的引导置信区间.这是一个非常通用的包,要求你编写一个简单的包装函数来返回感兴趣的参数,比如用一些提供的数据拟合模型并返回一个模型系数,同时它负责其余的,进行采样和计算间隔等
还要考虑插入包,它是大量建模功能的包装,但也提供了使用独立测试集或训练数据重新采样(k- fold,bootstrap)使用一系列指标来比较模型性能的工具..插入符号记录良好且易于使用,但为了充分利用它,您需要熟悉要使用的建模功能.