Kway(vcdExtra)
Kway()所属R语言包:vcdExtra
Fit All K-way Models in a GLM
在GLM模型适合所有K-
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Generate and fit all 0-way, 1-way, 2-way, ... k-way terms in a glm.
生成并符合所有0路,1路,2路,... K-办法中的glm。
This function is designed mainly for hierarchical loglinear models (or glms in the poission family), where it is desired to find the highest-order terms necessary to achieve a satisfactory fit.
此功能主要是针对层次对数线性模型(或glmS在泊松家庭),它是希望找到最高要达到一个令人满意的适合。
Using anova on the resulting glmlist object will then give sequential tests of the pooled contributions of all terms of degree k+1 over and above those of degree k.
使用anova上导致glmlist对象的综合贡献程度k+1及以上的学位k的所有条款将连续测试。
This function is also intended as an example of a generating function for glmlist objects, to facilitate model comparison, extraction, summary and plotting of model components, etc., perhaps using lapply or similar.
此功能还打算glmlist对象的生成函数的一个例子,以方便模型比较,提取,总结和绘制的模型组件等,可能使用lapply或类似的。
用法----------Usage----------
Kway(formula, family=poisson, data, ..., order = nt, prefix = "kway")
参数----------Arguments----------
参数:formula
a two-sided formula for the 1-way effects in the model. The LHS should be the response, and the RHS should be the first-order terms connected by + signs.
一个双面的公式模型中的1路效果。 LHS应该响应,并RHS应该是一阶+迹象。
参数:family
a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. (See family for details of family functions.)
在模型中使用的误差分布的描述和链接功能。这可以是一个字符串,命名家庭功能,家庭功能,家庭功能调用的结果。 (见family家庭功能的详细信息。)
参数:data
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which glm is called.
一个可选的数据框,列表或环境(或as.data.frame到数据框的对象强制转换),其中包含在模型中的变量。如果没有找到,数据,变量environment(formula),通常是glm被称为环境。
参数:...
Other arguments passed to glm
其他参数传递给glm
参数:order
Highest order interaction of the models generated. Defaults to the number of terms in the model formula.
最高的相互作用生成的模型。默认的模型公式中的数量条款。
参数:prefix
Prefix used to label the models fit in the glmlist object.
前缀用来标记的模型适合在glmlist对象。
Details
详细信息----------Details----------
With y as the response in the formula, the 0-way (null) model is y ~ 1. The 1-way ("main effects") model is that specified in the formula argument. The k-way model is generated using the formula . ~ .^k. With the default order = nt, the final model is the saturated model.
y的响应formula,的0-办法(空)模型是y ~ 1。 1路(“主要影响”)的模型是formula参数中指定的。使用下面的公式. ~ .^k的k-模型生成。默认order = nt,最终的模型是饱和模型。
As presently written, the function requires a two-sided formula with an explicit response on the LHS. For frequency data in table form (e.g., produced by xtabs) you the data argument is coerced to a data.frame, so you should supply the formula in the form Freq ~ ....
目前写的,函数需要双面公式,在LHS一个明确的回应。对于频率的数据以表格的形式(例如,xtabs)你data参数被强制为一个数据框,所以你应该提供formula的形式Freq ~ ....
值----------Value----------
An object of class glmlist, of length order+1 containing the 0-way, 1-way, ... models up to degree order.
类的一个对象glmlist,的长度order+1含有0-单向,1单向,...度模型order。
(作者)----------Author(s)----------
Michael Friendly and Heather Turner
参见----------See Also----------
glmlist, summarise
glmlist,summarise
实例----------Examples----------
## artificial data[#人工数据]
factors <- expand.grid(A=factor(1:3), B=factor(1:2), C=factor(1:3), D=factor(1:2))
Freq <- rpois(nrow(factors), lambda=40)
df <- cbind(factors, Freq)
mods3 <- Kway(Freq ~ A + B + C, data=df, family=poisson)
summarise(mods3)
mods4 <- Kway(Freq ~ A + B + C + D, data=df, family=poisson)
summarise(mods4)
# JobSatisfaction data[工作满意度数据]
data(JobSatisfaction, package="vcd")
modSat <- Kway(Freq ~ management+supervisor+own, data=JobSatisfaction, family=poisson, prefix="JSat")
summarise(modSat)
anova(modSat, test="Chisq")
# Rochdale data: very sparse, in table form[罗奇代尔的数据非常稀疏,以表格的形式]
data(Rochdale, package="vcd")
## Not run: [#不运行:]
modRoch <- Kway(Freq~EconActive + Age + HusbandEmployed + Child + Education + HusbandEducation + Asian + HouseholdWorking,
data=Rochdale, family=poisson)
summarise(modRoch)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|