R中的哪个程序包用于计算线性模型上的非零空假设p值? [英] What package in R is used to calculate non-zero null hypothesis p-values on linear models?

查看:53
本文介绍了R中的哪个程序包用于计算线性模型上的非零空假设p值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标准 summary(lm(Height〜Weight))将输出假设检验H0:Beta1 = 0的结果,但是如果我有兴趣检验假设H0:B1 = 1一个将产生该p值的包装?我知道我可以手工计算它,我知道我可以翻转置信区间".进行两次尾巴检验(通过查看95% confint 是否包含关注点来测试95%的假设),但我正在寻找一种简单的方法来为模拟研究生成p值

The standard summary(lm(Height~Weight)) will output results for the hypothesis test H0: Beta1=0, but if I am interested in testing the hypothesis H0: B1=1 is there a package that will produce that p-value? I know I can calculate it by hand and I know I can "flip the confidence interval" for a two tailed test (test a 95% hypothesis by seeing if the 95% confint contains the point of interest), but I am looking for an easy way to generate the p-values for a simulation study.

推荐答案

您可以从 car 包中使用 linearHypothesis ,例如:

You can use linearHypothesis from the package car, for example:

library(car)
fit = lm(Petal.Width ~ Petal.Length,data=iris)

fit

Call:
lm(formula = Petal.Width ~ Petal.Length, data = iris)

Coefficients:
 (Intercept)  Petal.Length  
     -0.3631        0.4158  

linearHypothesis(fit,"Petal.Length=0.4")
Linear hypothesis test

Hypothesis:
Petal.Length = 0.4

Model 1: restricted model
Model 2: Petal.Width ~ Petal.Length

  Res.Df    RSS Df Sum of Sq      F Pr(>F)
1    149 6.4254                           
2    148 6.3101  1   0.11526 2.7034 0.1023

还有一个文章有关此软件包的详细信息.

There's also an article about the specifics of this package.

这篇关于R中的哪个程序包用于计算线性模型上的非零空假设p值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆