Re: [R] solving simultaneous Equations in R

2013-12-12 Thread Berend Hasselman

On 11-12-2013, at 23:56, eliza botto eliza_bo...@hotmail.com wrote:

 Dear Berend,
 
 Thankyou very much indeed for you reply. By taking help from your previous 
 reply @ http://r.789695.n4.nabble.com/Simultaneous-equations-td2524645.html i 
 was able to generate the following loop for the calculation of x=x[1] and 
 y=x[2]. 
 
 
 fun - function(x) {
 
 f - numeric(length(x))   
   # read as:
 
 
 f[1] - 
 1-0.514-(gamma(1/x[1])*gamma(2/x[1]-1/x[2]))/(gamma(2/x[1])*gamma(1/x[1]-1/x[2]))
 
 f[2] - 0.57-
 
 (gamma(1/x[1]-1/x[2])/gamma(1/x[1])-3*gamma(2/x[1]-1/x[2])/gamma(2/x[1])+2*gamma(3/x[1]-1/x[2])/gamma(3/x[1]))/(gamma(1/x[1]-1/x[2])/gamma(1
 
 /x[1])-gamma(2/x[1]-1/x[2])/gamma(2/x[1]))
 
 f
 
 }
 
 
 startx - c(0.1,0.15) # start the answer search here
 
 answers-as.data.frame(nleqslv(startx,fun))
 
 answers
 
 What i cant understand is the concept involved for setting startx. my x[1] 
 should always be smaller than x[2] and they both should be less than 1. how 
 can i demonstrate it to startx command line?
 

I don’t quite understand what you you mean.
Your starting values obey the restrictions you specify (if that is what you 
meant).
The solution vector has all elements  1. But it is a solution.

Do you mean that you want a solution satisfying the constraints you mention?
I cannot tell if that is possible.

Generally speaking a square system of equations is solved or not.

Sometimes you can vary the starting values to get a different solution that 
obeys the specified constraints.
If these constraints  are necessary you are not solving a system of equations 
but trying to find a  parameter set that satisfies certain criteria. Together 
with a criterion (sum of squares of function values for example) you could use 
an optimizing algorithm (optim, nlmin, constrOptim to name a few).

Berend


 thanks for your help. I m grateful.
 
   Eliza
 
 
 
 
  Subject: Re: [R] solving simultaneous Equations in R
  From: b...@xs4all.nl
  Date: Wed, 11 Dec 2013 12:43:02 +0100
  CC: r-help@r-project.org
  To: eliza_bo...@hotmail.com
  
  
  On 11-12-2013, at 12:16, eliza botto eliza_bo...@hotmail.com wrote:
  
   Dear users of R,
   I'm trying to solve the following 2 equations simultaneously in R for x 
   and y. I couldn't get through due to my limited knowledge of R.
   
   3=1-[(x-1)!(2x-y-1)!/(2x-1)!(x-y-1)!] 
   
   6={[(x-y-1)!/(x-1)!]-[3(2x-y-1)!/(2x-1)!]+[2(3x-y-1)!/(3x-1)!]}/{[(x-y-1)!/(x-1)!]-[(2x-y-1)!/(2x-1)!]}
   
   obviously, ! is factorial.
   kindly help me out on it or at least suggest something.
   I'll be extremely grateful.
  
  There are several packages that solve a system of equations.
  ktsolve, nleqslv, BB, which you can find in CRAN Task views: Numerical 
  Mathematics” and “Optimization”.
  
  You will have to write your equations in standard R notation.
  I can’t tell if your system is solvable.
  
  Berend
  
   Eliza
   
   
   
   [[alternative HTML version deleted]]
   
   __
   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.
 

__
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] refline in forest() {metafor}

2013-12-12 Thread Viechtbauer Wolfgang (STAT)
Regarding your question: Do you want *another* line or do you just want to move 
the reference line to the value of the summary estimate? The latter can be done 
by passing the value of the summary estimate to the 'refline' argument. If you 
want another line, you could just use the abline function, or, for finer 
control, the segments function. Something like:

segments(coef(res), 0, coef(res), res$k, lty=dashed)

where 'res' is the name of the fitted model object. You may have to play around 
with the 0 and res$k values, so that the line has the 'correct' length.

Thanks for the positive feedback about the package.

Best,
Wolfgang

--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Psychology
School for Mental Health and Neuroscience
Faculty of Health, Medicine, and Life Sciences
Maastricht University, P.O. Box 616 (VIJV1)
6200 MD Maastricht, The Netherlands
+31 (43) 388-4170 | http://www.wvbauer.com

From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of 
johnwilli...@fas.harvard.edu [johnwilli...@fas.harvard.edu]
Sent: Thursday, December 12, 2013 6:49 AM
To: r-help@r-project.org
Subject: [R] refline in forest() {metafor}

Hello all,

I am using forest.rma to plot a random effects model meta-analysis. I noticed
that refline sets a vertical line indicating the null hypothesis.

Is there a way to draw another vertical line, possibly dashed, centered on the
summary estimate?

Prof. Viechtbauer, if you happen to read this, I'd like to thank you for making
an excellent package. I have been using the metafor package to do my first
meta-analysis, having never used R before. The documentation is thorough and
intuitive.

Thanks,

John

John Williams
ALB Candidate
Harvard University Extension School
johnwilli...@fas.harvard.edu

__
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.
__
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] refline in forest() {metafor}

2013-12-12 Thread johnwilliams
I would like another line, and the solution below will work great. Thank you.

- John

Quoting Viechtbauer Wolfgang (STAT)
wolfgang.viechtba...@maastrichtuniversity.nl:

 Regarding your question: Do you want *another* line or do you just want to
 move the reference line to the value of the summary estimate? The latter can
 be done by passing the value of the summary estimate to the 'refline'
 argument. If you want another line, you could just use the abline function,
 or, for finer control, the segments function. Something like:

 segments(coef(res), 0, coef(res), res$k, lty=dashed)

 where 'res' is the name of the fitted model object. You may have to play
 around with the 0 and res$k values, so that the line has the 'correct'
 length.

 Thanks for the positive feedback about the package.

 Best,
 Wolfgang

 --
 Wolfgang Viechtbauer, Ph.D., Statistician
 Department of Psychiatry and Psychology
 School for Mental Health and Neuroscience
 Faculty of Health, Medicine, and Life Sciences
 Maastricht University, P.O. Box 616 (VIJV1)
 6200 MD Maastricht, The Netherlands
 +31 (43) 388-4170 | http://www.wvbauer.com
 
 From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf
 Of johnwilli...@fas.harvard.edu [johnwilli...@fas.harvard.edu]
 Sent: Thursday, December 12, 2013 6:49 AM
 To: r-help@r-project.org
 Subject: [R] refline in forest() {metafor}

 Hello all,

 I am using forest.rma to plot a random effects model meta-analysis. I noticed
 that refline sets a vertical line indicating the null hypothesis.

 Is there a way to draw another vertical line, possibly dashed, centered on
 the
 summary estimate?

 Prof. Viechtbauer, if you happen to read this, I'd like to thank you for
 making
 an excellent package. I have been using the metafor package to do my first
 meta-analysis, having never used R before. The documentation is thorough and
 intuitive.

 Thanks,

 John

 John Williams
 ALB Candidate
 Harvard University Extension School
 johnwilli...@fas.harvard.edu

 __
 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.

__
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.


[R] Logistic Regression with 200K features in R?

2013-12-12 Thread Romeo Kienzler

Dear List,

I'm quite new to R and want to do logistic regression with a 200K 
feature data set (around 150 training examples).


I'm aware that I should use Naive Bayes but I have a more general 
question about the capability of R handling very high dimensional data.


Please consider the following R code where mygenestrain.tab is a 150 
by 20 matrix:


traindata - read.table('mygenestrain.tab');
mylogit - glm(V1 ~ ., data = traindata, family = binomial);

When executing this code I get the following error:

Error in terms.formula(formula, data = data) :
  allocMatrix: too many elements specified
Calls: glm ... model.frame - model.frame.default - terms - terms.formula
Execution halted

Is this because R can't handle 200K features or am I doing something 
completely wrong here?


Thanks a lot for your help!

best Regards,

Romeo

__
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] Logistic Regression with 200K features in R?

2013-12-12 Thread Eik Vettorazzi
it is simply because you can't do a regression with more predictors than
observations.

Cheers.

Am 12.12.2013 09:00, schrieb Romeo Kienzler:
 Dear List,
 
 I'm quite new to R and want to do logistic regression with a 200K
 feature data set (around 150 training examples).
 
 I'm aware that I should use Naive Bayes but I have a more general
 question about the capability of R handling very high dimensional data.
 
 Please consider the following R code where mygenestrain.tab is a 150
 by 20 matrix:
 
 traindata - read.table('mygenestrain.tab');
 mylogit - glm(V1 ~ ., data = traindata, family = binomial);
 
 When executing this code I get the following error:
 
 Error in terms.formula(formula, data = data) :
   allocMatrix: too many elements specified
 Calls: glm ... model.frame - model.frame.default - terms - terms.formula
 Execution halted
 
 Is this because R can't handle 200K features or am I doing something
 completely wrong here?
 
 Thanks a lot for your help!
 
 best Regards,
 
 Romeo
 
 __
 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.

-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790
--

Besuchen Sie uns auf: www.uke.de
_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg
Vorstandsmitglieder: Prof. Dr. Christian Gerloff (Vertreter des Vorsitzenden), 
Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
_

SAVE PAPER - THINK BEFORE PRINTING

__
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] solving simultaneous Equations in R

2013-12-12 Thread eliza botto
Dear Berend,Got it! Thankyou very much indeed for your kind support and 
elaborating the issue.I'm Extremely grateful!!! Eliza 

 Subject: Re: [R] solving simultaneous Equations in R
 From: b...@xs4all.nl
 Date: Thu, 12 Dec 2013 09:01:02 +0100
 CC: r-help@r-project.org
 To: eliza_bo...@hotmail.com
 
 
 On 11-12-2013, at 23:56, eliza botto eliza_bo...@hotmail.com wrote:
 
  Dear Berend,
  
  Thankyou very much indeed for you reply. By taking help from your previous 
  reply @ http://r.789695.n4.nabble.com/Simultaneous-equations-td2524645.html 
  i was able to generate the following loop for the calculation of x=x[1] and 
  y=x[2]. 
  
  
  fun - function(x) {
  
  f - numeric(length(x)) 
  # read as:
  
  
  f[1] - 
  1-0.514-(gamma(1/x[1])*gamma(2/x[1]-1/x[2]))/(gamma(2/x[1])*gamma(1/x[1]-1/x[2]))
  
  f[2] - 0.57-
  
  (gamma(1/x[1]-1/x[2])/gamma(1/x[1])-3*gamma(2/x[1]-1/x[2])/gamma(2/x[1])+2*gamma(3/x[1]-1/x[2])/gamma(3/x[1]))/(gamma(1/x[1]-1/x[2])/gamma(1
  
  /x[1])-gamma(2/x[1]-1/x[2])/gamma(2/x[1]))
  
  f
  
  }
  
  
  startx - c(0.1,0.15) # start the answer search here
  
  answers-as.data.frame(nleqslv(startx,fun))
  
  answers
  
  What i cant understand is the concept involved for setting startx. my 
  x[1] should always be smaller than x[2] and they both should be less than 
  1. how can i demonstrate it to startx command line?
  
 
 I don’t quite understand what you you mean.
 Your starting values obey the restrictions you specify (if that is what you 
 meant).
 The solution vector has all elements  1. But it is a solution.
 
 Do you mean that you want a solution satisfying the constraints you mention?
 I cannot tell if that is possible.
 
 Generally speaking a square system of equations is solved or not.
 
 Sometimes you can vary the starting values to get a different solution that 
 obeys the specified constraints.
 If these constraints  are necessary you are not solving a system of equations 
 but trying to find a  parameter set that satisfies certain criteria. Together 
 with a criterion (sum of squares of function values for example) you could 
 use an optimizing algorithm (optim, nlmin, constrOptim to name a few).
 
 Berend
 
 
  thanks for your help. I m grateful.
  
Eliza
  
  
  
  
   Subject: Re: [R] solving simultaneous Equations in R
   From: b...@xs4all.nl
   Date: Wed, 11 Dec 2013 12:43:02 +0100
   CC: r-help@r-project.org
   To: eliza_bo...@hotmail.com
   
   
   On 11-12-2013, at 12:16, eliza botto eliza_bo...@hotmail.com wrote:
   
Dear users of R,
I'm trying to solve the following 2 equations simultaneously in R for 
x and y. I couldn't get through due to my limited knowledge of R.

3=1-[(x-1)!(2x-y-1)!/(2x-1)!(x-y-1)!] 

6={[(x-y-1)!/(x-1)!]-[3(2x-y-1)!/(2x-1)!]+[2(3x-y-1)!/(3x-1)!]}/{[(x-y-1)!/(x-1)!]-[(2x-y-1)!/(2x-1)!]}

obviously, ! is factorial.
kindly help me out on it or at least suggest something.
I'll be extremely grateful.
   
   There are several packages that solve a system of equations.
   ktsolve, nleqslv, BB, which you can find in CRAN Task views: Numerical 
   Mathematics” and “Optimization”.
   
   You will have to write your equations in standard R notation.
   I can’t tell if your system is solvable.
   
   Berend
   
Eliza



[[alternative HTML version deleted]]

__
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.
  
 
  
[[alternative HTML version deleted]]

__
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] Logistic Regression with 200K features in R?

2013-12-12 Thread Eik Vettorazzi
I thought so (with all the limitations due to collinearity and so on),
but actually there is a limit for the maximum size of an array which is
independent of your memory size and is due to the way arrays are
indexed. You can't create an object with more than 2^31-1 = 2147483647
elements.

https://stat.ethz.ch/pipermail/r-help/2007-June/133238.html

cheers

Am 12.12.2013 12:34, schrieb Romeo Kienzler:
 ok, so 200K predictors an 10M observations would work?
 
 
 On 12/12/2013 12:12 PM, Eik Vettorazzi wrote:
 it is simply because you can't do a regression with more predictors than
 observations.

 Cheers.

 Am 12.12.2013 09:00, schrieb Romeo Kienzler:
 Dear List,

 I'm quite new to R and want to do logistic regression with a 200K
 feature data set (around 150 training examples).

 I'm aware that I should use Naive Bayes but I have a more general
 question about the capability of R handling very high dimensional data.

 Please consider the following R code where mygenestrain.tab is a 150
 by 20 matrix:

 traindata - read.table('mygenestrain.tab');
 mylogit - glm(V1 ~ ., data = traindata, family = binomial);

 When executing this code I get the following error:

 Error in terms.formula(formula, data = data) :
allocMatrix: too many elements specified
 Calls: glm ... model.frame - model.frame.default - terms -
 terms.formula
 Execution halted

 Is this because R can't handle 200K features or am I doing something
 completely wrong here?

 Thanks a lot for your help!

 best Regards,

 Romeo

 __
 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.
 

-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790
--

Besuchen Sie uns auf: www.uke.de
_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg
Vorstandsmitglieder: Prof. Dr. Christian Gerloff (Vertreter des Vorsitzenden), 
Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
_

SAVE PAPER - THINK BEFORE PRINTING

__
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] Logistic Regression with 200K features in R?

2013-12-12 Thread Duncan Murdoch

On 13-12-12 6:51 AM, Eik Vettorazzi wrote:

I thought so (with all the limitations due to collinearity and so on),
but actually there is a limit for the maximum size of an array which is
independent of your memory size and is due to the way arrays are
indexed. You can't create an object with more than 2^31-1 = 2147483647
elements.

https://stat.ethz.ch/pipermail/r-help/2007-June/133238.html


That post is from 2007.  The limits were raised considerably when R 
3.0.0 was released, and it is now 2^48 for disk-based operations, 2^52 
for working in memory.


Duncan Murdoch




cheers

Am 12.12.2013 12:34, schrieb Romeo Kienzler:

ok, so 200K predictors an 10M observations would work?


On 12/12/2013 12:12 PM, Eik Vettorazzi wrote:

it is simply because you can't do a regression with more predictors than
observations.

Cheers.

Am 12.12.2013 09:00, schrieb Romeo Kienzler:

Dear List,

I'm quite new to R and want to do logistic regression with a 200K
feature data set (around 150 training examples).

I'm aware that I should use Naive Bayes but I have a more general
question about the capability of R handling very high dimensional data.

Please consider the following R code where mygenestrain.tab is a 150
by 20 matrix:

traindata - read.table('mygenestrain.tab');
mylogit - glm(V1 ~ ., data = traindata, family = binomial);

When executing this code I get the following error:

Error in terms.formula(formula, data = data) :
allocMatrix: too many elements specified
Calls: glm ... model.frame - model.frame.default - terms -
terms.formula
Execution halted

Is this because R can't handle 200K features or am I doing something
completely wrong here?

Thanks a lot for your help!

best Regards,

Romeo

__
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.






__
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] Logistic Regression with 200K features in R?

2013-12-12 Thread Eik Vettorazzi
thanks Duncan for this clarification.
A double precision matrix with 2e11 elements (as the op wanted) would
need about 1.5 TB memory, that's more than a standard (windows 64bit)
computer can handle.

Cheers.

Am 12.12.2013 13:00, schrieb Duncan Murdoch:
 On 13-12-12 6:51 AM, Eik Vettorazzi wrote:
 I thought so (with all the limitations due to collinearity and so on),
 but actually there is a limit for the maximum size of an array which is
 independent of your memory size and is due to the way arrays are
 indexed. You can't create an object with more than 2^31-1 = 2147483647
 elements.

 https://stat.ethz.ch/pipermail/r-help/2007-June/133238.html
 
 That post is from 2007.  The limits were raised considerably when R
 3.0.0 was released, and it is now 2^48 for disk-based operations, 2^52
 for working in memory.
 
 Duncan Murdoch
 
 

 cheers

 Am 12.12.2013 12:34, schrieb Romeo Kienzler:
 ok, so 200K predictors an 10M observations would work?


 On 12/12/2013 12:12 PM, Eik Vettorazzi wrote:
 it is simply because you can't do a regression with more predictors
 than
 observations.

 Cheers.

 Am 12.12.2013 09:00, schrieb Romeo Kienzler:
 Dear List,

 I'm quite new to R and want to do logistic regression with a 200K
 feature data set (around 150 training examples).

 I'm aware that I should use Naive Bayes but I have a more general
 question about the capability of R handling very high dimensional
 data.

 Please consider the following R code where mygenestrain.tab is a 150
 by 20 matrix:

 traindata - read.table('mygenestrain.tab');
 mylogit - glm(V1 ~ ., data = traindata, family = binomial);

 When executing this code I get the following error:

 Error in terms.formula(formula, data = data) :
 allocMatrix: too many elements specified
 Calls: glm ... model.frame - model.frame.default - terms -
 terms.formula
 Execution halted

 Is this because R can't handle 200K features or am I doing something
 completely wrong here?

 Thanks a lot for your help!

 best Regards,

 Romeo

 __
 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.


 

-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790
--

Besuchen Sie uns auf: www.uke.de
_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg
Vorstandsmitglieder: Prof. Dr. Christian Gerloff (Vertreter des Vorsitzenden), 
Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
_

SAVE PAPER - THINK BEFORE PRINTING

__
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.


[R] Solving a normal distribution pnorm for q

2013-12-12 Thread Johannes Radinger
Hi,



I found follwowing example of pnorm here:

http://www.r-tutor.com/elementary-statistics/probability-distributions/normal-distribution



Problem

Assume that the test scores of a college entrance exam fits a normal
distribution. Furthermore, the mean test score is 72, and the standard
deviation is 15.2. What is the percentage of students scoring 84 or more in
the exam?



Solution

 pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)

[1] 0.21492



That is straight forward, however what if I want to know the score the best
30% students are reaching at least. So I know the solution of pnorm but
want to know its q. How can that be achieved in R?



Any suggestions?



/Johannes

[[alternative HTML version deleted]]

__
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] Solving a normal distribution pnorm for q

2013-12-12 Thread Berend Hasselman

On 12-12-2013, at 14:56, Johannes Radinger johannesradin...@gmail.com wrote:

 Hi,
 
 
 
 I found follwowing example of pnorm here:
 
 http://www.r-tutor.com/elementary-statistics/probability-distributions/normal-distribution
 
 
 
 Problem
 
 Assume that the test scores of a college entrance exam fits a normal
 distribution. Furthermore, the mean test score is 72, and the standard
 deviation is 15.2. What is the percentage of students scoring 84 or more in
 the exam?
 
 
 
 Solution
 
 pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)
 
 [1] 0.21492
 
 
 
 That is straight forward, however what if I want to know the score the best
 30% students are reaching at least. So I know the solution of pnorm but
 want to know its q. How can that be achieved in R?
 
 
 
 Any suggestions?


Do

?pnorm

in R. You are directed to a help page where you will also see “qnorm”.
Then try qnorm.

Berend

__
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] Solving a normal distribution pnorm for q

2013-12-12 Thread Dániel Kehl
Looks like homework.

Try ?qnorm

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: Johannes Radinger [johannesradin...@gmail.com]
Küldve: 2013. december 12. 14:56
To: R help
Tárgy: [R] Solving a normal distribution pnorm for q

Hi,



I found follwowing example of pnorm here:

http://www.r-tutor.com/elementary-statistics/probability-distributions/normal-distribution



Problem

Assume that the test scores of a college entrance exam fits a normal
distribution. Furthermore, the mean test score is 72, and the standard
deviation is 15.2. What is the percentage of students scoring 84 or more in
the exam?



Solution

 pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)

[1] 0.21492



That is straight forward, however what if I want to know the score the best
30% students are reaching at least. So I know the solution of pnorm but
want to know its q. How can that be achieved in R?



Any suggestions?



/Johannes

[[alternative HTML version deleted]]

__
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.

__
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] Solving a normal distribution pnorm for q

2013-12-12 Thread Jeff Newmiller
?pnorm ... carefully...
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Johannes Radinger johannesradin...@gmail.com wrote:
Hi,



I found follwowing example of pnorm here:

http://www.r-tutor.com/elementary-statistics/probability-distributions/normal-distribution



Problem

Assume that the test scores of a college entrance exam fits a normal
distribution. Furthermore, the mean test score is 72, and the standard
deviation is 15.2. What is the percentage of students scoring 84 or
more in
the exam?



Solution

 pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)

[1] 0.21492



That is straight forward, however what if I want to know the score the
best
30% students are reaching at least. So I know the solution of pnorm but
want to know its q. How can that be achieved in R?



Any suggestions?



/Johannes

   [[alternative HTML version deleted]]

__
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.

__
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.


[R] labels on right y-axis

2013-12-12 Thread Fisher Dennis
OS X
R 3.0.2

Colleagues,

I am displaying two sets of values changing over time; as a result, I have two 
y-axes.  I add a label for the right-side Y axis with mtext(side=3, line=1.2, 
TEXT).  The text is parallel to the axis -- so far, so good.  However, the text 
is rotated counterclockwise from horizontal, whereas I would like it rotated 
clockwise.

Neither srt nor las fixes this.  I guess that one convoluted approach would be 
to use text rather than mtext.  However, positioning would be a nuisance 
and the xpd option would be needed.  Is there any simpler approach?

Dennis 


Dennis Fisher MD
P  (The P Less Than Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com




[[alternative HTML version deleted]]

__
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] Solving a normal distribution pnorm for q

2013-12-12 Thread Johannes Radinger
Thanks for the fast response. Of course I totally overlooked qnorm as I had
a more complex task in my head.

I wanted to reverse following equation:
r=0.67
q=-150
sd1=100
sd2=1000

X - pnorm(q=q,sd=sd1)*r+pnorm(q=q,sd=sd2)*(1-r)

Maybe its mathematically really easy, but somehow I don't get it how to do
reverse and provide X and
get q especially with the presence of r respectively as weighting factors
for the two distributions.

/J


On Thu, Dec 12, 2013 at 3:09 PM, Dániel Kehl ke...@ktk.pte.hu wrote:

 Looks like homework.

 Try ?qnorm
 
 Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ;
 meghatalmaz#243;: Johannes Radinger [johannesradin...@gmail.com]
 Küldve: 2013. december 12. 14:56
 To: R help
 Tárgy: [R] Solving a normal distribution pnorm for q

 Hi,



 I found follwowing example of pnorm here:


 http://www.r-tutor.com/elementary-statistics/probability-distributions/normal-distribution



 Problem

 Assume that the test scores of a college entrance exam fits a normal
 distribution. Furthermore, the mean test score is 72, and the standard
 deviation is 15.2. What is the percentage of students scoring 84 or more in
 the exam?



 Solution

  pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)

 [1] 0.21492



 That is straight forward, however what if I want to know the score the best
 30% students are reaching at least. So I know the solution of pnorm but
 want to know its q. How can that be achieved in R?



 Any suggestions?



 /Johannes

 [[alternative HTML version deleted]]

 __
 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.


[[alternative HTML version deleted]]

__
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] radial.plot shaded region

2013-12-12 Thread Hodge, Steven
From: Jim Lemon [j...@bitwrit.com.au]
Sent: Tuesday, December 10, 2013 21:57
To: Hodge, Steven
Cc: r-help@r-project.org
Subject: Re: [R] radial.plot shaded region

On 12/11/2013 11:24 AM, Jim Lemon wrote:
 ...
 There may be a solution using the radial.pie function, and if I find it,
 I'll post it.

 Hi Steve,
 Here it is. Just call radial.pie twice to get the annulus, then call
 radial.grid with the appropriate arguments, and then you can add
 whatever radial.plot you want, using the add argument.
 
 radial.pie(3.5,sector.colors=lightblue)
 radial.pie(3,sector.colors=white,add=TRUE)
 radial.grid(radial.lim=c(0,3.5),grid.pos=seq(0,3.5,length.out=8))
 
 Jim

Thank you very much! Both of your solutions work for me.

Steve
__
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] Solving a normal distribution pnorm for q

2013-12-12 Thread Eik Vettorazzi
Assuming r, sd1 and sd2 as known(fixed) components, this works:

X - pnorm(q=q,sd=sd1)*r+pnorm(q=q,sd=sd2)*(1-r)
uniroot(function(x)pnorm(q=x,sd=sd1)*r+pnorm(q=x,sd=sd2)*(1-r)-X,c(-1e6,1e6))


Cheers

Am 12.12.2013 15:58, schrieb Johannes Radinger:
 Thanks for the fast response. Of course I totally overlooked qnorm as I had
 a more complex task in my head.
 
 I wanted to reverse following equation:
 r=0.67
 q=-150
 sd1=100
 sd2=1000
 
 X - pnorm(q=q,sd=sd1)*r+pnorm(q=q,sd=sd2)*(1-r)
 
 Maybe its mathematically really easy, but somehow I don't get it how to do
 reverse and provide X and
 get q especially with the presence of r respectively as weighting factors
 for the two distributions.
 
 /J
 
 
 On Thu, Dec 12, 2013 at 3:09 PM, Dániel Kehl ke...@ktk.pte.hu wrote:
 
 Looks like homework.

 Try ?qnorm
 
 Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ;
 meghatalmaz#243;: Johannes Radinger [johannesradin...@gmail.com]
 Küldve: 2013. december 12. 14:56
 To: R help
 Tárgy: [R] Solving a normal distribution pnorm for q

 Hi,



 I found follwowing example of pnorm here:


 http://www.r-tutor.com/elementary-statistics/probability-distributions/normal-distribution



 Problem

 Assume that the test scores of a college entrance exam fits a normal
 distribution. Furthermore, the mean test score is 72, and the standard
 deviation is 15.2. What is the percentage of students scoring 84 or more in
 the exam?



 Solution

 pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)

 [1] 0.21492



 That is straight forward, however what if I want to know the score the best
 30% students are reaching at least. So I know the solution of pnorm but
 want to know its q. How can that be achieved in R?



 Any suggestions?



 /Johannes

 [[alternative HTML version deleted]]

 __
 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.

 
   [[alternative HTML version deleted]]
 
 
 
 __
 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.
 

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790
--

Besuchen Sie uns auf: www.uke.de
_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg
Vorstandsmitglieder: Prof. Dr. Christian Gerloff (Vertreter des Vorsitzenden), 
Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
_

SAVE PAPER - THINK BEFORE PRINTING

__
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.


[R] censored counts and glmer/glmmADMB

2013-12-12 Thread Eric Elguero

dear R-users,

I have to model counts where all counts above some threshold
have been censored. In the same dataset I have too many zeroes for
a Poisson or even a negative binomial distribution to make
sense, so I would need a zero-inflated-censored negative binomial
family for use in glmer (or glmmADMB?). That seems not to exist.

my question is :
how could I add a custom-built family of distributions that
I could call in glmer/glmmADMM ?

if it's not possible, I am considering imputing fake values
to replace the censored ones, but I am unsure whether this
is bad or very bad...

Eric Elguero
MIVEGEC (UM1- UM2 -CNRS 5290-IRD 224)
Maladies infectieuses et vecteurs :
écologie, génétique, évolution et contrôle
Centre IRD de Montpellier
911 Av Agropolis - BP 64501
34394 Montpellier Cedex

__
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] Solving a normal distribution pnorm for q

2013-12-12 Thread Johannes Radinger
Thanks Eik...
..the uniroot() was the function I was looking for.

Best regards,
/J


On Thu, Dec 12, 2013 at 4:27 PM, Eik Vettorazzi e.vettora...@uke.de wrote:

 Assuming r, sd1 and sd2 as known(fixed) components, this works:

 X - pnorm(q=q,sd=sd1)*r+pnorm(q=q,sd=sd2)*(1-r)

 uniroot(function(x)pnorm(q=x,sd=sd1)*r+pnorm(q=x,sd=sd2)*(1-r)-X,c(-1e6,1e6))


 Cheers

 Am 12.12.2013 15:58, schrieb Johannes Radinger:
  Thanks for the fast response. Of course I totally overlooked qnorm as I
 had
  a more complex task in my head.
 
  I wanted to reverse following equation:
  r=0.67
  q=-150
  sd1=100
  sd2=1000
 
  X - pnorm(q=q,sd=sd1)*r+pnorm(q=q,sd=sd2)*(1-r)
 
  Maybe its mathematically really easy, but somehow I don't get it how to
 do
  reverse and provide X and
  get q especially with the presence of r respectively as weighting factors
  for the two distributions.
 
  /J
 
 
  On Thu, Dec 12, 2013 at 3:09 PM, Dániel Kehl ke...@ktk.pte.hu wrote:
 
  Looks like homework.
 
  Try ?qnorm
  
  Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ;
  meghatalmaz#243;: Johannes Radinger [johannesradin...@gmail.com]
  Küldve: 2013. december 12. 14:56
  To: R help
  Tárgy: [R] Solving a normal distribution pnorm for q
 
  Hi,
 
 
 
  I found follwowing example of pnorm here:
 
 
 
 http://www.r-tutor.com/elementary-statistics/probability-distributions/normal-distribution
 
 
 
  Problem
 
  Assume that the test scores of a college entrance exam fits a normal
  distribution. Furthermore, the mean test score is 72, and the standard
  deviation is 15.2. What is the percentage of students scoring 84 or
 more in
  the exam?
 
 
 
  Solution
 
  pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)
 
  [1] 0.21492
 
 
 
  That is straight forward, however what if I want to know the score the
 best
  30% students are reaching at least. So I know the solution of pnorm but
  want to know its q. How can that be achieved in R?
 
 
 
  Any suggestions?
 
 
 
  /Johannes
 
  [[alternative HTML version deleted]]
 
  __
  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.
 
 
[[alternative HTML version deleted]]
 
 
 
  __
  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.
 

 --
 Eik Vettorazzi
 Institut für Medizinische Biometrie und Epidemiologie
 Universitätsklinikum Hamburg-Eppendorf

 Martinistr. 52
 20246 Hamburg

 T ++49/40/7410-58243
 F ++49/40/7410-57790
 --

 Besuchen Sie uns auf: www.uke.de
 _

 Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
 Rechts; Gerichtsstand: Hamburg
 Vorstandsmitglieder: Prof. Dr. Christian Gerloff (Vertreter des
 Vorsitzenden), Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
 _

 SAVE PAPER - THINK BEFORE PRINTING



[[alternative HTML version deleted]]

__
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] censored counts and glmer/glmmADMB

2013-12-12 Thread Bert Gunter
This post should go the r-sig-mixed-models list, where you are much
more likely to get useful help than here, which is a general R
programming help list.

Cheers,
Bert

On Thu, Dec 12, 2013 at 7:41 AM, Eric Elguero eric.elgu...@ird.fr wrote:
 dear R-users,

 I have to model counts where all counts above some threshold
 have been censored. In the same dataset I have too many zeroes for
 a Poisson or even a negative binomial distribution to make
 sense, so I would need a zero-inflated-censored negative binomial
 family for use in glmer (or glmmADMB?). That seems not to exist.

 my question is :
 how could I add a custom-built family of distributions that
 I could call in glmer/glmmADMM ?

 if it's not possible, I am considering imputing fake values
 to replace the censored ones, but I am unsure whether this
 is bad or very bad...

 Eric Elguero
 MIVEGEC (UM1- UM2 -CNRS 5290-IRD 224)
 Maladies infectieuses et vecteurs :
 écologie, génétique, évolution et contrôle
 Centre IRD de Montpellier
 911 Av Agropolis - BP 64501
 34394 Montpellier Cedex

 __
 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

(650) 467-7374

__
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] labels on right y-axis

2013-12-12 Thread David Carlson
I don't see an alternative to text(), but the positioning is not
that difficult:

oldpar - par(mar=c(5.1, 4.1, 4.1, 4.1))
plot(0)
axis(4)
text(par(usr)[2], mean(par(usr)[3:4]), TEXT, 
 srt=-90, adj=c(.5,-4), xpd=TRUE)
par(oldpar)

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Fisher Dennis
Sent: Thursday, December 12, 2013 8:32 AM
To: r-h...@stat.math.ethz.ch
Subject: [R] labels on right y-axis

OS X
R 3.0.2

Colleagues,

I am displaying two sets of values changing over time; as a
result, I have two y-axes.  I add a label for the right-side Y
axis with mtext(side=3, line=1.2, TEXT).  The text is parallel
to the axis -- so far, so good.  However, the text is rotated
counterclockwise from horizontal, whereas I would like it
rotated clockwise.

Neither srt nor las fixes this.  I guess that one convoluted
approach would be to use text rather than mtext.  However,
positioning would be a nuisance and the xpd option would be
needed.  Is there any simpler approach?

Dennis 


Dennis Fisher MD
P  (The P Less Than Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com




[[alternative HTML version deleted]]

__
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.

__
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] Logistic Regression with 200K features in R?

2013-12-12 Thread Duncan Murdoch

On 12/12/2013 7:08 AM, Eik Vettorazzi wrote:

thanks Duncan for this clarification.
A double precision matrix with 2e11 elements (as the op wanted) would
need about 1.5 TB memory, that's more than a standard (windows 64bit)
computer can handle.


According to Microsoft's Memory Limits web page (currently at 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx#memory_limits, 
but these things tend to move around), the limit is 8 TB for virtual 
memory.(The same page lists a variety of smaller physical memory 
limits, depending on the Windows version, but R doesn't need physical 
memory, virtual is good enough. )


R would be very slow if it was working with objects bigger than physical 
memory, but it could conceivably work.


Duncan Murdoch


Cheers.

Am 12.12.2013 13:00, schrieb Duncan Murdoch:
 On 13-12-12 6:51 AM, Eik Vettorazzi wrote:
 I thought so (with all the limitations due to collinearity and so on),
 but actually there is a limit for the maximum size of an array which is
 independent of your memory size and is due to the way arrays are
 indexed. You can't create an object with more than 2^31-1 = 2147483647
 elements.

 https://stat.ethz.ch/pipermail/r-help/2007-June/133238.html

 That post is from 2007.  The limits were raised considerably when R
 3.0.0 was released, and it is now 2^48 for disk-based operations, 2^52
 for working in memory.

 Duncan Murdoch



 cheers

 Am 12.12.2013 12:34, schrieb Romeo Kienzler:
 ok, so 200K predictors an 10M observations would work?


 On 12/12/2013 12:12 PM, Eik Vettorazzi wrote:
 it is simply because you can't do a regression with more predictors
 than
 observations.

 Cheers.

 Am 12.12.2013 09:00, schrieb Romeo Kienzler:
 Dear List,

 I'm quite new to R and want to do logistic regression with a 200K
 feature data set (around 150 training examples).

 I'm aware that I should use Naive Bayes but I have a more general
 question about the capability of R handling very high dimensional
 data.

 Please consider the following R code where mygenestrain.tab is a 150
 by 20 matrix:

 traindata - read.table('mygenestrain.tab');
 mylogit - glm(V1 ~ ., data = traindata, family = binomial);

 When executing this code I get the following error:

 Error in terms.formula(formula, data = data) :
 allocMatrix: too many elements specified
 Calls: glm ... model.frame - model.frame.default - terms -
 terms.formula
 Execution halted

 Is this because R can't handle 200K features or am I doing something
 completely wrong here?

 Thanks a lot for your help!

 best Regards,

 Romeo

 __
 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.






__
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.


[R] function inside a function

2013-12-12 Thread eliza botto
Dear users of R,
I am trying to inculcate a function inside a function. For that to be done, i 
copied following function from internet. 

library(nleqslv) fun - function(x) { 
 f - numeric(length(x)) 
 f[1] -  A[,1]+x[2] - 1/x[1] 
 f[2] -  A[,2]+x[2] - sin(x[1]) 
 f 
} 
x.start - c(1,1) 
nleqslv(x.start,fun) 
I have a matrix A with dimension 124 rows and 2 columns. In f[1] line, in 
place of A[,1] i want to inculcate each value (each row) of 
column 1 of matrix A. while doing it, In f[2] line, in place of A[,2] i want to 
inculcate each value (each row) of column 2 of matrix A.  
For suppose A has following rows
0.6772941  0.5962983
0.4348938  0.4563702
0.4481236  0.4418828
0.4213013  0.3944993
0.4682232  0.4485623
0.4798529  0.4477387
0.7029005  0.5533228
While using 0.66772941 in f[1], use 0.5962983 in f[2]. 
How can i do this in R.
Thanks in advance,
Eliza 
[[alternative HTML version deleted]]

__
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] labels on right y-axis

2013-12-12 Thread Bert Gunter
Might axis() be useful here?

?axis

Cheers,
Bert

On Thu, Dec 12, 2013 at 8:02 AM, David Carlson dcarl...@tamu.edu wrote:
 I don't see an alternative to text(), but the positioning is not
 that difficult:

 oldpar - par(mar=c(5.1, 4.1, 4.1, 4.1))
 plot(0)
 axis(4)
 text(par(usr)[2], mean(par(usr)[3:4]), TEXT,
  srt=-90, adj=c(.5,-4), xpd=TRUE)
 par(oldpar)

 -
 David L Carlson
 Department of Anthropology
 Texas AM University
 College Station, TX 77840-4352

 -Original Message-
 From: r-help-boun...@r-project.org
 [mailto:r-help-boun...@r-project.org] On Behalf Of Fisher Dennis
 Sent: Thursday, December 12, 2013 8:32 AM
 To: r-h...@stat.math.ethz.ch
 Subject: [R] labels on right y-axis

 OS X
 R 3.0.2

 Colleagues,

 I am displaying two sets of values changing over time; as a
 result, I have two y-axes.  I add a label for the right-side Y
 axis with mtext(side=3, line=1.2, TEXT).  The text is parallel
 to the axis -- so far, so good.  However, the text is rotated
 counterclockwise from horizontal, whereas I would like it
 rotated clockwise.

 Neither srt nor las fixes this.  I guess that one convoluted
 approach would be to use text rather than mtext.  However,
 positioning would be a nuisance and the xpd option would be
 needed.  Is there any simpler approach?

 Dennis


 Dennis Fisher MD
 P  (The P Less Than Company)
 Phone: 1-866-PLessThan (1-866-753-7784)
 Fax: 1-866-PLessThan (1-866-753-7784)
 www.PLessThan.com




 [[alternative HTML version deleted]]

 __
 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.

 __
 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

(650) 467-7374

__
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.


[R] Heatmap, and heatmap.2 gave different figures for the same dataset

2013-12-12 Thread capricy gao
I have a huge dataset(15k X 18) and tried to use the heatmap in R to examine 
the patterns. However, I found that heatmap and heatmap.2 gave me completely 
different outputs.

Here are the codes:



 dim(as.matrix(data.dcpm))
[1] 15462    18
 
 heatmap(as.matrix(data.dcpm), col=topo.colors(100))
 heatmap.2(as.matrix(data.dcpm), col=topo.colors(100), key=TRUE, 
 density.inf=none,trace=none, scale=none)
---

The outputs are attached here.

Could anyone help me figure out why?

Thanks a lot:)
__
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] Logistic Regression with 200K features in R?

2013-12-12 Thread Romeo Kienzler

ok, so 200K predictors an 10M observations would work?


On 12/12/2013 12:12 PM, Eik Vettorazzi wrote:

it is simply because you can't do a regression with more predictors than
observations.

Cheers.

Am 12.12.2013 09:00, schrieb Romeo Kienzler:

Dear List,

I'm quite new to R and want to do logistic regression with a 200K
feature data set (around 150 training examples).

I'm aware that I should use Naive Bayes but I have a more general
question about the capability of R handling very high dimensional data.

Please consider the following R code where mygenestrain.tab is a 150
by 20 matrix:

traindata - read.table('mygenestrain.tab');
mylogit - glm(V1 ~ ., data = traindata, family = binomial);

When executing this code I get the following error:

Error in terms.formula(formula, data = data) :
   allocMatrix: too many elements specified
Calls: glm ... model.frame - model.frame.default - terms - terms.formula
Execution halted

Is this because R can't handle 200K features or am I doing something
completely wrong here?

Thanks a lot for your help!

best Regards,

Romeo

__
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.


__
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.


[R] boxcox transformations

2013-12-12 Thread Yogendra
Hi,
I am new to R.
I need help with regards to box cox transformation.
I have phenotypic data for e.g. plant height.
data is non-normal. Skewness is 0.34.

Could you please help me?

Regards,
Yogi




--
View this message in context: 
http://r.789695.n4.nabble.com/boxcox-transformations-tp4682077.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
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] Logistic Regression with 200K features in R?

2013-12-12 Thread Romeo Kienzler

Dear Eik,

thank you so much for your help!

best Regards,

Romeo

On 12/12/2013 12:51 PM, Eik Vettorazzi wrote:

I thought so (with all the limitations due to collinearity and so on),
but actually there is a limit for the maximum size of an array which is
independent of your memory size and is due to the way arrays are
indexed. You can't create an object with more than 2^31-1 = 2147483647
elements.

https://stat.ethz.ch/pipermail/r-help/2007-June/133238.html

cheers

Am 12.12.2013 12:34, schrieb Romeo Kienzler:

ok, so 200K predictors an 10M observations would work?


On 12/12/2013 12:12 PM, Eik Vettorazzi wrote:

it is simply because you can't do a regression with more predictors than
observations.

Cheers.

Am 12.12.2013 09:00, schrieb Romeo Kienzler:

Dear List,

I'm quite new to R and want to do logistic regression with a 200K
feature data set (around 150 training examples).

I'm aware that I should use Naive Bayes but I have a more general
question about the capability of R handling very high dimensional data.

Please consider the following R code where mygenestrain.tab is a 150
by 20 matrix:

traindata - read.table('mygenestrain.tab');
mylogit - glm(V1 ~ ., data = traindata, family = binomial);

When executing this code I get the following error:

Error in terms.formula(formula, data = data) :
allocMatrix: too many elements specified
Calls: glm ... model.frame - model.frame.default - terms -
terms.formula
Execution halted

Is this because R can't handle 200K features or am I doing something
completely wrong here?

Thanks a lot for your help!

best Regards,

Romeo

__
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.


__
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] Wilcoxon test output as a table

2013-12-12 Thread dc347
Hello there

Was looking up a similar problem yesterday and came across the gMWT package
(Generalized Mann-Whitney Type Tests). It addresses your problem, although I
am still trying to figure out how it works.

Kind regards,

David



--
View this message in context: 
http://r.789695.n4.nabble.com/Wilcoxon-test-output-as-a-table-tp2244565p4682058.html
Sent from the R help mailing list archive at Nabble.com.

__
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] function inside a function

2013-12-12 Thread Berend Hasselman

On 12-12-2013, at 17:10, eliza botto eliza_bo...@hotmail.com wrote:

 Dear users of R,
 I am trying to inculcate a function inside a function. For that to be done, i 
 copied following function from internet. 
 
 library(nleqslv) fun - function(x) { 
 f - numeric(length(x)) 
 f[1] -  A[,1]+x[2] - 1/x[1] 
 f[2] -  A[,2]+x[2] - sin(x[1]) 
 f 
 } 
 x.start - c(1,1) 
 nleqslv(x.start,fun) 
 I have a matrix A with dimension 124 rows and 2 columns. In f[1] line, in 
 place of A[,1] i want to inculcate each value (each row) of 
 column 1 of matrix A. while doing it, In f[2] line, in place of A[,2] i want 
 to inculcate each value (each row) of column 2 of matrix A.  
 For suppose A has following rows
 0.6772941  0.5962983
 0.4348938  0.4563702
 0.4481236  0.4418828
 0.4213013  0.3944993
 0.4682232  0.4485623
 0.4798529  0.4477387
 0.7029005  0.5533228
 While using 0.66772941 in f[1], use 0.5962983 in f[2]. 
 How can i do this in R.
 Thanks in advance,


It is not clear what you actually want. 
Maybe something like this

library(nleqslv)

A - matrix(c(0.6772941,  0.5962983,
  0.4348938,  0.4563702,
  0.4481236,  0.4418828,
  0.4213013,  0.3944993,
  0.4682232,  0.4485623,
  0.4798529,  0.4477387,
  0.7029005,  0.5533228), byrow=TRUE,ncol=2)

fun - function(x, krow) {
f - numeric(length(x))
f[1] - A[krow,1] + x[2]- 1/x[1]
f[2] - A[krow,2] +x[2] - sin(x[1])
f
}

x.start - c(1,1)
nleqslv(x.start, fun, krow=1)
nleqslv(x.start, fun, krow=2)


 Eliza   
   [[alternative HTML version deleted]]
 

Please do not post in HTML. You should know by now.

Berend

 __
 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.

__
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] function inside a function

2013-12-12 Thread eliza botto
Dear Berend,Thankyou very much for your reply. I actually wanted to inserts 
each row value of A in f[1] anf f[2], with column 1 value in f[1] and column 2 
values in f[2]. Once that been done, i should have in the end, 124 vaues of 
x[1] for column 1 and 124 for column 2.I hope i am clear this time.Thanks for 
your help.Eliza

 Subject: Re: [R] function inside a function
 From: b...@xs4all.nl
 Date: Thu, 12 Dec 2013 19:35:58 +0100
 CC: r-help@r-project.org
 To: eliza_bo...@hotmail.com
 
 
 On 12-12-2013, at 17:10, eliza botto eliza_bo...@hotmail.com wrote:
 
  Dear users of R,
  I am trying to inculcate a function inside a function. For that to be done, 
  i copied following function from internet. 
  
  library(nleqslv) fun - function(x) { 
  f - numeric(length(x)) 
  f[1] -  A[,1]+x[2] - 1/x[1] 
  f[2] -  A[,2]+x[2] - sin(x[1]) 
  f 
  } 
  x.start - c(1,1) 
  nleqslv(x.start,fun) 
  I have a matrix A with dimension 124 rows and 2 columns. In f[1] line, in 
  place of A[,1] i want to inculcate each value (each row) of 
  column 1 of matrix A. while doing it, In f[2] line, in place of A[,2] i 
  want to inculcate each value (each row) of column 2 of matrix A.  
  For suppose A has following rows
  0.6772941  0.5962983
  0.4348938  0.4563702
  0.4481236  0.4418828
  0.4213013  0.3944993
  0.4682232  0.4485623
  0.4798529  0.4477387
  0.7029005  0.5533228
  While using 0.66772941 in f[1], use 0.5962983 in f[2]. 
  How can i do this in R.
  Thanks in advance,
 
 
 It is not clear what you actually want. 
 Maybe something like this
 
 library(nleqslv)
 
 A - matrix(c(0.6772941,  0.5962983,
   0.4348938,  0.4563702,
   0.4481236,  0.4418828,
   0.4213013,  0.3944993,
   0.4682232,  0.4485623,
   0.4798529,  0.4477387,
   0.7029005,  0.5533228), byrow=TRUE,ncol=2)
 
 fun - function(x, krow) {
 f - numeric(length(x))
 f[1] - A[krow,1] + x[2]- 1/x[1]
 f[2] - A[krow,2] +x[2] - sin(x[1])
 f
 }
 
 x.start - c(1,1)
 nleqslv(x.start, fun, krow=1)
 nleqslv(x.start, fun, krow=2)
 
 
  Eliza 
  [[alternative HTML version deleted]]
  
 
 Please do not post in HTML. You should know by now.
 
 Berend
 
  __
  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.
 
  
[[alternative HTML version deleted]]

__
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] boxcox transformations

2013-12-12 Thread Dániel Kehl
Dear Yogi,

try the powerTransform function in the car package and boxcox function in the 
MASS package.
there are nice examples for both functions.

HTH,
daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: Yogendra [ykhedi...@gmail.com]
Küldve: 2013. december 12. 19:00
To: r-help@r-project.org
Tárgy: [R] boxcox transformations

Hi,
I am new to R.
I need help with regards to box cox transformation.
I have phenotypic data for e.g. plant height.
data is non-normal. Skewness is 0.34.

Could you please help me?

Regards,
Yogi




--
View this message in context: 
http://r.789695.n4.nabble.com/boxcox-transformations-tp4682077.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
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.

__
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] Heatmap, and heatmap.2 gave different figures for the same dataset

2013-12-12 Thread Kevin Wright
Read the help page for both and pay particular attention to the scale
argument.

Kevin Wright



On Thu, Dec 12, 2013 at 9:45 AM, capricy gao capri...@yahoo.com wrote:

 I have a huge dataset(15k X 18) and tried to use the heatmap in R to
 examine the patterns. However, I found that heatmap and heatmap.2 gave me
 completely different outputs.

 Here are the codes:

 

  dim(as.matrix(data.dcpm))
 [1] 1546218
 
  heatmap(as.matrix(data.dcpm), col=topo.colors(100))
  heatmap.2(as.matrix(data.dcpm), col=topo.colors(100), key=TRUE,
 density.inf=none,trace=none, scale=none)
 ---

 The outputs are attached here.

 Could anyone help me figure out why?

 Thanks a lot:)

 __
 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.




-- 
Kevin Wright

[[alternative HTML version deleted]]

__
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] labels on right y-axis

2013-12-12 Thread Jim Lemon

On 12/13/2013 01:32 AM, Fisher Dennis wrote:

OS X
R 3.0.2

Colleagues,

I am displaying two sets of values changing over time; as a result, I have two 
y-axes.  I add a label for the right-side Y axis with mtext(side=3, line=1.2, 
TEXT).  The text is parallel to the axis -- so far, so good.  However, the text 
is rotated counterclockwise from horizontal, whereas I would like it rotated 
clockwise.

Neither srt nor las fixes this.  I guess that one convoluted approach would be to use 
text rather than mtext.  However, positioning would be a nuisance and the 
xpd option would be needed.  Is there any simpler approach?

Dennis


Hi Dennis,
This sounds like a job for twoord.plot (plotrix). I think I can leave 
the warnings, disclaimers and miscellaneous dissuasion to others.


Jim

__
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] function inside a function

2013-12-12 Thread eliza botto
Dear Arun,
Thankyou very much for your reply. You always come up to save the day.
So kind of you...!!!
Eliza
 Date: Thu, 12 Dec 2013 12:36:18 -0800
 From: smartpink...@yahoo.com
 Subject: Re: [R] function inside a function
 To: eliza_bo...@hotmail.com
 
 
 
 Hi Eliza,
 
 Actually, I used the modified function by Berend.
 fun - function(x, krow) {
 f - numeric(length(x))
 f[1] - A[krow,1] + x[2]- 1/x[1]
 f[2] - A[krow,2] +x[2] - sin(x[1])
 f
  }
 
  x.start - c(1,1)
 t(sapply(seq_len(nrow(A)),function(i) nleqslv(x.start,fun,krow=i)$x))
  [,1]  [,2]
 [1,] 1.052828 0.2725286
 [2,] 1.131672 0.4487542
 [3,] 1.109174 0.4534483
 [4,] 1.093078 0.4935468
 [5,] 1.098613 0.4420152
 [6,] 1.088997 0.4384237
 [7,] 1.005843 0.2912907
 
 A.K.
 
 On Thursday, December 12, 2013 3:16 PM, eliza botto eliza_bo...@hotmail.com 
 wrote:
 
 Dear Arun,
 Thankyou very much for your reply.
 
 I m getting the following error.
 May be i m not running the full code.
 
 i used it in the following way.
 
 library(nleqslv) 
 
 fun - function(x) { 
  f - numeric(length(x)) 
  f[1] -  A[,1]+x[2] - 1/x[1] 
  f[2] -  A[,2]+x[2] -
 sin(x[1]) 
  f 
 } 
 x.start - c(1,1) 
 t(sapply(seq_len(nrow(A)),function(i) nleqslv(x.start,fun,krow=i)$x))
 Kindly see, if you could help.
 Eliza
 
  Date: Thu, 12 Dec 2013 11:01:47 -0800
  From: smartpink...@yahoo.com
  Subject: Re: [R] function inside a function
  To: r-help@r-project.org
  CC: b...@xs4all.nl; eliza_bo...@hotmail.com
  
  Hi,
  May be this helps:
  t(sapply(seq_len(nrow(A)),function(i) nleqslv(x.start,fun,krow=i)$x))
  
  
  A.K.
  
  
  On Thursday, December 12, 2013 1:54 PM, eliza botto 
  eliza_bo...@hotmail.com wrote:
  Dear Berend,Thankyou very much for your reply. I actually wanted to inserts 
  each row value of A in f[1] anf f[2], with column 1 value in f[1] and 
  column 2 values in f[2]. Once that been done, i should have in the end, 124 
  vaues of x[1] for column 1 and 124 for column 2.I hope i am clear this 
  time.Thanks for your help.Eliza
  
   Subject: Re: [R] function inside a function
   From: b...@xs4all.nl
   Date: Thu, 12 Dec 2013 19:35:58 +0100
   CC: r-help@r-project.org
   To: eliza_bo...@hotmail.com
   
   
   On 12-12-2013, at 17:10, eliza botto eliza_bo...@hotmail.com wrote:
   
Dear users of R,
I am trying to inculcate a function inside a function. For that to be 
done, i copied following function from internet. 

library(nleqslv) fun - function(x) { 
   á á  f - numeric(length(x)) 
   á á  f[1] -á A[,1]+x[2] - 1/x[1] 
   á á  f[2] -á A[,2]+x[2] - sin(x[1]) 
   á á  f 
} 
x.start - c(1,1) 
nleqslv(x.start,fun) 
I have a matrix A with dimension 124 rows and 2 columns. In f[1] 
line, in place of A[,1] i want to inculcate each value (each row) of 
column 1 of matrix A. while doing it, In f[2] line, in place of A[,2] i 
want to inculcate each value (each row) of column 2 of matrix A.á 
For suppose A has following rows
0.6772941á á á á á á á á á á á á á á á 0.5962983
0.4348938á á á á á á á á á á á á á á á 0.4563702
0.4481236á á á á á á á á á á á á á á á 0.4418828
0.4213013á á á á á á á á á á á á á á á 0.3944993
0.4682232á á á á á á á á á á á á á á á 0.4485623
0.4798529á á á á á á á á á á á á á á á 0.4477387
0.7029005á á á á á á á á á á á á á á á 0.5533228
While using 0.66772941 in f[1], use 0.5962983 in f[2]. 
How can i do this in R.
Thanks in advance,
   
   
   It is not clear what you actually want. 
   Maybe something like this
   
   library(nleqslv)
   
   A - matrix(c(0.6772941,á 0.5962983,
  á á á á á á á  0.4348938,á 0.4563702,
  á á á á á á á  0.4481236,á 0.4418828,
  á á á á á á á  0.4213013,á 0.3944993,
  á á á á á á á  0.4682232,á 0.4485623,
  á á á á á á á  0.4798529,á 0.4477387,
  á á á á á á á  0.7029005,á 0.5533228), byrow=TRUE,ncol=2)
   
   fun - function(x, krow) {
  á á  f - numeric(length(x))
  á á  f[1] - A[krow,1] + x[2]- 1/x[1]
  á á  f[2] - A[krow,2] +x[2] - sin(x[1])
  á á  f
   }
   
   x.start - c(1,1)
   nleqslv(x.start, fun, krow=1)
   nleqslv(x.start, fun, krow=2)
   
   
Eliza ááá ááá  ááá á  ááá ááá á 
ááá [[alternative HTML version deleted]]

   
   Please do not post in HTML. You should know by now.
   
   Berend
   
__
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.
   
  ááá ááá  ááá á  ááá ááá á 
  ááá [[alternative HTML version deleted]]
 
  
  __
  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.
  

[R] method default for hclust function

2013-12-12 Thread capricy gao
I could not figure out what was the default when I ran hclust() without 
specifying the method.

For example:

I just have a code like:

hclust(dist(data))

Any input would be appreciated:)
[[alternative HTML version deleted]]

__
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] method default for hclust function

2013-12-12 Thread eliza botto
Absolute distance is the default distance in hclust. v-c(1,2,3,4,5,6)
dist(v)
2 1
3 2 1  
4 3 2 1
5 4 3 2 1  
6 5 4 3 2 1

Eliza

 Date: Thu, 12 Dec 2013 15:09:19 -0800
 From: capri...@yahoo.com
 To: r-help@r-project.org
 Subject: [R] method default for hclust function
 
 I could not figure out what was the default when I ran hclust() without 
 specifying the method.
 
 For example:
 
 I just have a code like:
 
 hclust(dist(data))
 
 Any input would be appreciated:)
   [[alternative HTML version deleted]]
 
 __
 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.
  
[[alternative HTML version deleted]]

__
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] method default for hclust function

2013-12-12 Thread Peter Langfelder
On Thu, Dec 12, 2013 at 3:09 PM, capricy gao capri...@yahoo.com wrote:
 I could not figure out what was the default when I ran hclust() without 
 specifying the method.

According to help(hclust), the default method is complete linkage.

HTH,

Peter

__
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] Heatmap, and heatmap.2 gave different figures for the same dataset

2013-12-12 Thread capricy gao
Thank you very much for the hints. I fixed the problem.





On Thursday, December 12, 2013 2:08 PM, Kevin Wright kw.s...@gmail.com wrote:
 
Read the help page for both and pay particular attention to the scale 
argument.

Kevin Wright





On Thu, Dec 12, 2013 at 9:45 AM, capricy gao capri...@yahoo.com wrote:

I have a huge dataset(15k X 18) and tried to use the heatmap in R to examine 
the patterns. However, I found that heatmap and heatmap.2 gave me completely 
different outputs.

Here are the codes:



 dim(as.matrix(data.dcpm))
[1] 15462    18

 heatmap(as.matrix(data.dcpm), col=topo.colors(100))
 heatmap.2(as.matrix(data.dcpm), col=topo.colors(100), key=TRUE, 
 density.inf=none,trace=none, scale=none)
---

The outputs are attached here.

Could anyone help me figure out why?

Thanks a lot:)

__
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.




-- 
Kevin Wright
[[alternative HTML version deleted]]

__
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.


[R] Coxme time-dependent covariate

2013-12-12 Thread Jared Duquette
Hi all,



I am using the coxme function to fit random effects survival models.  The
base survival models show a typical J shaped curve where survival drops
sharply then plateaus over time interval.  I want to include a time
covariate which could account for this non-linear decrease in survival over
time.  However, I have not found a clear way to do this in the coxme
models.  Any suggestions would be greatly appreciated.  Below is some
sample code and data.



-Jared



selection=coxme(Surv(start,stop,status)~prob+(1|year);



fawn

status

start

 stop

prob

year

3

0

0

86

0.83

2009

4

1

0

9

0.6

2009

5

0

0

355

0.63

2009

6

1

0

6

0.52

2010

7

0

0

68

0.79

2010

8

0

0

354

0.69

2010

9

1

0

3

0.72

2010

10

1

0

4

0.77

2010

11

1

0

12

0.62

2010

13

0

0

82

0.7

2011

14

1

0

7

0.67

2011

15

1

0

74

0.49

2011

16

0

0

351

0.64

2011

17

0

0

351

0.74

2011

18

0

0

82

0.72

2011

19

1

0

342

0.69

2011

[[alternative HTML version deleted]]

__
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] function inside a function

2013-12-12 Thread arun
Hi,
May be this helps:
t(sapply(seq_len(nrow(A)),function(i) nleqslv(x.start,fun,krow=i)$x))


A.K.


On Thursday, December 12, 2013 1:54 PM, eliza botto eliza_bo...@hotmail.com 
wrote:
Dear Berend,Thankyou very much for your reply. I actually wanted to inserts 
each row value of A in f[1] anf f[2], with column 1 value in f[1] and column 2 
values in f[2]. Once that been done, i should have in the end, 124 vaues of 
x[1] for column 1 and 124 for column 2.I hope i am clear this time.Thanks for 
your help.Eliza

 Subject: Re: [R] function inside a function
 From: b...@xs4all.nl
 Date: Thu, 12 Dec 2013 19:35:58 +0100
 CC: r-help@r-project.org
 To: eliza_bo...@hotmail.com
 
 
 On 12-12-2013, at 17:10, eliza botto eliza_bo...@hotmail.com wrote:
 
  Dear users of R,
  I am trying to inculcate a function inside a function. For that to be done, 
  i copied following function from internet. 
  
  library(nleqslv) fun - function(x) { 
      f - numeric(length(x)) 
      f[1] -  A[,1]+x[2] - 1/x[1] 
      f[2] -  A[,2]+x[2] - sin(x[1]) 
      f 
  } 
  x.start - c(1,1) 
  nleqslv(x.start,fun) 
  I have a matrix A with dimension 124 rows and 2 columns. In f[1] line, in 
  place of A[,1] i want to inculcate each value (each row) of 
  column 1 of matrix A. while doing it, In f[2] line, in place of A[,2] i 
  want to inculcate each value (each row) of column 2 of matrix A.  
  For suppose A has following rows
  0.6772941                              0.5962983
  0.4348938                              0.4563702
  0.4481236                              0.4418828
  0.4213013                              0.3944993
  0.4682232                              0.4485623
  0.4798529                              0.4477387
  0.7029005                              0.5533228
  While using 0.66772941 in f[1], use 0.5962983 in f[2]. 
  How can i do this in R.
  Thanks in advance,
 
 
 It is not clear what you actually want. 
 Maybe something like this
 
 library(nleqslv)
 
 A - matrix(c(0.6772941,  0.5962983,
               0.4348938,  0.4563702,
               0.4481236,  0.4418828,
               0.4213013,  0.3944993,
               0.4682232,  0.4485623,
               0.4798529,  0.4477387,
               0.7029005,  0.5533228), byrow=TRUE,ncol=2)
 
 fun - function(x, krow) {
     f - numeric(length(x))
     f[1] - A[krow,1] + x[2]- 1/x[1]
     f[2] - A[krow,2] +x[2] - sin(x[1])
     f
 }
 
 x.start - c(1,1)
 nleqslv(x.start, fun, krow=1)
 nleqslv(x.start, fun, krow=2)
 
 
  Eliza                           
      [[alternative HTML version deleted]]
  
 
 Please do not post in HTML. You should know by now.
 
 Berend
 
  __
  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.
 
                          
    [[alternative HTML version deleted]]

__
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.


__
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.


[R] charToRaw(Œ) is not 8C in R console

2013-12-12 Thread 水静流深
in http://www.ascii-code.com/, you can see the the hex value of Πis 8C,






why in my R console ?
charToRaw(Œ)
 [1] c5 92
 is not 8C ?
[[alternative HTML version deleted]]

__
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.