sp.categorical(separationplot)
sp.categorical()所属R语言包:separationplot
Separation plots for variables with more than two outcome levels
有两个以上结果层面的变量分离图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function generates separation plots for polytomous dependent variables.
此功能为多分因变量产生分离图。
用法----------Usage----------
sp.categorical(pred, actual, file = NULL, cex = 1.5, ...)
参数----------Arguments----------
参数:pred
A matrix of fitted values. Each row represents one observation, and each column represents the probability of obtaining that outcome. The column names correspond to the outcome categories.
拟合值的矩阵。每一行代表一个观察,每一列代表取得这一结果的概率。列名对应的结果类别。
参数:actual
A vector containing the actual outcomes corresponding to each observation.
一个向量,包含对应于每个观察的实际结果。
参数:file
The name and file path of where the pdf output should be written, if desired. If file=NULL the output will be written to the screen.
名和文件路径的PDF输出,如果需要的话,应该写。如果file=NULL输出将被写入到屏幕上。
参数:cex
Character expansion factor used for the outcome category labels.
用于字符膨胀系数的结果类别标签。
参数:...
Additional arguments passed to separationplot.
额外的参数传递给separationplot。
Details
详细信息----------Details----------
This function is a wrapper for separationplot that generates a series of separation plots for each outcome category for a variable with more than two outcomes.
这个函数是一个包装separationplot产生了一系列的分离图结果类别为每个变量有两个以上的结果。
值----------Value----------
None. This function is used for its side effects only.
无。此功能用于其副作用。
注意----------Note----------
(作者)----------Author(s)----------
Brian Greenhill <<a href="mailto:brian.d.greenhill@dartmouth.edu">brian.d.greenhill@dartmouth.edu</a>>
参考文献----------References----------
参见----------See Also----------
See separationplot for a description of the core function for generating separation plots.
见separationplot的核心功能,产生分离图的说明。
实例----------Examples----------
# Example using an ordered probit model from Neumayer (2005) "Do international human rights[例如,使用有序的概率模型诺伊迈尔(2005年)“国际人权]
# treaties improve respect for human rights?" Journal of Conflict Resolution, 49 (6), 2005,[条约改善对人权的尊重吗?“解决冲突,49(6),2005年,]
# pp. 925-953 [第925-953]
library(foreign)
library(MASS)
neumayer<-read.dta("http://www2.lse.ac.uk/dataFiles/geographyAndEnvironment/Replication/Article%20for%20JCR%20(Human%20Rights).dta")
# create a new dataframe called "data4" that just contains the variables we're interested in (and with simpler names).[创建一个新的的数据框称为“DATA4”只包含我们感兴趣的变量(和简单的名称)。]
data6<-na.omit(data.frame(DV=neumayer$aipts, laggedDV=neumayer$laipts, rat=neumayer$iccprmainrat, ingo.pc=neumayer$wiikngointerpc, dem=neumayer$politycorr020, extwar=neumayer$uppsalaexternalincountry, civwar=neumayer$uppsalainternal, gdp=neumayer$lngdp1995pc, pop=neumayer$lnpop, country=neumayer$country, year=neumayer$year))
# run the model (note that this is Model 6 of Table 2 of the published paper):[运行模型(请注意,这是模型6发表的论文表2):]
model6<-polr(as.ordered(DV)~laggedDV +rat + rat:ingo.pc + rat:dem +ingo.pc +dem +extwar +civwar+gdp +pop, data=data6, Hess=T, method="probit")
summary(model6)
sp.categorical(pred=model6$fitted.values, actual=as.character(model6$model[,1]), cex=2.5)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|