Re: [R] nnet

2005-12-21 Thread Prof Brian Ripley
Please do not post repeatedly to multiple lists.  (I have removed 
Bioconductor from this reply, and this repeats
https://stat.ethz.ch/pipermail/r-help/2005-December/083391.html.)

That output is not from nnet: the first 10 lines are trace msgs from nnet, 
but no nnet output is shown.  (It looks like a confusion matrix, but only 
you know how you generated it.)

See also the comments at the end of this reply.

  - The uncredited author of nnet


On Wed, 21 Dec 2005, madhurima bhattacharjee wrote:

 Hello Everybody,

 I would like to know how to interpret the result of nnet function of R.
 My result looks like this:

 # weights:  24
 initial  value 6.533893
 iter  10 value 4.616299
 iter  20 value 4.616120
 iter  30 value 4.616109
 iter  30 value 4.616109
 final  value 4.616109
 converged
cres
 true  1
   1 10
   2  3

 Can anyone please help me asap?

 Thanks and Regards,
 Madhurima.

 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

That really does apply to you.

-- 
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Wilcoxon Mann-Whitney Rank Sum Test in R

2005-12-21 Thread Torsten Hothorn

On Wed, 21 Dec 2005, Peter Dalgaard wrote:

 P Ehlers [EMAIL PROTECTED] writes:

   so a good guess at its definition is that it is obtained from W or one
   of the others by subtracting the mean and dividing with the SD.
  
 
  With the SD adjusted for ties, of course. (See, e.g., Conover's book.)

 ...which is actually the exact SD, conditional on the set of tied
 ranks, not just a correction term. See my discussion with Torsten a
 month or so ago.


yes, exactly. Thanks, Peter!

The `T' values reported by functions in the `coin' package are
_standardized_ statistics. Standardization is done utilizing the
conditional expectation and conditional variance of the underlying linear
statistics as given by Strasser  Weber (1999). Note that _no_
`continuity correction' whatsoever is applied. The limit distribution is
normal (or chisq, when the test statistic is a quadratic form).

The vignette explains the theoretical framework `coin' maps into
software in more detail. It _definitively_ is worse the effort to
have a look at it. At first glance it might seem a little bit
abstract but after this you'll see how general and powerful the
tools are.

We are currently working on a manuscript showing more applications, so
watch out for the new `coin' version in a few days.

Best,

Torsten

 --
O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] how to put constraint in R?

2005-12-21 Thread Oana Mocila
Dear all,

I have a problem when I was working on Age-Period-Cohort study in R. I tried 
to put constraint to
two coefficients on age (so that to solve the identification problem due to 
linear dependency). But
I don't know how to do this in R(put constraint). If you could give me some 
suggestion, it will be very helpful!

Oana

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] glmmADMB: Generalized Linear Mixed Models using AD Model Builder

2005-12-21 Thread Spencer Graves
  I get upset when software dies and refuses to give me an answer.  I'd 
much rather have a routine give me a wrong answer -- with an error 
message -- than just an error message.  Maybe refuse to print standard 
errors when the hessian is singular, but at least give me a progress 
report with the singular hessian.  Without that, I have to program 
optim or something else separately to get the answers and the hessian 
in order to do my own diagnosis -- if I know enough to do that.

  Just my 0.02 Euros.
  spencer graves

Roel de Jong wrote:

 Of course it is generally possible to generate datasets for a perfectly 
 well-defined model that are hard to fit, but in this particular case I 
 feel it should be possible. In my observations, glmm.admb is far more 
 numerically stable fitting GLMM's than other software I've seen. Further 
 , I don't think the data I generated come from a model that is 
 overparameterized, severely contaminated with outliers, has no noise, or 
 is nonlinear. But I encourage anyone to run a simulation study with 
 generated data they think are acceptable and compare the robustness of 
 several methods. I leave it at this.
 
 Best regards,
   Roel de Jong
 
 Berton Gunter wrote:
 
May I interject a comment?



When data is generated from a specified model with reasonable 
parameter 
values, it should be possible to fit such a model successful, 
or is this 
me being stupid?


Let me take a turn at being stupid. Why should this be true? That is, why
should it be possible to easily fit a model that is generated ( i.e. using a
pseudo-random number generator) from a perfectly well-defined model? For
example, I can easily generate simple linear models contaminated with
outliers that are quite difficult to fit (e.g. via resistant fitting
methods). In nonlinear fitting, it is quite easy to generate data from
oevrparameterized models that are quite difficult to fit or whose fit is
very sensitive to initial conditions. Remember: the design (for the
covariates) at which you fit the data must support the parameterization.

The most dramatic examples are probably of simple nonlinear model systems
with no noise which produce chaotic results when parameters are in certain
ranges. These would be totally impossible to recover from the data.

So I repeat: just because you can generate data from a simple model, why
should it be easy to fit the data and recover the model? 

Cheers,

Bert Gunter
Genentech


 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] GLMMGibbs

2005-12-21 Thread Edmondson-Jones, Mark
Hello,

I am trying to use glmm() in library GLMMGibbs, but I don't seem to have
the package and it is not listed on CRAN.

Is it no longer supported?  (I am using R 2.1.1 on Windows.)

Many thanks in advance for your help.

Regards,
Mark



The information contained in this e-mail is confidential and...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Random effects with glm()

2005-12-21 Thread Henric Nilsson

On Ti, 2005-12-20, 13:09, Juan Pablo Sánchez skrev:

 [...]
 Thus my question is: Do exit same option in the glm() function to allow
 for random effects?, similar to the random option in lme()

No, you can't fit GLMMs with the `glm' function. Instead, take a look at
e.g. the `glmmML', `lmer' and `glmmPQL' functions in the glmmML, Matrix
and MASS packages respectively.

HTH,
Henric

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] GLMMGibbs

2005-12-21 Thread Prof Brian Ripley
On Wed, 21 Dec 2005, Edmondson-Jones, Mark wrote:

 I am trying to use glmm() in library GLMMGibbs, but I don't seem to have
 the package and it is not listed on CRAN.

It _is_ listed in the Devel section (as it has been since 2002).

 Is it no longer supported?  (I am using R 2.1.1 on Windows.)

There is a Windows port on my site, as there always has been.
R 2.1.1 is obselete, but I would have expected it by default to look 
there.  Set repos=http://www.stats.ox.ac.uk/pub/RWin; if this is not 
happening for you.

-- 
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Help to find only one class and differennt class

2005-12-21 Thread Muhammad Subianto
Thanks to Jim Holtman. This is very usefull to improve my script.
Best, Muhammad Subianto

On this day 20/12/2005 17:19, jim holtman wrote:

try this:

set.seed(1)
# generate some test data
x.1 - data.frame(seg=sample(1:6,20,T), class=sample(c('good',
'poor'),20,T))
x.1
(x.sp - split(x.1, x.1$seg))
# test each segment for occurance of class.
lapply(x.sp, function(.seg){
if (all(.seg$class == 'good')) return('good')
if (all(.seg$class == 'poor')) return('poor')
return(good  poor)
})



On 12/20/05, Muhammad Subianto [EMAIL PROTECTED] wrote:
  

Dear R users,
I have a problem, which I can not find a solution.
Probably someone could help me?
I have a result from my classification, like this



credit.toy
  

[[1]]
age married ownhouse income gender class
1  20-30  no   nolow   male  good
2  40-50  no  yes medium female  good

[[2]]
age married ownhouse income gender class
1  20-30 yes  yes   high   male  poor
2  20-30  no  yes   high   male  good
3  20-30 yes   nolow female  poor
4  60-70 yes  yeslow female  poor
5  60-70  no  yes   high   male  poor

[[3]]
age married ownhouse income gender class
1  30-40 yes   no   high   male  good
2  20-30  no  yes medium female  good

[[4]]
age married ownhouse income gender class
1 50-60 yes  yeslow female  poor
2 40-50 yes   no medium   male  poor
3 20-30  no   no   high female  poor

[[5]]
age married ownhouse income gender class
1 40-50  no  yeslow female  good
2 60-70  no  yes medium   male  poor
3 30-40 yes   no   high female  poor

[[6]]
age married ownhouse income gender class
1 30-40  no   no medium female  good
2 50-60 yes  yes   high female  good
3 30-40 yes   no   high female  good



credit.toy[[5]]$class
  

[1] good poor poor
Levels: good poor


How can I count there are only one class and differennt class.
I need the result something like
good class : 1,3,6
poor class : 4
good and poor class : 2,5

Thanks in advance.
Sincerely, Muhammad Subianto

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html






--
Jim Holtman
Cincinnati, OH
+1 513 247 0281

What the problem you are trying to solve?

  


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] transpose a matrix?

2005-12-21 Thread t c
  I have a data set in the following format: 
   
  x-data.frame(id=c(‘a’,’b’,’c’),’2005-01-15’=c(100,225,425), 
’2005-02-23’=c(1100,2325,4525))
   
   x
id X2005.01.15 X2005.02.23
  1  a 1001100
  2  b 2252325
  3  c 4254525
   
   
  I want:
  id
a
b
c
  X2005.01.15
100
225
425
  X2005.02.23
1100
2325
4525
   
   
  Any Suggestions?


__



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] probs in maps package

2005-12-21 Thread Giannitrapani, Marco GSUK-GSSC
Hi all,

I am having problems in loading the maps package.

Did anyone experienced anything similar?

Cheers,

Marco


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Why lmer() is not working, altough lme4 is installed?

2005-12-21 Thread Petar Milin
I have installed lme4 library, but when I try something with lmer()
function, I receive error message. On the other hand, I can use lme()
function from the same library. Are those two the very same function or
not? I am a bit confused.

I am using:
$platform: i386-pc-linux-gnu
$arch: i386
$os: linux-gnu
$system: i386, linux-gnu

$major: 2
$minor: 0.1
$year: 2004
$month: 11
$day: 15

Sincerely,
Petar Milin
Assistant Professor
Department of Psychology
University of Novi Sad
Serbia and Montenegro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] probs in maps package

2005-12-21 Thread Uwe Ligges
Giannitrapani, Marco GSUK-GSSC wrote:
 Hi all,
 
 I am having problems in loading the maps package.
 
 Did anyone experienced anything similar?


Please read the posting guide and tell us why you think you have those 
problems. At least tell us the error message, which versions of R and 
maps you are using, and your OS.

Uwe Ligges


 Cheers,
 
 Marco
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] transpose a matrix?

2005-12-21 Thread Uwe Ligges
t c wrote:

   I have a data set in the following format: 

   x-data.frame(id=c(‘a’,’b’,’c’),’2005-01-15’=c(100,225,425), 
 ’2005-02-23’=c(1100,2325,4525))

x
 id X2005.01.15 X2005.02.23
   1  a 1001100
   2  b 2252325
   3  c 4254525


   I want:
   id
 a
 b
 c
   X2005.01.15
 100
 225
 425
   X2005.02.23
 1100
 2325
 4525


   Any Suggestions?


I do not get your point, since subject line and body of your message are 
telling different stories. Do you want to have a list of vectors?

You certainly do not want to transpose a data frame with both factors 
(or character) and numeric values in it.

Uwe Ligges



 
 __
 
 
 
   [[alternative HTML version deleted]]
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Why lmer() is not working, altough lme4 is installed?

2005-12-21 Thread Uwe Ligges
Petar Milin wrote:

 I have installed lme4 library, but when I try something with lmer()
 function, I receive error message. On the other hand, I can use lme()
 function from the same library. Are those two the very same function or
 not? I am a bit confused.

1. lme4 is a *package*, not a library
2. a function lme() is not part of recent versions of lme4. You told us 
you are using an ancient version of R, but nothing about the version of 
lme4 (which is porbably outdated as well, since new versions won't work 
on such an ancient version of R, I believe).
3. Why do you conceal the error message of lmer()?
Please read the posting guide and send information that is helpful for 
the helpers to help.

Uwe Ligges



 I am using:
 $platform: i386-pc-linux-gnu
 $arch: i386
 $os: linux-gnu
 $system: i386, linux-gnu
 
 $major: 2
 $minor: 0.1
 $year: 2004
 $month: 11
 $day: 15
 
 Sincerely,
 Petar Milin
 Assistant Professor
 Department of Psychology
 University of Novi Sad
 Serbia and Montenegro
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Why lmer() is not working, altough lme4 is installed?

2005-12-21 Thread Henric Nilsson

On On, 2005-12-21, 12:51, Petar Milin skrev:

 I have installed lme4 library, but when I try something with lmer()
 function, I receive error message. On the other hand, I can use lme()
 function from the same library. Are those two the very same function or
 not? I am a bit confused.

At least in recent versions of the lme4 package there's no `lme' function,
and in fact there's no fitting functions for (G)LMMs whatsoever. These
have been transfered to the Matrix package during the development process
-- the function you're looking for is called `lmer'.

From below, your R installation is seriously outdated. Matrix need R =
2.2.0, so you must update (which is a good idea, anyway!).


HTH,
Henric


 I am using:
 $platform: i386-pc-linux-gnu
 $arch: i386
 $os: linux-gnu
 $system: i386, linux-gnu

 $major: 2
 $minor: 0.1
 $year: 2004
 $month: 11
 $day: 15

 Sincerely,
 Petar Milin
 Assistant Professor
 Department of Psychology
 University of Novi Sad
 Serbia and Montenegro

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html---

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] transpose a matrix?

2005-12-21 Thread David Ruau
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Not sure what you want from the explanation you gave but to transpose 
try that:
x - as.matrix(x)
x.trans - t(x)

One method that's may also of use is
help.search(transpose)

David
On Dec 20, 2005, at 17:26, t c wrote:

   I have a data set in the following format:

   x-data.frame(id=c(‘a’,’b’,’c’),’2005-01-15’=c(100,225,425), 
 ’2005-02-23’=c(1100,2325,4525))

 x
 id X2005.01.15 X2005.02.23
   1  a 1001100
   2  b 2252325
   3  c 4254525


   I want:
   id
 a
 b
 c
   X2005.01.15
 100
 225
 425
   X2005.02.23
 1100
 2325
 4525


   Any Suggestions?


 __



   [[alternative HTML version deleted]]


 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFDqUsI7EoGVUIQyhERArLdAKCX7FniqohYs646riJopkqs6/rboQCcDBUK
4n9JS+hzHOwLZLc6HKQWJcM=
=U6e6
-END PGP SIGNATURE-

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] transpose a matrix?

2005-12-21 Thread David Ruau
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Not sure what you want from the explanation you gave but to transpose 
try that:
x - as.matrix(x)
x.trans - t(x)

One method that's may also of use is
help.search(transpose)

David

On Dec 20, 2005, at 17:26, t c wrote:

   I have a data set in the following format:

   x-data.frame(id=c(‘a’,’b’,’c’),’2005-01-15’=c(100,225,425), 
 ’2005-02-23’=c(1100,2325,4525))

 x
 id X2005.01.15 X2005.02.23
   1  a 1001100
   2  b 2252325
   3  c 4254525


   I want:
   id
 a
 b
 c
   X2005.01.15
 100
 225
 425
   X2005.02.23
 1100
 2325
 4525


   Any Suggestions?


 __



   [[alternative HTML version deleted]]


 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFDqUtZ7EoGVUIQyhERAohmAJ9ASkIETkTvBP7nT8Tr739H7gwWjwCgiBji
LpWmylZvZ6al91b02rrAtGg=
=a98J
-END PGP SIGNATURE-

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Wilcoxon Mann-Whitney Rank Sum Test in R

2005-12-21 Thread P Ehlers
Peter,

You're right, of course, as usual. Sorry about that.

Peter E.


Peter Dalgaard wrote:
 P Ehlers [EMAIL PROTECTED] writes:
 
 
so a good guess at its definition is that it is obtained from W or one
of the others by subtracting the mean and dividing with the SD.


With the SD adjusted for ties, of course. (See, e.g., Conover's book.)
 
 
 ...which is actually the exact SD, conditional on the set of tied
 ranks, not just a correction term. See my discussion with Torsten a
 month or so ago.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problems installing R 2.1.1. from rpm

2005-12-21 Thread White, Charles E WRAIR-Wash DC
May be there is a difference between SuSE and OpenSuSE nowadays?!

I exclusively use OpenSuSE now and was under the impression those were
equivalent.

 

The main difference between SuSE and OpenSuSE is that SuSE contains some
non-GPL software not directly available for OpenSuSE. The most obvious
examples are that Adobe Reader, Flash, Java 1.5.x, and RealPlayer come
installable by yast on SuSE whereas you need to find them and manually
install them for OpenSuSE (yawn). A less obvious example is that a
non-GPL soft-modem driver is included in SuSE but not OpenSuSE. Note
that the kernel for SuSE is described as 'non-GPL'. 

 

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] inconsistent behaviour of ifelse and if ... else

2005-12-21 Thread Joerg van den Hoff
is the behaviour

val - ifelse(TRUE, numeric(0), 123)
val  #NA

intended or is it a bug, i.e. should an empty object be returned as 
might be expected(also in comparsion to what an explicit
val - {if(TRUE) numeric(0) else 123} yields)?

thanks,

joerg

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] inconsistent behaviour of ifelse and if ... else

2005-12-21 Thread Liaw, Andy
When in doubt, check the doc first.  In this case, ?ifelse says in no fewer
than three places why what you described is intended and not a bug.

Andy

From: Joerg van den Hoff
 
 is the behaviour
 
 val - ifelse(TRUE, numeric(0), 123)
 val  #NA
 
 intended or is it a bug, i.e. should an empty object be returned as 
 might be expected(also in comparsion to what an explicit
 val - {if(TRUE) numeric(0) else 123} yields)?
 
 thanks,
 
 joerg
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Random numbers

2005-12-21 Thread Carl
Hi All.
I have R code whose functionality is being replicated within a C+ 
program. The outputs are to be compared to validate the conversion 
somewhat - however (as is always the case) I have stuffed my code with 
random number calls.

Random uniform numbers in C+ are being produced using the (Boost) 
mersenne-twister generators (mt11213b  mt19937) - which is the default 
type of generator in R (if I read things correctly). If it was all 
within R I would just set the seed for reproducibility.

Basically - how do I specify in C+ for a set of random uniform numbers 
such that they are the same as from R? I have considered the possibility 
of storing/using the R generated random numbers in the C+ version for 
validation purposes - but there are a lot of them, and that strikes me 
as a generally ugly way of doing things.

thanks in advance
C

-- 
~
Carl Donovan
Lecturer in statistics
Ph +44 1334 461802
The Observatory
Buchanan Gardens
University of St Andrews
St Andrews
Fife
KY16 9LZ
Scotland

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Random numbers

2005-12-21 Thread Duncan Murdoch
On 12/21/2005 9:47 AM, Carl wrote:
 Hi All.
 I have R code whose functionality is being replicated within a C+ 
 program. The outputs are to be compared to validate the conversion 
 somewhat - however (as is always the case) I have stuffed my code with 
 random number calls.
 
 Random uniform numbers in C+ are being produced using the (Boost) 
 mersenne-twister generators (mt11213b  mt19937) - which is the default 
 type of generator in R (if I read things correctly). If it was all 
 within R I would just set the seed for reproducibility.
 
 Basically - how do I specify in C+ for a set of random uniform numbers 
 such that they are the same as from R? I have considered the possibility 
 of storing/using the R generated random numbers in the C+ version for 
 validation purposes - but there are a lot of them, and that strikes me 
 as a generally ugly way of doing things.

I'd say the only reasonable way to do this is to call the R generators 
rather than trying to duplicate them.  R tries hard to keep its 
generators consistent from version to version, but if you have an 
independent implementation of the same algorithm, it's going to be very 
hard to validate that you've really got things exactly identical.

The Writing R Extensions manual tells how to call the R generators from 
other programs.  You can do it without going through interpreted R code, 
so there shouldn't be much in the way of a performance penalty.

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Random numbers

2005-12-21 Thread Bob Wheeler
You can use Marsaglia's multiply with carry. I haven't looked at the C 
code in R recently, but doubt if it has changed. The C code is very 
neat, using 6 #defines:

static const double RANDCONST=2.32830643654e-10;

unsigned long zSeed=362436069, wSeed=521288629;
#define zNew  ((zSeed=36969*(zSeed65535)+(zSeed16))16)
#define wNew  ((wSeed=18000*(wSeed65535)+(wSeed16))65535)
#define IUNIFORM  (zNew+wNew)
#define UNIFORM   ((zNew+wNew)*RANDCONST)
#define setseed(A,B) zSeed=(A);wSeed=(B);
#define getseed(A,B) A=zSeed;B=wSeed;

See Marsaglia's DIEHARD page for more details: 
http://www.stat.fsu.edu/pub/diehard/

Carl wrote:
 Hi All.
 I have R code whose functionality is being replicated within a C+ 
 program. The outputs are to be compared to validate the conversion 
 somewhat - however (as is always the case) I have stuffed my code with 
 random number calls.
 
 Random uniform numbers in C+ are being produced using the (Boost) 
 mersenne-twister generators (mt11213b  mt19937) - which is the default 
 type of generator in R (if I read things correctly). If it was all 
 within R I would just set the seed for reproducibility.
 
 Basically - how do I specify in C+ for a set of random uniform numbers 
 such that they are the same as from R? I have considered the possibility 
 of storing/using the R generated random numbers in the C+ version for 
 validation purposes - but there are a lot of them, and that strikes me 
 as a generally ugly way of doing things.
 
 thanks in advance
 C
 

-- 
Bob Wheeler --- http://www.bobwheeler.com/
ECHIP, Inc. --- Randomness comes in bunches.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How do I edit the x-axis on a time series plot?

2005-12-21 Thread Austin, Matt
Phil,

Does the following do what you want?

plot(RecfS,
 ylab = 'Temperature (deg C)',
 xlab = 'Year',
 main = 'Average air temperature (deg C) at Recife, Brazil, in
successive months from 1953 to 1962',
 adj = 0.5,
 axes=FALSE)

axis(1, at=1952:1962, label=paste(Jan, 52:62), las=2)
axis(2)
box()

--Matt

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Philip Turk
Sent: Tuesday, December 20, 2005 8:37 PM
To: r-help@stat.math.ethz.ch
Subject: [R] How do I edit the x-axis on a time series plot?


I am merely trying to reproduce Figure 1.2 of Chris Chatfield's 6th 
edition of his The Analysis of Time Series: An Introduction (page 2). 
The S-PLUS code is on pages 305-306. I am almost there but I am having a 
heck of a time trying to modify and change the x-axis per the book. The 
book shows the x-axis with 10 tick marks, correctly positioned, and 
labeled Jan 53, ..., Jan 62. I have not provided the data for the 
sake of brevity although it is readily available at 
http://www.bath.ac.uk/~mascc/Recife.TS

Can anyone help?

recife - as.vector(t(recife))
RecfS - ts(recife, start = c(1953,1), frequency = 12) 
plot(RecfS, ylab = “Temperature (deg C)”, xlab = “Year”, main = “Average 
air temperature (deg C) at Recife, Brazil, in successive months from 
1953 to 1962”, adj = 0.5)

Thanks,

Philip Turk


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Newbie - Summarize function

2005-12-21 Thread Christoph Buser
Dear Andrew

Could you provide a reproducible example, please? Since we do
not have your data test.csv, we can not reproduce your code
and that complicates bug fixing a lot.
You can use set.seed to create artificial reproducible examples.

The only error in your code that I recognized:
   test.2 - with(test,summarize(test$x,llist(test$Stratum,test$plot),g))

You have a llist(...) instead of list(...)

If this is only copy-paste error, then you should provide a
reproducible example.
If it already solves the problem, you were lucky :-)

Regards,

Christoph 

--
Christoph Buser [EMAIL PROTECTED]
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)  8092 Zurich  SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--


[EMAIL PROTECTED] writes:
  Dear R Users,
  
  I have searched through the archives but I am still struggling to find a 
  way to process the below dataset. I have a dataset that has stratum and 
  plot identifier. Within each plot there is variable (Top) stating the 
  number of measurments that should be used to to calculate the mean to the 
  largest top elements within one of the vectors (X). I would like to 
  process this summary statistic by groups. At this stage I have been trying 
  to use the summarize function within the Hmisc library but I am getting 
  the following error Error in eval(expr, envir, enclos) : numeric 'envir' 
  arg not of length one In addition: Warning message: no finite arguments to 
  max; returning -Inf.
  
  Any suggetsions on how I can fix this would be greatly appreciated.
  
  Kind regards
  
  Andrew
  
  test - read.table(test.csv, header=TRUE, sep=,)
  #function to calculate mean of top elements within a plot
   g-function(y) {
  + top_no -max(y$top)
  + weight - with(y,as.numeric(x=x[order(x,decreasing=TRUE)[top_no]]))
  + wtd.mean(y$x,weight)
  + }
   g(test)
  [1] 172.6667
  #call to summarize function - use function g and summarise by stratum plot
   test.2 - with(test,summarize(test$x,llist(test$Stratum,test$plot),g))
  Error in eval(expr, envir, enclos) : numeric 'envir' arg not of length one
  In addition: Warning message:
  no finite arguments to max; returning -Inf 
  
  traceback() 
  9: eval(substitute(expr), data, enclos = parent.frame())
  8: with.default(y, as.numeric(x = x[order(x, decreasing = 
  TRUE)[top_no]]))
  7: with(y, as.numeric(x = x[order(x, decreasing = TRUE)[top_no]]))
  6: FUN(X, ...)
  5: summarize(test$x, llist(test$Stratum, test$plot), g)
  4: eval(expr, envir, enclos)
  3: eval(substitute(expr), data, enclos = parent.frame())
  2: with.default(test, summarize(test$x, llist(test$Stratum, test$plot), 
 g))
  1: with(test, summarize(test$x, llist(test$Stratum, test$plot), 
 g))
  
  The version im running on is 
  
  $platform
  [1] i386-pc-mingw32
  
  $arch
  [1] i386
  
  $os
  [1] mingw32
  
  $system
  [1] i386, mingw32
  
  $status
  [1] 
  
  $major
  [1] 2
  
  $minor
  [1] 2.0
  
  $year
  [1] 2005
  
  $month
  [1] 10
  
  $day
  [1] 06
  
  $svn rev
  [1] 35749
  
  $language
  [1] R
  
   
  
  
  Stratum plot idtop x
  1   1   1   2   12
  1   1   2   2   41
  1   1   3   2   12
  1   1   4   2   43
  1   1   5   2   12
  1   1   6   2   14
  1   1   7   2   43
  1   1   8   2   12
  1   2   1   4   42
  1   2   2   4   12
  1   2   3   4   432
  1   2   4   4   12
  1   2   5   4   12
  1   2   6   4   14
  1   2   7   4   41
  1   2   8   4   1
  2   1   1   2   12
  2   1   2   2   41
  2   1   3   2   12
  2   1   4   2   43
  2   1   5   2   12
  2   1   6   2   14
  2   1   7   2   43
  2   1   8   2   12
  2   2   1   3   42
  2   2   2   3   12
  2   2   3   3   432
  2   2   4   3   12
  2   2   5   3   12
  2   2   6   3   14
  2   2   7   3   41
  2   2   8   3   1
  
  
  
  
  
   [[alternative HTML version deleted]]
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Course *** R/Splus Advanced Programming *** Seattle, January 12th-13th, 2006

2005-12-21 Thread elvis

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Newbie - Summarize function

2005-12-21 Thread Gabor Grothendieck
Look at ?summarize .  The FUN argument is supposed to be a function
that inputs a vector but your g inputs a data frame.  I think you want
something like this (assuming package Hmisc):

   mApply(test, test[,1:2], g)

On 12/20/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Dear R Users,

 I have searched through the archives but I am still struggling to find a
 way to process the below dataset. I have a dataset that has stratum and
 plot identifier. Within each plot there is variable (Top) stating the
 number of measurments that should be used to to calculate the mean to the
 largest top elements within one of the vectors (X). I would like to
 process this summary statistic by groups. At this stage I have been trying
 to use the summarize function within the Hmisc library but I am getting
 the following error Error in eval(expr, envir, enclos) : numeric 'envir'
 arg not of length one In addition: Warning message: no finite arguments to
 max; returning -Inf.

 Any suggetsions on how I can fix this would be greatly appreciated.

 Kind regards

 Andrew

 test - read.table(test.csv, header=TRUE, sep=,)
 #function to calculate mean of top elements within a plot
  g-function(y) {
 + top_no -max(y$top)
 + weight - with(y,as.numeric(x=x[order(x,decreasing=TRUE)[top_no]]))
 + wtd.mean(y$x,weight)
 + }
  g(test)
 [1] 172.6667
 #call to summarize function - use function g and summarise by stratum plot
  test.2 - with(test,summarize(test$x,llist(test$Stratum,test$plot),g))
 Error in eval(expr, envir, enclos) : numeric 'envir' arg not of length one
 In addition: Warning message:
 no finite arguments to max; returning -Inf

 traceback()
 9: eval(substitute(expr), data, enclos = parent.frame())
 8: with.default(y, as.numeric(x = x[order(x, decreasing =
 TRUE)[top_no]]))
 7: with(y, as.numeric(x = x[order(x, decreasing = TRUE)[top_no]]))
 6: FUN(X, ...)
 5: summarize(test$x, llist(test$Stratum, test$plot), g)
 4: eval(expr, envir, enclos)
 3: eval(substitute(expr), data, enclos = parent.frame())
 2: with.default(test, summarize(test$x, llist(test$Stratum, test$plot),
   g))
 1: with(test, summarize(test$x, llist(test$Stratum, test$plot),
   g))

 The version im running on is

 $platform
 [1] i386-pc-mingw32

 $arch
 [1] i386

 $os
 [1] mingw32

 $system
 [1] i386, mingw32

 $status
 [1] 

 $major
 [1] 2

 $minor
 [1] 2.0

 $year
 [1] 2005

 $month
 [1] 10

 $day
 [1] 06

 $svn rev
 [1] 35749

 $language
 [1] R

 


 Stratum plot idtop x
 1   1   1   2   12
 1   1   2   2   41
 1   1   3   2   12
 1   1   4   2   43
 1   1   5   2   12
 1   1   6   2   14
 1   1   7   2   43
 1   1   8   2   12
 1   2   1   4   42
 1   2   2   4   12
 1   2   3   4   432
 1   2   4   4   12
 1   2   5   4   12
 1   2   6   4   14
 1   2   7   4   41
 1   2   8   4   1
 2   1   1   2   12
 2   1   2   2   41
 2   1   3   2   12
 2   1   4   2   43
 2   1   5   2   12
 2   1   6   2   14
 2   1   7   2   43
 2   1   8   2   12
 2   2   1   3   42
 2   2   2   3   12
 2   2   3   3   432
 2   2   4   3   12
 2   2   5   3   12
 2   2   6   3   14
 2   2   7   3   41
 2   2   8   3   1





[[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] bivariate kernel density estimates at point locations (rather than at grid locations)

2005-12-21 Thread Strickland, Matthew
Hello Dr. Adelchi Azzalini,

Thank you for your quick response to my question that I posted on the r-help 
board about bivariate kernel density estimates.  I have been using your sm 
package the past few days and have encountered a problem with estimating the 
density for only 1 point. I am using R 2.2.0, sm version 2.1-0 on a Windows 
machine.  Example code below:

#The code below creates 3 point locations

x.locs = c(74, 75, 77)
y.locs = c(64, 63, 61)
points = cbind(x.locs, y.locs)

#If I send this data into sm.density everything works fine.

dens = sm.density(points, h=c(1, 1))

#However, if I only wish to send 1 point location to sm.density, i.e.,

points.2 =points[1,]
dens.2 = sm.density(points.2, h=c(1, 1)) 

R returns to me the error:length(h) != 1

It appears to me that sm.density thinks that my 1 point is a 1-dimensional 
location rather than a 2-dimensional location, and I am getting an error when I 
request a bivariate kernel.  Do you have any suggestions?  

Best,
Matt


-Original Message-
From: Adelchi Azzalini [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 16, 2005 2:42 AM
To: Strickland, Matthew
Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED]
Subject: Re: [R] bivariate kernel density estimates at point locations (rather 
than at grid locations)

On Thu, 15 Dec 2005 14:21:17 -0500, Strickland, Matthew wrote:

SM Hi,
SM 
SM My data consists of a set of point locations (x,y). 
SM 
SM I would like to know if there is a procedure for bivariate kernel 
SM density estimation in R that returns the density estimates at the 
SM observed point locations rather than at grid locations. I have 
SM looked at a number of different routines and they all seem to return 
SM estimates at grid locations.
SM 

One option is to use (from package sm),
  sm.density(xy, eval.points=xy, eval.grid=FALSE) where xy in a (n\times 2) 
matrix.

Best wishes,
Adelchi Azzalini

--
Adelchi Azzalini  [EMAIL PROTECTED] Dipart.Scienze Statistiche, Università di 
Padova, Italia tel. +39 049 8274147,  http://azzalini.stat.unipd.it/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] System Reliability Metrics

2005-12-21 Thread Jon Stearley
I need to calculate some metrics such as Mean Time Between Failure  
(MTBF), etc (see http://www.cs.sandia.gov/~jrstear/ras for a more  
complete list).  I have observations like

  start endstate
  1 2005-11-11 09:05:00 2005-11-11 12:20:00   Scheduled Downtime
  2 2005-11-12 13:42:00 2005-11-12 14:45:00 Unscheduled Downtime

where each row describes the system state between start and end  
times.  Time between observations indicates a Production state.  The  
metrics of interest involve simple ratios of total time spent in  
various states, number of transitions, etc.  I'd like to plot period  
MTBF values (eg monthly vertical bars), as well as a cumulative MTBF  
(eg a line whose last value indicates MTBF for the entire time  
range), etc.

What is the best approach in R towards these results?

Irregular time series seem a natural fit for the observations, and  
the reporting periods for the metrics will have regular periods - so  
I've perused the stats, tseries, and its packages.  A markov class  
could be used (eg msm package), but that's probably overkill (like  
the reliability packages concord and irr)?  My goal is to calculate  
the metrics in the simplest and most natural way.  Can someone please  
advise me on a best approach?

Thank you!

-- 
+--+
| Jon Stearley  (505) 845-7571  (FAX 844-9297) |
| Sandia National Laboratories  Scalable Systems Integration   |
+--+

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Newbie - Summarize function

2005-12-21 Thread Gabor Grothendieck
Just one follow up to my previous reply.

To use summarize with this problem try this:

   summarize(rownames(test), test[,1:2], function(r) g(test[r,]))

This define a funtion which inputs a vector of row names and outputs
g acting on the data.frame consisting of those rows only.


On 12/21/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Look at ?summarize .  The FUN argument is supposed to be a function
 that inputs a vector but your g inputs a data frame.  I think you want
 something like this (assuming package Hmisc):

   mApply(test, test[,1:2], g)

 On 12/20/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Dear R Users,
 
  I have searched through the archives but I am still struggling to find a
  way to process the below dataset. I have a dataset that has stratum and
  plot identifier. Within each plot there is variable (Top) stating the
  number of measurments that should be used to to calculate the mean to the
  largest top elements within one of the vectors (X). I would like to
  process this summary statistic by groups. At this stage I have been trying
  to use the summarize function within the Hmisc library but I am getting
  the following error Error in eval(expr, envir, enclos) : numeric 'envir'
  arg not of length one In addition: Warning message: no finite arguments to
  max; returning -Inf.
 
  Any suggetsions on how I can fix this would be greatly appreciated.
 
  Kind regards
 
  Andrew
 
  test - read.table(test.csv, header=TRUE, sep=,)
  #function to calculate mean of top elements within a plot
   g-function(y) {
  + top_no -max(y$top)
  + weight - with(y,as.numeric(x=x[order(x,decreasing=TRUE)[top_no]]))
  + wtd.mean(y$x,weight)
  + }
   g(test)
  [1] 172.6667
  #call to summarize function - use function g and summarise by stratum plot
   test.2 - with(test,summarize(test$x,llist(test$Stratum,test$plot),g))
  Error in eval(expr, envir, enclos) : numeric 'envir' arg not of length one
  In addition: Warning message:
  no finite arguments to max; returning -Inf
 
  traceback()
  9: eval(substitute(expr), data, enclos = parent.frame())
  8: with.default(y, as.numeric(x = x[order(x, decreasing =
  TRUE)[top_no]]))
  7: with(y, as.numeric(x = x[order(x, decreasing = TRUE)[top_no]]))
  6: FUN(X, ...)
  5: summarize(test$x, llist(test$Stratum, test$plot), g)
  4: eval(expr, envir, enclos)
  3: eval(substitute(expr), data, enclos = parent.frame())
  2: with.default(test, summarize(test$x, llist(test$Stratum, test$plot),
g))
  1: with(test, summarize(test$x, llist(test$Stratum, test$plot),
g))
 
  The version im running on is
 
  $platform
  [1] i386-pc-mingw32
 
  $arch
  [1] i386
 
  $os
  [1] mingw32
 
  $system
  [1] i386, mingw32
 
  $status
  [1] 
 
  $major
  [1] 2
 
  $minor
  [1] 2.0
 
  $year
  [1] 2005
 
  $month
  [1] 10
 
  $day
  [1] 06
 
  $svn rev
  [1] 35749
 
  $language
  [1] R
 
  
 
 
  Stratum plot idtop x
  1   1   1   2   12
  1   1   2   2   41
  1   1   3   2   12
  1   1   4   2   43
  1   1   5   2   12
  1   1   6   2   14
  1   1   7   2   43
  1   1   8   2   12
  1   2   1   4   42
  1   2   2   4   12
  1   2   3   4   432
  1   2   4   4   12
  1   2   5   4   12
  1   2   6   4   14
  1   2   7   4   41
  1   2   8   4   1
  2   1   1   2   12
  2   1   2   2   41
  2   1   3   2   12
  2   1   4   2   43
  2   1   5   2   12
  2   1   6   2   14
  2   1   7   2   43
  2   1   8   2   12
  2   2   1   3   42
  2   2   2   3   12
  2   2   3   3   432
  2   2   4   3   12
  2   2   5   3   12
  2   2   6   3   14
  2   2   7   3   41
  2   2   8   3   1
 
 
 
 
 
 [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] linking C and R

2005-12-21 Thread Elizabeth Lawson
hey,
   
  I am running R 2.0.1 on a the terminal of my MAC OS X and I have written some 
C code that I would like to use dynload to bring into R.  When I try to compile 
the code i get the error R.defines.h no such file or directory.  I know that 
the file is in resources/include but where do I have to move the file to so 
that the compiler can access it?  I tried copying Rdefines.h and R_ext folders 
into the folder where the code is and using #include Rdefines.h instead of 
#include Rdefines.h.  I now get a different error R_ext/Memory.h: no such 
file or directory even though r_ext is in the folder.
   
  Any suggestions?
   
  Thanks,
   
  Elizabeth Lawson

__



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] linking C and R

2005-12-21 Thread Liaw, Andy
I don't know much about Macs, but are you using 

R CMD SHLIB whatever.c

to compile the code?  If you simply invoke the compiler by hand, I'd expect
you run into problems like that.

Andy

From: Elizabeth Lawson
 
 hey,

   I am running R 2.0.1 on a the terminal of my MAC OS X and I 
 have written some C code that I would like to use dynload to 
 bring into R.  When I try to compile the code i get the error 
 R.defines.h no such file or directory.  I know that the file 
 is in resources/include but where do I have to move the file 
 to so that the compiler can access it?  I tried copying 
 Rdefines.h and R_ext folders into the folder where the code 
 is and using #include Rdefines.h instead of #include 
 Rdefines.h.  I now get a different error R_ext/Memory.h: no 
 such file or directory even though r_ext is in the folder.

   Any suggestions?

   Thanks,

   Elizabeth Lawson
 
 __
 
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Help with Krige.conv using linear models

2005-12-21 Thread Jennifer Lenz
A majority of my data makes a kriged map perfectly using an exponential 
model for the semivariogram to fit my data and then going through the 
commands variofit() to define the model and then krige.conv() to use the 
model to predict values in a grid.  But…one set of my data appears to be 
linearly correlated for the first 5000 meters and not correlated beyond 
that. I have been having problems using krige.conv() to get a decent 
kriged map using the linear model.  The code I am using from my data is 
as follows:

 modeltest=variofit(variotest, weights=’cressie’, cov.model=’linear’, 
ini.cov.pars=c(80,1))

The output parameters are tausq = 9.855, sigmasq = 0.0087, phi=1.0

 krig=krige.conv(data, krige=krige.control(type.krig=’ok’, 
obj.model=modeltest), locations=pred.grid)

At this point, krig$predict values have little to no variability (1.897 
+/- 0.004), where I would expect values between 0 – 15.

By running the same data, except using an exponential model such as:

 modeltest=variofit(variotest, weights=’cressie’, cov.model=’exponential’)

This model appears to fit the data (only the first 5 km) about the same 
as the linear model except now the output parameters are tausq=10.02, 
sigmasq=318909, and phi = 3714567.  And calling krige.conv() again, the 
predicted values are in the range that I would expect, and the kriged 
map looks fine.

I’m not sure if this has something to do with how the kriging is using 
the model beyond the 5 km.  It seems like I need to be able to set the 
function to only apply the linear weighting to the linearly correlated 
portion (data less than 5km away), and the rest to 0, but I’m not sure 
how to do that (or maybe I’m completely going down the wrong track).

I’m using Windows XP pro OS with R 2.1.1.  Please help the neophyte 
statistician.  To figure this out is the only Christmas gift that I 
need.  Thanks.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] boot problem

2005-12-21 Thread Roger D. Peng
Your 'resample' function is not written according to the help page.  Try

resample - function(x, index) { x[index, ] }

-roger

david v wrote:
 Hello,
 This is the code that is giving me problems
 
 
library(boot)
data-read.table(test,header=FALSE,sep=\t,row.names=1)
data
 
   V2 V3 V4
 A  5  8  9
 B 12 54 89
 C   65 89 23
 D   32 69 44
 E   21 84 97
 F   33 59 71
 G   16 45 93
 H2 46 55
 I   22 33 88
 
 
resample - function(x,index) {
 
 sample(data,replace=TRUE)
 }
 dist-boot(data,resample,R=1000)
 Erreur : nombre d'indices incorrect sur la matrice (french)
 Error: number of indices wrong in the matrix (moreless)
 
 Can anybody help???
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Huber location estimate

2005-12-21 Thread Murray Jorgensen
We have a choice when calculating the Huber location estimate:
  set.seed(221205)
  y - 7 + 3*rt(30,1)
  library(MASS)
  huber(y)$mu
[1] 5.9117
  coefficients(rlm(y~1))
(Intercept)
  5.9204

I was surprised to get two different results. The function huber() works 
  directly with the definition whereas rlm() uses iteratively reweighted 
least squares.

My surprise is because I vaguely remember

@ARTICLE{hw77,
   author  = {Holland, P. W. and Welsch, R. E.},
   title   = {Robust Regression using Iteratively Reweighted Least-Squares},
   journal = {Communications in Statistics: Theory and Methods},
   volume  = {A6(9)},
   number  = {},
   pages   = {813-827},
   year= {1977}
}
as saying that the two methods were equivalent. Obviously they aren't 
quite. Comments welcome.

Murray Jorgensen
-- 
Dr Murray Jorgensen  http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: [EMAIL PROTECTED]Fax 7 838 4155
Phone  +64 7 838 4773 wkHome +64 7 825 0441Mobile 021 1395 862

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Logistic regression to select genes and estimate cutoff point?

2005-12-21 Thread Lingsheng Dong
Hi, all, 
I am new to R or even to statistics. Not sure if the question has a answer. But 
I couldn't find a straight forward answer in the help mailing list. 
I need use MicroArray data to select several diagnostic genes between Normal 
samples and Tumor samples and use these genes to predict unknow samples.
Since the sample size is so small and data doesn't follow normal distribution, 
I am thinking to use logistic regression instead of Student T test to select 
genes. To make the problem simpler, I assume each gene is independent to each 
other without interactions.
My questions is how I should build up the model: one model for each gene or a 
multiple variable model to include all genes? Which is the test to compare the 
discrimination power of each gene? I am thinking it is Wald statistic for the 
multiple variable model and Maximum likelihood for the single gene models? Am I 
 correct?
To estimate the cutoff point, I guess the answer is the gene expression when 
p=0.5 in the model. Am I on the right direction?
Any suggestion is appreciated!
Thanks a lot.
Lingsheng 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html