dear£º
in the example£¨nomogram£©£¬I don't understand the meanings of the
program which have been marked by red line.And how to compile the program(L
<- .4*(sex=='male') + .045*(age-50) +
(log(cholesterol - 10)-5.2)*(-2*(sex=='female') +
2*(sex=='male'))).
n <- 1000 # define sample size
set.seed(17) # so can reproduce the results
age <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol <- rnorm(n, 200, 25)
sex <- factor(sample(c('female','male'), n,TRUE))
# Specify population model for log odds that Y=1
L <- .4*(sex=='male') + .045*(age-50) +
(log(cholesterol - 10)-5.2)*(-2*(sex=='female') +
2*(sex=='male'))
# Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)]
y <- ifelse(runif(n) < plogis(L), 1, 0)
ddist <- datadist(age, blood.pressure, cholesterol, sex)
options(datadist='ddist')
f <- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure)
nom <- nomogram(f, fun=function(x)1/(1+exp(-x)), # or fun=plogis
fun.at=c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999),
funlabel="Risk of Death")
#Instead of fun.at, could have specified fun.lp.at=logit of
...
Thank you for you expain !
truly yours
[[alternative HTML version deleted]]
On Jul 31, 2010, at 6:29 AM, ?? wrote:> dear?? > in the example??nomogram????I don't understand the meanings > of the program which have been marked by red line.This is a plain text mailing list, hence no red line ... in fact no line at all. Use some other device such also outlining with (text) comment lines such as: #---need explanation for code starting here----- R code # ---end---- And. Read the Posting Guide. You have just quoted verbatim from the nomogram help page in the rms package. -- David.> And how to compile the program(L <- .4*(sex=='male') + .045*(age-50) + > (log(cholesterol - 10)-5.2)*(-2*(sex=='female') + 2*(sex=='male'))). > > > n <- 1000 # define sample size > set.seed(17) # so can reproduce the results > age <- rnorm(n, 50, 10) > blood.pressure <- rnorm(n, 120, 15) > cholesterol <- rnorm(n, 200, 25) > sex <- factor(sample(c('female','male'), n,TRUE)) > # Specify population model for log odds that Y=1 > L <- .4*(sex=='male') + .045*(age-50) + > (log(cholesterol - 10)-5.2)*(-2*(sex=='female') + 2*(sex=='male')) > # Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)] > y <- ifelse(runif(n) < plogis(L), 1, 0) > ddist <- datadist(age, blood.pressure, cholesterol, sex) > options(datadist='ddist') > f <- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure) > nom <- nomogram(f, fun=function(x)1/(1+exp(-x)), # or fun=plogis > fun.at=c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999), > funlabel="Risk of Death") > #Instead of fun.at, could have specified fun.lp.at=logit of > ... > Thank you for you expain ! > truly > yours > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD West Hartford, CT
dear£ºDavid Winsemius
in the example£¨nomogram£©£¬I don't understand the meanings of the
program which have been marked by red line.And how to compile the program.(L
<- .4*(sex=='male') + .045*(age-50) +(log(cholesterol -
10)-5.2)*(-2*(sex=='female') + 2*(sex=='male'))).
n <- 1000 # define sample size
set.seed(17) # so can reproduce the results
age <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol <- rnorm(n, 200, 25)
sex <- factor(sample(c('female','male'), n,TRUE))
#---need explanation for code starting here-----
# Specify population model for log odds that Y=1
L <- .4*(sex=='male') + .045*(age-50) +
(log(cholesterol - 10)-5.2)*(-2*(sex=='female') +
2*(sex=='male'))
# ---end----
# Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)]
y <- ifelse(runif(n) < plogis(L), 1, 0)
ddist <- datadist(age, blood.pressure, cholesterol, sex)
options(datadist='ddist')
f <- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure)
nom <- nomogram(f, fun=function(x)1/(1+exp(-x)), # or fun=plogis
fun.at=c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999),
funlabel="Risk of Death")
#Instead of fun.at, could have specified fun.lp.at=logit of
...
Thank you for you expain !
truly yours
ÄúÏëÓµÓкÍÍøÒ×Ãâ·ÑÓÊÏäÒ»ÑùÇ¿´óµÄÈí¼þÂð£¿
[[alternative HTML version deleted]]
dear£ºDavid Winsemius
in the example£¨nomogram£©£¬I don't understand the meanings of the
program which have been marked by comment line.And how to compile the
program.(L <- .4*(sex=='male') + .045*(age-50) +(log(cholesterol -
10)-5.2)*(-2*(sex=='female') + 2*(sex=='male'))).
example(nomogram)
n <- 1000 # define sample size
set.seed(17) # so can reproduce the results
age <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol <- rnorm(n, 200, 25)
sex <- factor(sample(c('female','male'), n,TRUE))
#---need explanation for code starting here-----
# Specify population model for log odds that Y=1
L <- .4*(sex=='male') + .045*(age-50) +
(log(cholesterol - 10)-5.2)*(-2*(sex=='female') +
2*(sex=='male'))
# ---end----
# Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)]
y <- ifelse(runif(n) < plogis(L), 1, 0)
ddist <- datadist(age, blood.pressure, cholesterol, sex)
options(datadist='ddist')
f <- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure)
nom <- nomogram(f, fun=function(x)1/(1+exp(-x)), # or fun=plogis
fun.at=c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999),
funlabel="Risk of Death")
#Instead of fun.at, could have specified fun.lp.at=logit of
...
Thank you for you expain !
truly yours
ÄúÏëÓµÓкÍÍøÒ×Ãâ·ÑÓÊÏäÒ»ÑùÇ¿´óµÄÈí¼þÂð£¿
ÍøÒ×ÓÊÏ䣬ûÓÐÀ¬»øÓʼþµÄÓÊÏä¡£
[[alternative HTML version deleted]]