我从女性调查中得到以下数据。当我遵循[http://www.ats.ucla.edu/stat/r/dae/mlogit.htm]显示的指南时,我运行了一些命令并获得了系数,p值和相对风险 我很感激他们。
我带来了以下命令
但是,我无法显示图表。
有人可以帮帮我吗? 感谢。
这是数据
年龄:32 39 40 35 55 30 60 55 28 25 35 28 30 50 25 35 47 38 54 38 54 48 52 48 41 51 43 49 51 63 39 64 38 29 36 44 57 28 46 51 22 60 56 55 41 35 30 60 68 30 36 25 45 50 32 43 52 55 45 58 53 51 50 52 80 67 48 38 32 52 35 60 51 34 46 38 35 28 80 48 91 40 45 40 58 40 45 37 38 25 58 53 42 60 70 68 62 53 53 66 40 39 35 32 25 40 40 45 51 48 58 44 47 52 57 35 57 92 88 87 43 44 40 47 41 52 40 42 49 40 37 40 38 30 44 38 39 32 41 38 42 40 29 26 38 31 43 38 36 32 28 28 34 37 32 40 39 31 42 38 38 36
rel:Chris Chris Chris Chris Trad Islam Trad Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Isris Chris Chris Chris Chris Islam Chris Trad Chris Chris Islam Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Is Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris hris Chris Chris Trad Chris Chris Chris Chris Chris Chris Chris Trad Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Chris Trad Trad Chris Chris Chris Chris Chris
宠物:三三二三三一二三一二三三三二三三三三三一三三三三三二三二三三二三三三一三三三一三三一一三三一三三三三二三三三二一一二二一二一一二一一二一三一二一二二三一二二二二二三二二两二二一一三一三三三一三三二三三三三一二二一三三三二二一三二三二二三三三三二二三三三二三三二三三三三三三三二三三三三重稀土Sec=read.table("Second.txt", header=TRUE)
Sec
attach(Sec)
library(nnet)
library(ggplot2)
library(reshape2)
m1 <- multinom(pet ~ age+rel, data = Sec)
summary(m1)
Relrisk=exp(coef(m1))
Relrisk
z <- summary(m1)$coefficients/summary(m1)$standard.errors
z
p <- (1 - pnorm(abs(z), 0, 1))*2
p
frame=data.frame(age=rep(seq(22,92,by=0.434),3),rel=rep(c("Chris","Islam","Trad"),each=54))
frame
attach(frame)
pred=cbind(frame,predict(m1,newdata=frame,type="probs", se= TRUE))
pred
Preprobmelt=melt(pred,id.vars=c("rel","age"),value.name="Probability")
Preprobmelt
Graph=ggplot(Preprobmelt,aes(x = age,y=Probability, colour=rel,group=age))
geom_line()
facet_grid(variable~ .,scales = "free")
Graph
答案 0 :(得分:2)
我没有看到正确构建ggplot对象的必要加号。它应该是:
Graph=ggplot(Preprobmelt,aes(x = age,y=Probability, colour=rel,group=age)) +
geom_line() +
facet_grid(variable~ .,scales = "free")
请注意如何将三件事与加号(+
)符号一起添加。
您可能还应该在脚本中明确打印ggplot
个对象:
print(Graph)
答案 1 :(得分:0)
试试这个(你不需要连续变量&#39; age&#39;作为ggplot aes()中的组):
$routeProvider
.when('/', {
templateUrl: '/ServiceDesk/starter'
})
//Facturas
.when('/app/Facturacion/MantenimientoFacturas', {
templateUrl: '/Facturacion/MantenimientoFacturas',
controller: 'FacturasController'
})
// Ordenes
.when('/app/Facturacion/MantenimientoOrdenes', {
templateUrl: '/Facturacion/MantenimientoOrdenes',
controller: 'OrderController'
});
$locationProvider.html5Mode(true);