Re: [R] Troubles plotting lrm output in Design Library

2008-05-30 Thread Patrizio Frederic
2008/5/29 Frank E Harrell Jr [EMAIL PROTECTED]:
 Patrizio Frederic wrote:

 dear Harrell,
 thank you for quick reply and suggestions. I still have the problem:

 library(Design)
 x   = rnorm(100)
 y   = runif(100)(exp(x)/(1+exp(x)))
 y   = 0*y+1*y
 d   = datadist(x,y)
 options(datadist=d)
 fit = lrm(y~x)
 # works fine, but
 plot(fit) #produce the error message

 I cannot reproduce the error on Linux R 2.7.0 using the same version of the
 packages you are using.

 Frank


just for the records, I solved the problem: in Windows R 2.7.0 one has to set:

d = datadist(x,y)
.Options$datadist=d

done that functions summary.Design, and plot.Design work fine.

PF

__
R-help@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.


Re: [R] Troubles plotting lrm output in Design Library

2008-05-30 Thread Frank E Harrell Jr

Patrizio Frederic wrote:

2008/5/29 Frank E Harrell Jr [EMAIL PROTECTED]:

Patrizio Frederic wrote:

dear Harrell,
thank you for quick reply and suggestions. I still have the problem:

library(Design)
x   = rnorm(100)
y   = runif(100)(exp(x)/(1+exp(x)))
y   = 0*y+1*y
d   = datadist(x,y)
options(datadist=d)
fit = lrm(y~x)
# works fine, but
plot(fit) #produce the error message

I cannot reproduce the error on Linux R 2.7.0 using the same version of the
packages you are using.

Frank



just for the records, I solved the problem: in Windows R 2.7.0 one has to set:

d = datadist(x,y)
.Options$datadist=d

done that functions summary.Design, and plot.Design work fine.

PF



Thanks for the solution.  But I wish someone would tell us why the 
solution makes sense.  If you have changed your R environment in any way 
from the defaults please let us know.


Frank

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
R-help@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.


Re: [R] Troubles plotting lrm output in Design Library

2008-05-30 Thread Patrizio Frederic
 Thanks for the solution.  But I wish someone would tell us why the solution
 makes sense.  If you have changed your R environment in any way from the
 defaults please let us know.

 Frank

 --
 Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University


dear Harrell and R users,
It took me several hours to figure out. I apologize it was my mistake.
Few month ago a modified copy of .Options was created in Rprofile (I
don't remember why). The copy masked the alias .Options created by
options().
Now everything is fixed. Now I know how .Options and options are
related one each other. Sorry for wasting your time.
Thank you for your help.

Patrizio Frederic

__
R-help@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.


Re: [R] Troubles plotting lrm output in Design Library

2008-05-30 Thread Frank E Harrell Jr

Patrizio Frederic wrote:

Thanks for the solution.  But I wish someone would tell us why the solution
makes sense.  If you have changed your R environment in any way from the
defaults please let us know.

Frank

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
Department of Biostatistics   Vanderbilt University



dear Harrell and R users,
It took me several hours to figure out. I apologize it was my mistake.
Few month ago a modified copy of .Options was created in Rprofile (I
don't remember why). The copy masked the alias .Options created by
options().
Now everything is fixed. Now I know how .Options and options are
related one each other. Sorry for wasting your time.
Thank you for your help.

Patrizio Frederic



That's great news.  Thanks for figuring this out.

Frank

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
R-help@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.


Re: [R] Troubles plotting lrm output in Design Library

2008-05-30 Thread Prof Brian Ripley

On Fri, 30 May 2008, Patrizio Frederic wrote:


Thanks for the solution.  But I wish someone would tell us why the solution
makes sense.  If you have changed your R environment in any way from the
defaults please let us know.

Frank

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
Department of Biostatistics   Vanderbilt University



dear Harrell and R users,
It took me several hours to figure out. I apologize it was my mistake.
Few month ago a modified copy of .Options was created in Rprofile (I
don't remember why). The copy masked the alias .Options created by
options().
Now everything is fixed. Now I know how .Options and options are
related one each other. Sorry for wasting your time.
Thank you for your help.


This is an infelicity in Design and Hmisc (and a few other packages), in 
that they do look at the first visible .Options.  R itself only looks at 
the copy in the symbol table (which also appears in the base namespace).


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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.


Re: [R] Troubles plotting lrm output in Design Library

2008-05-30 Thread Frank E Harrell Jr

Prof Brian Ripley wrote:

On Fri, 30 May 2008, Patrizio Frederic wrote:

Thanks for the solution.  But I wish someone would tell us why the 
solution

makes sense.  If you have changed your R environment in any way from the
defaults please let us know.

Frank

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
Department of Biostatistics   Vanderbilt University



dear Harrell and R users,
It took me several hours to figure out. I apologize it was my mistake.
Few month ago a modified copy of .Options was created in Rprofile (I
don't remember why). The copy masked the alias .Options created by
options().
Now everything is fixed. Now I know how .Options and options are
related one each other. Sorry for wasting your time.
Thank you for your help.


This is an infelicity in Design and Hmisc (and a few other packages), in 
that they do look at the first visible .Options.  R itself only looks at 
the copy in the symbol table (which also appears in the base namespace).




I hadn't thought of that.  Thanks Brian.  I think of .Options$foo as 
being faster.  Is there a preferred approach other than options('foo')?


Thanks
Frank


--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
R-help@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.


Re: [R] Troubles plotting lrm output in Design Library

2008-05-30 Thread Prof Brian Ripley

On Fri, 30 May 2008, Frank E Harrell Jr wrote:


Prof Brian Ripley wrote:

On Fri, 30 May 2008, Patrizio Frederic wrote:

Thanks for the solution.  But I wish someone would tell us why the 
solution

makes sense.  If you have changed your R environment in any way from the
defaults please let us know.

Frank

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
Department of Biostatistics   Vanderbilt University



dear Harrell and R users,
It took me several hours to figure out. I apologize it was my mistake.
Few month ago a modified copy of .Options was created in Rprofile (I
don't remember why). The copy masked the alias .Options created by
options().
Now everything is fixed. Now I know how .Options and options are
related one each other. Sorry for wasting your time.
Thank you for your help.


This is an infelicity in Design and Hmisc (and a few other packages), in 
that they do look at the first visible .Options.  R itself only looks at 
the copy in the symbol table (which also appears in the base namespace).




I hadn't thought of that.  Thanks Brian.  I think of .Options$foo as being 
faster.  Is there a preferred approach other than options('foo')?


getOption(foo).  Because .Options is a pairlist, the speed can be 
illusory.




Thanks
Frank


--
Frank E Harrell Jr   Professor and Chair   School of Medicine
Department of Biostatistics   Vanderbilt University



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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.


Re: [R] Troubles plotting lrm output in Design Library

2008-05-29 Thread Patrizio Frederic
dear Harrell,
thank you for quick reply and suggestions. I still have the problem:

library(Design)
x   = rnorm(100)
y   = runif(100)(exp(x)/(1+exp(x)))
y   = 0*y+1*y
d   = datadist(x,y)
options(datadist=d)
fit = lrm(y~x)
# works fine, but
plot(fit) #produce the error message

Error in value.chk(at, ix, xseq, if (plot.type == curves) 100 else 40,  :
  variable x does not have limits defined by datadist

The installed Design (ver. 2.1.1) package was downloaded and installed
via utils:::menuInstallPkgs() function
(Package Hmisc version 3.4-3) on a windows xp machine.
Thank in advance.

Patrizio Frederic

version

platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  7.0
year   2008
month  04
day22
svn rev45424
language   R
version.string R version 2.7.0 (2008-04-22)

2008/5/29 Frank E Harrell Jr [EMAIL PROTECTED]:
 Patrizio Frederic wrote:

 Dear R-helpers,
 I'm having a problem in using plot.design in Design Library. Tho
 following example code produce the error:

 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))
 label(age)- 'Age'  # label is in Hmisc
 label(cholesterol)- 'Total Cholesterol'
 label(blood.pressure) - 'Systolic Blood Pressure'
 label(sex)- 'Sex'
 units(cholesterol)- 'mg/dl'   # uses units.default in Hmisc
 units(blood.pressure) - 'mmHg'

 # 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')

 fit - lrm(y ~ blood.pressure + sex * (age + rcs(cholesterol,4)),

 +x=TRUE, y=TRUE)

 par(mfrow=c(2,2))
 plot(fit)# Plot effects of all 4 predictors

 Error in value.chk(at, ix, xseq, if (plot.type == curves) 100 else 40,
  :
  variable blood.pressure does not have limits defined by datadist

 I guess somthing goes wrong with function datadist

 version

  _
 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  7.0
 year   2008
 month  04
 day22
 svn rev45424
 language   R
 version.string R version 2.7.0 (2008-04-22)

 thank you in advance,

 Patrizio Frederic

 This is the example run by example(plot.Design) which works for me, using
 the version of Design from CRAN.  You don't need to include code that is
 already in an example in a help file, and if you do please make the code
 copy and paste-able instead of putting something at the start of each line.

 Frank


 Frank


 -
 | Patrizio Frederic
 | Research associate in Statistics,
 | Department of Economics,
 | University of Modena and Reggio Emilia,
 | Via Berengario 51,
 | 41100 Modena, Italy
 |
 | tel:  +39 059 205 6727
 | fax:  +39 059 205 6947
 | mail: [EMAIL PROTECTED]
 +-

 __
 R-help@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.



 --
 Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University


__
R-help@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.


Re: [R] Troubles plotting lrm output in Design Library

2008-05-29 Thread Frank E Harrell Jr

Patrizio Frederic wrote:

dear Harrell,
thank you for quick reply and suggestions. I still have the problem:

library(Design)
x   = rnorm(100)
y   = runif(100)(exp(x)/(1+exp(x)))
y   = 0*y+1*y
d   = datadist(x,y)
options(datadist=d)
fit = lrm(y~x)
# works fine, but
plot(fit) #produce the error message


I cannot reproduce the error on Linux R 2.7.0 using the same version of 
the packages you are using.


Frank



Error in value.chk(at, ix, xseq, if (plot.type == curves) 100 else 40,  :
  variable x does not have limits defined by datadist

The installed Design (ver. 2.1.1) package was downloaded and installed
via utils:::menuInstallPkgs() function
(Package Hmisc version 3.4-3) on a windows xp machine.
Thank in advance.

Patrizio Frederic

version

platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  7.0
year   2008
month  04
day22
svn rev45424
language   R
version.string R version 2.7.0 (2008-04-22)

2008/5/29 Frank E Harrell Jr [EMAIL PROTECTED]:

Patrizio Frederic wrote:

Dear R-helpers,
I'm having a problem in using plot.design in Design Library. Tho
following example code produce the error:


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))
label(age)- 'Age'  # label is in Hmisc
label(cholesterol)- 'Total Cholesterol'
label(blood.pressure) - 'Systolic Blood Pressure'
label(sex)- 'Sex'
units(cholesterol)- 'mg/dl'   # uses units.default in Hmisc
units(blood.pressure) - 'mmHg'

# 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')

fit - lrm(y ~ blood.pressure + sex * (age + rcs(cholesterol,4)),

+x=TRUE, y=TRUE)

par(mfrow=c(2,2))
plot(fit)# Plot effects of all 4 predictors

Error in value.chk(at, ix, xseq, if (plot.type == curves) 100 else 40,
 :
 variable blood.pressure does not have limits defined by datadist

I guess somthing goes wrong with function datadist


version

 _
platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  7.0
year   2008
month  04
day22
svn rev45424
language   R
version.string R version 2.7.0 (2008-04-22)

thank you in advance,

Patrizio Frederic

This is the example run by example(plot.Design) which works for me, using
the version of Design from CRAN.  You don't need to include code that is
already in an example in a help file, and if you do please make the code
copy and paste-able instead of putting something at the start of each line.

Frank


Frank


-
| Patrizio Frederic
| Research associate in Statistics,
| Department of Economics,
| University of Modena and Reggio Emilia,
| Via Berengario 51,
| 41100 Modena, Italy
|
| tel:  +39 059 205 6727
| fax:  +39 059 205 6947
| mail: [EMAIL PROTECTED]
+-

__
R-help@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.



--
Frank E Harrell Jr   Professor and Chair   School of Medicine
Department of Biostatistics   Vanderbilt University






--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
R-help@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.