[R] Automating the running of MVLN model in R using R2WinBUGS

2013-07-01 Thread Anamika Chaudhuri
Hi:

To test the situation below I am creating 2 datasets
.#Set working directory
setwd("C://Tina/USB_Backup_042213/Testing/CSV")

matrix=NULL
csvs <- paste("MVN", 1:2, ".csv", sep="")
for(i in 1:length(csvs)){
  matrix[[i]] <- read.csv(file=csvs[i], header=T)
  print(matrix[[i]])
}

So now I have read in 2 simulated datasets which  look like
 Y1 Y2
1 11  6
2  8  5
3 25 13
4  1 13
5  8 22
  Y1 Y2
1  9  1
2  7  9
3 25 13
4  1 18
5  9 12

My next step is to run a multivariate logit normal model on these datasets
and automate this process for 300 such simulated datasets. Heres the model
statement:
model
 {
  for (j in 1 : Nf)

  {
  p1[j, 1:2 ] ~ dmnorm(gamma[1:2 ], T[1:2 ,1:2 ])

  for (i in 1:2)
  {
 logit(p[j,i])<-p1[j,i]

 Y[j,i] ~ dbin(p[j,i],n)
}}

I am trying to use the following code to run it in R2WinBUGS

bugs.output <- list()
for(i in 1:2){ # for 2 simulated datasets for
now
   *Y <-(matrix[i])*   * *
   bugs.output[[i]] <- bugs(
   data=list(Y=Y, Nf=5), # change for no of sites
inits=NULL,
   model.file="M-LN_model_trial.txt",
   parameters.to.save = c("p","rho","sigma2"),
n.chains=1, n.iter=12000, n.burnin=5000,
bugs.directory="C://Tina/USB_Backup_042213/winbugs14/WinBUGS14",
working.directory=NULL)}


Any suggestion would be helpful.
Thanks!

[[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] subset of factors in a regression

2013-07-01 Thread Ben Bolker
Philip A. Viton  osu.edu> writes:

> suppose "state" is a variable in a dataframe containing abbreviations 
> of the US states, as a factor. What I'd like to do is to include 
> dummy variables for a few of the states, (say, CA and MA) among the 
> independent variables in my regression formula. (This would be the 
> equivalent of, creating, eg, ca<-state=="CA") and then including 
> that). I know I can create all the necessary dummy variables by using 
> the "outer" function on the factor and then renaming them 
> appropriately; but is there a solution that's more direct, ie that 
> doesn't involve a lot of new variables?
> 
> Thanks!

  You could use model.matrix(~state-1) and select the columns
you want, e.g.

state <- state.abb; m <- model.matrix(~state-1)
m[,colnames(m) %in% c("stateCA","stateMA")]

 -- but this will actually create a bunch of vectors you
want before throwing them away.

more compactly:

m <- sapply(cstates,"==",state)
storage.mode(m) <- "numeric"
## or m[] <- as.numeric(m)

__
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] KalmanForecast (stats)

2013-07-01 Thread Bert Gunter
Below...

On Mon, Jul 1, 2013 at 7:24 PM, Giovanni Petris  wrote:
>
> Oops...
>
> Correction: The function KalmanForecast does exist in package stats.
>
> The references that I gave in my other reply are still valid, though. It is 
> my impression that Kalman filtering facilities in stats are not meant to be 
> used directly by the end user of R,

... and on what, pray tell, do you base **that**  strange pronouncement??

-- Bert




but their main purpose is to serve as workhorses for other model
fitting and forecasting functions (e.g., StructTS).
>
> Best,
> Giovanni
>
> 
> From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] on behalf 
> of Csima Gabriella [csim...@met.hu]
> Sent: Friday, June 28, 2013 6:27 AM
> To: r-help@r-project.org
> Subject: [R] KalmanForecast (stats)
>
> Dear List members,
>
> I would like to use the Kalman-filter program for forecasting - namely for 
> postprocessing numerical model results of 2m temperature. I have looked 
> through the help of the Kalman-filtering programs, mainly the KalmanForecast 
> and I have read about the newer packages like KFAS as well.
>
> I always uderstand and use new R programs that first I try out the 
> example(s), it makes me a base for my new program. My problem is that there 
> is no any example (with data that I can run immediately), and I do not 
> understand, or cannot imagine how - e.g. the "mod" - have to be as the input 
> of the program.
>
> Could you send me a simple example of KalmanForecast (with input data) that I 
> can run and can see how it works exactly?
>
> Cheers,
> Gabriella
>
>
>
> [[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

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] KalmanForecast (stats)

2013-07-01 Thread Hasan Diwan
On 1 July 2013 19:24, Giovanni Petris  wrote:
> Could you send me a simple example of KalmanForecast (with input data) that I 
> can run and can see how it works exactly?

There's an explanation of the Kalman Filter available at
http://www.swarthmore.edu/NatSci/echeeve1/Ref/Kalman/ScalarKalman.html
-- I've summarised it below:
The kalman filter is used to reduce the noise in an indirectly
measured signal, s, approximated by the formula -- x[t] = a*x[t-1] +
b*u[t], to which a random amount of white noise is added, making the
equation x[t] = a*x[t-1]+b*u[t] + w[t]. The white noise varies with
time, hence it's a series. Each measure of x[t] brings you closer to
the actual signal. I hope this helps... -- H
-- 
Sent from my mobile device
Envoyé de mon portable

__
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] KalmanForecast (stats)

2013-07-01 Thread Giovanni Petris

Oops...

Correction: The function KalmanForecast does exist in package stats.

The references that I gave in my other reply are still valid, though. It is my 
impression that Kalman filtering facilities in stats are not meant to be used 
directly by the end user of R, but their main purpose is to serve as workhorses 
for other model fitting and forecasting functions (e.g., StructTS). 

Best,
Giovanni 


From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] on behalf of 
Csima Gabriella [csim...@met.hu]
Sent: Friday, June 28, 2013 6:27 AM
To: r-help@r-project.org
Subject: [R] KalmanForecast (stats)

Dear List members,

I would like to use the Kalman-filter program for forecasting - namely for 
postprocessing numerical model results of 2m temperature. I have looked through 
the help of the Kalman-filtering programs, mainly the KalmanForecast and I have 
read about the newer packages like KFAS as well.

I always uderstand and use new R programs that first I try out the example(s), 
it makes me a base for my new program. My problem is that there is no any 
example (with data that I can run immediately), and I do not understand, or 
cannot imagine how - e.g. the "mod" - have to be as the input of the program.

Could you send me a simple example of KalmanForecast (with input data) that I 
can run and can see how it works exactly?

Cheers,
Gabriella



[[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] KalmanForecast (stats)

2013-07-01 Thread Giovanni Petris

Gabriella,

There is no function "KalmanForecast" in package stats, so I am not quite sure 
about what you are talking about. That said, it may help a review paper that I 
wrote a couple of years ago about the different packages available in R for 
state space modeling (Petris & Petrone, State space models in R, Journal of 
Statistical Software 41, 2011). Another good review paper is Tusell, Kalman 
filtering in R, JSS 39, 2011.

Hope this helps you to get started.

Best,
Giovanni 


From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] on behalf of 
Csima Gabriella [csim...@met.hu]
Sent: Friday, June 28, 2013 6:27 AM
To: r-help@r-project.org
Subject: [R] KalmanForecast (stats)

Dear List members,

I would like to use the Kalman-filter program for forecasting - namely for 
postprocessing numerical model results of 2m temperature. I have looked through 
the help of the Kalman-filtering programs, mainly the KalmanForecast and I have 
read about the newer packages like KFAS as well.

I always uderstand and use new R programs that first I try out the example(s), 
it makes me a base for my new program. My problem is that there is no any 
example (with data that I can run immediately), and I do not understand, or 
cannot imagine how - e.g. the "mod" - have to be as the input of the program.

Could you send me a simple example of KalmanForecast (with input data) that I 
can run and can see how it works exactly?

Cheers,
Gabriella



[[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] Fwd: functions and matrices

2013-07-01 Thread David Winsemius

With permission I offer this exchange. Rolf and I have different notions of 
what u %*% v should mean, but the arbiter is obviously the original poster:

Begin forwarded message:

> From: David Winsemius 
> Subject: Re: [R] functions and matrices
> Date: July 1, 2013 6:21:09 PM PDT
> To: Rolf Turner 
> 
> 
> On Jul 1, 2013, at 5:09 PM, Rolf Turner wrote:
> 
>> On 02/07/13 11:37, David Winsemius wrote:
>>> On Jul 1, 2013, at 3:32 PM, Rolf Turner wrote:
>>> 
 Basically R does things *numerically* and what you want to do really
 amounts to symbolic manipulation.  Of course R could be cajoled into
 doing it --- see fortune("Yoda") --- but probably only with a great deal of
 effort and code-writing.
 
 OTOH you could quite easily write a function that would calculate
 det(u%*%v)(x) for any given numerical value of x:
 
 foo <- function(a,b,x){
   a1 <- apply(a,c(1,2),function(m,x){m[[1]](x)},x=x)
   b1 <- apply(b,c(1,2),function(m,x){m[[1]](x)},x=x)
   det(a1%*%b1)
 }
 
 Then doing
 
   foo(u,v,2)
>>> I would have thought that (u %*% v) would be:
>>> 
>>>  u[1,1]( v[1,1](x) ) + u[1,2]( v[2,1](x) )   u[1,1]( v[1,2](x) ) + 
>>> u[1,2]( v[2,2](x) )
>>>  u[2,1]( v[1,1](x) ) + u[2,2]( v[2,1](x) )   u[2,1]( v[2,1](x) ) + 
>>> u[2,2]( v[2,2](x) )
>>> 
>>> (Crossing my fingers that I got the row and column conventions correct for 
>>> matrix multiplication.)
>>> 
>> 
>> 
>> Not quite sure what you're getting at here.  It looks to me that you are
>> calculating the *composition* of the functions rather than their *product*.
> 
> Exactly. That is how I understood successive application of functions 
> embedded in matrices . The symbol used in my differential topology course lo 
> those 40 years ago was an open circle, but I assumed the OP wanted something 
> along those lines to perform a composite mapping:
> 
> compose <- function(u, v, x) matrix( c(
>   u[1,1][[1]]( v[1,1][[1]](x) ) + u[1,2][[1]]( v[2,1][[1]](x) ) ,  
>   u[1,1][[1]]( v[1,2][[1]](x) ) + u[1,2][[1]]( v[2,2][[1]](x) ),
>   u[2,1][[1]]( v[1,1][[1]](x) ) + u[2,2][[1]]( v[2,1][[1]](x) ),  
>   u[2,1][[1]]( v[2,1][[1]](x) ) + u[2,2][[1]]( v[2,2][[1]](x) ) ), 
> 2,2,byrow=TRUE)
> 
> compose(u,v,2)
> [,1][,2]
> [1,]   751332
> [2,] 5427 1680128
> 
> (Noting that I may have reversed the roles of u and v.)
> 
>> 
>> I.e. you are taking the (i,j)th entry of "u%*%v" (evaluated at x) to be the
>> sum over k of
>> 
>>   u[i,k](v[k,j](x))
>> 
>> This is not what I understood the OP to want.  I assumed he wanted the
>> product of the function values rather than the composition of the functions,
>> i.e. that he wanted the (i,j)th entry to be the sum over k of
>> 
>>   u[i,k](x) * v[k,j](x)
>> 
>> which is what my function provides.  This seems to me to be the most
>> "reasonable" interpretation, but I could be wrong.
>> 
>> BTW --- you cannot actually do u[i,k](x).  E.g.
>> 
>>   u[1,2](2)
>> 
>> gives "Error: attempt to apply non-function".  One needs to do u[1,2][[1]](2)
>> (which gives 4, as it should).
> 
> Yes. I was playing fast and loose with notation. I didn't think the code 
> would really run as offered.I was a bit surprise that this worked, but I 
> suppose you bear credit (and blame?) for pushing my program closer to 
> completion.
> 
>> v[1,1][[1]]( u[1,1][[1]]( 2 ))
> [1] 11
> 
> Any problem with me copying this to the list?
> 
> 
>> 
>>   cheers,
>> 
>>   Rolf
> 
> Best;
> 
> 
> David Winsemius
> Alameda, CA, USA
> 

David Winsemius
Alameda, CA, USA

__
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] similarity and dissimilarity index

2013-07-01 Thread Rolf Turner

On 02/07/13 11:46, Khasro Abdulrahman Ismael wrote:

Hallo every one
I have this table and tried to find similarity and dissimilarity index in r by 
vegan package but I couldn't. I really don't know why I couldn't as I spend a 
lot of time working on it, so would you be so kind to calculate or give me some 
advise about my problem?


Another nominee for the "Obtuse Question of the Month" award.

cheers,

Rolf Turner

P.S.  I.e. read the  posting guide.

R. T.

__
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] similarity and dissimilarity index

2013-07-01 Thread Khasro Abdulrahman Ismael
Hallo every one
I have this table and tried to find similarity and dissimilarity index in r by 
vegan package but I couldn't. I really don't know why I couldn't as I spend a 
lot of time working on it, so would you be so kind to calculate or give me some 
advise about my problem?
 
Ismael, Khasro Abdulrahman 
Bremen University
Mary-Astell-Straße 25
Wohnung 149
28539 Bremen
Germany __
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] functions and matrices

2013-07-01 Thread David Winsemius

On Jul 1, 2013, at 3:32 PM, Rolf Turner wrote:

> 
> Basically R does things *numerically* and what you want to do really
> amounts to symbolic manipulation.  Of course R could be cajoled into
> doing it --- see fortune("Yoda") --- but probably only with a great deal of
> effort and code-writing.
> 
> OTOH you could quite easily write a function that would calculate
> det(u%*%v)(x) for any given numerical value of x:
> 
> foo <- function(a,b,x){
>a1 <- apply(a,c(1,2),function(m,x){m[[1]](x)},x=x)
>b1 <- apply(b,c(1,2),function(m,x){m[[1]](x)},x=x)
>det(a1%*%b1)
> }
> 
> Then doing
> 
>foo(u,v,2)

I would have thought that (u %*% v) would be:

  u[1,1]( v[1,1](x) ) + u[1,2]( v[2,1](x) )   u[1,1]( v[1,2](x) ) + u[1,2]( 
v[2,2](x) )  
  u[2,1]( v[1,1](x) ) + u[2,2]( v[2,1](x) )   u[2,1]( v[2,1](x) ) + u[2,2]( 
v[2,2](x) )

(Crossing my fingers that I got the row and column conventions correct for 
matrix multiplication.)


> 
> gives 0.  (In fact foo(u,v,anything) gives 0 for your collection of functions;
> the matrix "u(x)" is singular for any x --- the second row is x^2 times the
> first row.)
> 
> Perhaps this is good enough for your purposes?  If not, you should probably
> be looking at a symbolic manipulation package.  The R package "Ryacas" has
> some capabilities in this regard, but I have no experience with it and cannot
> advise.
> 
>cheers,
> 
>Rolf Turner
> 
> On 02/07/13 05:37, Naser Jamil wrote:
>> Dear R-user,
>> May I seek your help, please. I have two matrices, u and v, elements of
>> which are some functions
>> of x. I just want to multiply them and express the determinant of the
>> resulting matrix as a function of
>> x and of course, this is for some reason. Actually the original problem has
>> more matrices to multiply and I'm just wondering whether I can simplify it
>> anyway through the R codes. It may even be non-sense, but just want to hear
>> from you. The below is the code.
>> 
>> -
>> 
>> f1<-function(x) {x}
>> f2<-function(x) {x^2}
>> f3<-function(x) {x^3}
>> f4<-function(x) {x^4}
>> 
>> f5<-function(x) {x^2+7}
>> f6<-function(x) {x^3+14*x}
>> f7<-function(x) {x^2+2*x}
>> f8<-function(x) {x^4+10*x}
>> 
>> u<-matrix(c(f1,f2,f3,f4), nrow=2, ncol=2, byrow=TRUE)
>> v<-matrix(c(f5,f6,f7,f8), nrow=2, ncol=2, byrow=TRUE)
>> 
>> det(u %*% v) # Is that possible?
>> 
>> 
>> 
>> Any suggestion will be more than great!
> 
> __
> 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.

David Winsemius
Alameda, CA, USA

__
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] functions and matrices

2013-07-01 Thread Rolf Turner


Basically R does things *numerically* and what you want to do really
amounts to symbolic manipulation.  Of course R could be cajoled into
doing it --- see fortune("Yoda") --- but probably only with a great deal of
effort and code-writing.

OTOH you could quite easily write a function that would calculate
det(u%*%v)(x) for any given numerical value of x:

foo <- function(a,b,x){
a1 <- apply(a,c(1,2),function(m,x){m[[1]](x)},x=x)
b1 <- apply(b,c(1,2),function(m,x){m[[1]](x)},x=x)
det(a1%*%b1)
}

Then doing

foo(u,v,2)

gives 0.  (In fact foo(u,v,anything) gives 0 for your collection of 
functions;

the matrix "u(x)" is singular for any x --- the second row is x^2 times the
first row.)

Perhaps this is good enough for your purposes?  If not, you should probably
be looking at a symbolic manipulation package.  The R package "Ryacas" has
some capabilities in this regard, but I have no experience with it and 
cannot

advise.

cheers,

Rolf Turner

On 02/07/13 05:37, Naser Jamil wrote:

Dear R-user,
May I seek your help, please. I have two matrices, u and v, elements of
which are some functions
of x. I just want to multiply them and express the determinant of the
resulting matrix as a function of
x and of course, this is for some reason. Actually the original problem has
more matrices to multiply and I'm just wondering whether I can simplify it
anyway through the R codes. It may even be non-sense, but just want to hear
from you. The below is the code.

-

f1<-function(x) {x}
f2<-function(x) {x^2}
f3<-function(x) {x^3}
f4<-function(x) {x^4}

f5<-function(x) {x^2+7}
f6<-function(x) {x^3+14*x}
f7<-function(x) {x^2+2*x}
f8<-function(x) {x^4+10*x}

u<-matrix(c(f1,f2,f3,f4), nrow=2, ncol=2, byrow=TRUE)
v<-matrix(c(f5,f6,f7,f8), nrow=2, ncol=2, byrow=TRUE)

det(u %*% v) # Is that possible?



Any suggestion will be more than great!


__
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] Trying to predict from a time series with Additive Outliers: Error in as.matrix(newxreg) %*% coefs[-(1L:narma)] : non-conformable arguments

2013-07-01 Thread Andrew W. Swift
Hi,

I am trying to work through an example in Cryer & Chan's book with regards to 
an ARIMA model with Interventions and Outliers

The model fit is:

m=arimax(log(airmiles),order=c(0,1,1),seasonal=list(order=c(0,1,1),period=12),xtransf=data.frame(I911=1*(seq(airmiles)==69),
 
I911a=1*(seq(airmiles)==69)),transfer=list(c(0,0),c(1,0)),xreg=data.frame(I12=1*(seq(airmiles)==12),I25=1*(seq(airmiles)==25),I84=1*(seq(airmiles)==84)),io=c(81),method='ML')

I now want to predict from this model.  I understand that since we use xreg in 
the model fit, I have to specify newxreg in the predict statement.  Since xreg 
only contains information about additive outliers, the vectors provided in 
newxreg should all be zeros. 

I thus try the following

nxr=data.frame(I12=seq(0,0,length=5),I25=seq(0,0,length=5),I84=seq(0,0,length=5))
predict(m,na.ahead=5,newxreg=nxr)

But I get the following error:

Error in as.matrix(newxreg) %*% coefs[-(1L:narma)] : 
  non-conformable arguments


Any thoughts?

Thanks. 

__
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] subset of factors in a regression

2013-07-01 Thread Philip A. Viton


suppose "state" is a variable in a dataframe containing abbreviations 
of the US states, as a factor. What I'd like to do is to include 
dummy variables for a few of the states, (say, CA and MA) among the 
independent variables in my regression formula. (This would be the 
equivalent of, creating, eg, ca<-state=="CA") and then including 
that). I know I can create all the necessary dummy variables by using 
the "outer" function on the factor and then renaming them 
appropriately; but is there a solution that's more direct, ie that 
doesn't involve a lot of new variables?


Thanks!



Philip A. Viton
City Planning, Ohio State University
275 West Woodruff Avenue, Columbus OH 43210
vito...@osu.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] Optimum of lm

2013-07-01 Thread ben1983
Hi All, 
  I am trying to do some D o E. I would like to find the optima
(maxima) of a 2 dimensional lm with quadratic terms.
I'm sure there is a really simple solution but i can't find it.
Also would there be any way to find some sort of confidence limits on these
optima?
Any help most appreciated!
Cheers,
Ben



--
View this message in context: 
http://r.789695.n4.nabble.com/Optimum-of-lm-tp4670674.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] Lee carter model

2013-07-01 Thread Jeff Newmiller
The Posting Guide warns you to not post in HTML format (it messes up R code 
examples). It also warns you to supply reproducible examples (we should be able 
to paste your code into a fresh R session and see essentially what you see). 

The warning message means you have given the function a factor where it 
expected a numeric value (max does not work on factors). I suggest that you 
learn how to use the str() function on your data so you know that you have 
imported it successfully before you give it to analysis functions. You may need 
to review the "Introduction to R" and "R Data Import/Export" PDF files that 
come with R if you don't know what a factor is or how to import numeric data.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  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.

ntamjo achille  wrote:

>Hi everybody,
>
>I'm running codes for for a Lee carter modeling. I compute the
>demogdata function in the package demography.�
>Age is a class of factor
>
>Base<-demogdata(data=x,pop=y,ages=AGE,years=YEAR,type="mortality",label="City",name="Hommes",lambda=1)
>�
>Now, I try to run codes for lee carter model, and i always get the
>following message:
>Error in Summary.factor(c(1L, 2L, 24L, 35L, 46L, 57L, 68L, 79L, 90L,
>101L, �:�
>� max not meaningful for factors
>
>Please can you help to understand what means this message.�
>
>Many Thanks
>
>Achille
>
>   [[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] Bhattacharyya in R

2013-07-01 Thread Jeff Newmiller
There is a built-in guide to syntax called the help system. If you have read it 
you should be able to be mitre specific with your questions.

I had never heard of this function. Your example code is not reproducible, nor 
does it indicate what result you got from running it.

I used

RSiteSearch("bhattacharya")

and there appears to be a function bhattacharyya.matrix in the fpc package. The 
syntax indicated in the help for that function mentions wanting input matrices, 
not vectors. It also mentions another function bhattacharyya.dist which does 
accept vectors, but it does not accept the misclassification.bound argument.

You should read the help file and ask more specific questions and provide 
reproducible examples per the Posting Guide recommendations.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  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.

Dzu  wrote:

>Dear R-user,
>I am trying to apply bhattacharyya-distance function to my data. Did
>anybody
>use it before ?
>
>My code is the following
>
>#Bhattacharya Distance measure
>#a and b are vectors 
>a <- (1,2,3,4,2,2,2,2,2,2,2,1,4,5,6,-1,-1,-1,-1,-1,-3,-3,-3)
>b <-
>(1.1,1.1,1.2,1.2,1.2,1.2,1.2,2.1,2.1,2.2,2.2,2,0,0,0,0,2,2,2,2,2,3.1,3.1)
>
>dist <- bhattacharyya.matrix(a,b, misclassification.bound = TRUE)
>plot(dist)
>
>
>Could somebody give me a guide on the syntax ?
>
>Thanks
>Dizem
>
>
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Bhattacharyya-in-R-tp4670671.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.

__
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] Bhattacharyya in R

2013-07-01 Thread Dzu
Dear R-user,
I am trying to apply bhattacharyya-distance function to my data. Did anybody
use it before ?

My code is the following

#Bhattacharya Distance measure
#a and b are vectors 
a <- (1,2,3,4,2,2,2,2,2,2,2,1,4,5,6,-1,-1,-1,-1,-1,-3,-3,-3)
b <-
(1.1,1.1,1.2,1.2,1.2,1.2,1.2,2.1,2.1,2.2,2.2,2,0,0,0,0,2,2,2,2,2,3.1,3.1)

dist <- bhattacharyya.matrix(a,b,missclasification = TRUE)
plot(dist)


Could somebody give me a guide on the syntax ?

Thanks
Dizem





--
View this message in context: 
http://r.789695.n4.nabble.com/Bhattacharyya-in-R-tp4670671.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] writing to the screen and extra "0"

2013-07-01 Thread Berend Hasselman

On 01-07-2013, at 21:03, Thomas Grzybowski  wrote:

> Hi.
> 
> list.files(pattern = "*")
> 
> gives me output with the R list indices at the left of each line on the 
> screen.  I want only file names.
> 

cat(list.files(pattern = "*"),sep="\n")

Berend

> Thanks!
> Tom Grzybowski
> 
> 
> On 07/01/2013 02:55 PM, Rui Barradas wrote:
>> Hello,
>> 
>> Try instead
>> 
>> 
>> list.files(pattern = "*")
>> 
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> 
>> Em 01-07-2013 19:23, Thomas Grzybowski escreveu:
>>> 
>>> I am using the "write" function like so (R 3.0.1 on linux):
>>> 
>>> "wrt" <-
>>> function()
>>> {
>>> write(system("ls *"),file="")
>>> }
>>> 
>>> When the files are listed to the screen with wrt(), there is a "0"
>>> character prepended to the output on the screen.  Worse, when I remove
>>> the 'file=""' argument to "write", a file named "data" is created in my
>>> default directory, with a zero in it.
>>> 
>>> All I am trying to do is output the "ls" of files in my directory,
>>> without any extra characters or type-attribute information. Thanks for
>>> your help!
>>> 
>>> Thomas Grzybowski
>>> 
>>> __
>>> 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-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] writing to the screen and extra "0"

2013-07-01 Thread Charles Determan Jr
Hi Thomas,

If you put the list.files statement inside the write function you won't
have the indices.
Try:

write(list.files(pattern="*"), file="my_files.txt")

Cheers,
Charles



On Mon, Jul 1, 2013 at 2:03 PM, Thomas Grzybowski <
thomasgrzybow...@gmail.com> wrote:

> Hi.
>
> list.files(pattern = "*")
>
> gives me output with the R list indices at the left of each line on the
> screen.  I want only file names.
>
> Thanks!
> Tom Grzybowski
>
>
> On 07/01/2013 02:55 PM, Rui Barradas wrote:
>
>> Hello,
>>
>> Try instead
>>
>>
>> list.files(pattern = "*")
>>
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>> Em 01-07-2013 19:23, Thomas Grzybowski escreveu:
>>
>>>
>>> I am using the "write" function like so (R 3.0.1 on linux):
>>>
>>> "wrt" <-
>>> function()
>>> {
>>>  write(system("ls *"),file="")
>>> }
>>>
>>> When the files are listed to the screen with wrt(), there is a "0"
>>> character prepended to the output on the screen.  Worse, when I remove
>>> the 'file=""' argument to "write", a file named "data" is created in my
>>> default directory, with a zero in it.
>>>
>>> All I am trying to do is output the "ls" of files in my directory,
>>> without any extra characters or type-attribute information. Thanks for
>>> your help!
>>>
>>> Thomas Grzybowski
>>>
>>> __**
>>> 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.
>



-- 
Charles Determan
Integrated Biosciences PhD Candidate
University of Minnesota

[[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] writing to the screen and extra "0"

2013-07-01 Thread Thomas Grzybowski

Hi.

list.files(pattern = "*")

gives me output with the R list indices at the left of each line on the 
screen.  I want only file names.


Thanks!
Tom Grzybowski


On 07/01/2013 02:55 PM, Rui Barradas wrote:

Hello,

Try instead


list.files(pattern = "*")


Hope this helps,

Rui Barradas

Em 01-07-2013 19:23, Thomas Grzybowski escreveu:


I am using the "write" function like so (R 3.0.1 on linux):

"wrt" <-
function()
{
 write(system("ls *"),file="")
}

When the files are listed to the screen with wrt(), there is a "0"
character prepended to the output on the screen.  Worse, when I remove
the 'file=""' argument to "write", a file named "data" is created in my
default directory, with a zero in it.

All I am trying to do is output the "ls" of files in my directory,
without any extra characters or type-attribute information. Thanks for
your help!

Thomas Grzybowski

__
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] Missing data problem and ROC curves

2013-07-01 Thread David Winsemius

On Jul 1, 2013, at 10:57 AM, tfj24 wrote:

> Hello all,
> 
> Trying to get this piece of code to work on my data set. It is from
> http://www.itc.nl/personal/rossiter.
> 
> logit.roc <- function(model, steps=100)
>   {
>   field.name <- attr(attr(terms(formula(model)), "factors"),
> "dimnames")[[1]][1]
>   eval(parse(text=paste("tmp <- ", ifelse(class(model$data) == 
> "data.frame",
> "model$data$", ""), field.name, sep="")))
>   r <- data.frame(pts = seq(0, 1-(1/steps), by=1/steps), sens = 
> 0, spec=0);
> for (i in 0:steps)
>   {
> thresh <- i/steps;
> r$sens[i] <- sum((fitted(model) >= thresh) & 
> tmp)/sum(tmp);
> r$spec[i] <- sum((fitted(model) < thresh) & 
> !tmp)/sum(!tmp)
>   }
>   return(r)}
> 
> where model is the output of a glm.

> 
> The problem is the "sum((fitted(model) >= thresh) & tmp)" bit. The lengths
> of fitted(model) and tmp are not equal because some of the cases were
> deleted from the model due to missing data! fitted(model) is a set of named
> numbers while tmp is a set of integers.
> 
> My question is:
> - How do I determine which cases were deleted from the model and then delete
> the associated cases from tmp?
> 

?glm
model$na.action

-- 
David.

> I hope this makes sense and would really appreciate any help that people may
> have.
> 
> Thanks,
> Tim
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Missing-data-problem-and-ROC-curves-tp4670661.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.

David Winsemius
Alameda, CA, USA

__
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] writing to the screen and extra "0"

2013-07-01 Thread Rui Barradas

Hello,

Try instead


list.files(pattern = "*")


Hope this helps,

Rui Barradas

Em 01-07-2013 19:23, Thomas Grzybowski escreveu:


I am using the "write" function like so (R 3.0.1 on linux):

"wrt" <-
function()
{
 write(system("ls *"),file="")
}

When the files are listed to the screen with wrt(), there is a "0"
character prepended to the output on the screen.  Worse, when I remove
the 'file=""' argument to "write", a file named "data" is created in my
default directory, with a zero in it.

All I am trying to do is output the "ls" of files in my directory,
without any extra characters or type-attribute information.  Thanks for
your help!

Thomas Grzybowski

__
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] writing to the screen and extra "0"

2013-07-01 Thread Thomas Grzybowski


I am using the "write" function like so (R 3.0.1 on linux):

"wrt" <-
function()
{
write(system("ls *"),file="")
}

When the files are listed to the screen with wrt(), there is a "0" 
character prepended to the output on the screen.  Worse, when I remove 
the 'file=""' argument to "write", a file named "data" is created in my 
default directory, with a zero in it.


All I am trying to do is output the "ls" of files in my directory, 
without any extra characters or type-attribute information.  Thanks for 
your help!


Thomas Grzybowski

__
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] functions and matrices

2013-07-01 Thread Naser Jamil
Dear R-user,
May I seek your help, please. I have two matrices, u and v, elements of
which are some functions
of x. I just want to multiply them and express the determinant of the
resulting matrix as a function of
x and of course, this is for some reason. Actually the original problem has
more matrices to multiply and I'm just wondering whether I can simplify it
anyway through the R codes. It may even be non-sense, but just want to hear
from you. The below is the code.

-

f1<-function(x) {x}
f2<-function(x) {x^2}
f3<-function(x) {x^3}
f4<-function(x) {x^4}

f5<-function(x) {x^2+7}
f6<-function(x) {x^3+14*x}
f7<-function(x) {x^2+2*x}
f8<-function(x) {x^4+10*x}

u<-matrix(c(f1,f2,f3,f4), nrow=2, ncol=2, byrow=TRUE)
v<-matrix(c(f5,f6,f7,f8), nrow=2, ncol=2, byrow=TRUE)

det(u %*% v) # Is that possible?



Any suggestion will be more than great!

Regards,
Jamil.

[[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] Lee carter model

2013-07-01 Thread ntamjo achille
Hi everybody,

I'm running codes for for a Lee carter modeling. I compute the demogdata 
function in the package demography. 
Age is a class of factor

Base<-demogdata(data=x,pop=y,ages=AGE,years=YEAR,type="mortality",label="City",name="Hommes",lambda=1)
 
Now, I try to run codes for lee carter model, and i always get the following 
message:
Error in Summary.factor(c(1L, 2L, 24L, 35L, 46L, 57L, 68L, 79L, 90L, 101L,  : 
  max not meaningful for factors

Please can you help to understand what means this message. 

Many Thanks

Achille

[[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] Dunnett's T3 test (DTK package) problem

2013-07-01 Thread Sam Mak
Hello,

I would like to ask a question about using DTK.test() to do the T3 test.

The data file is downloadable here:
http://ubuntuone.com/0zBl8QgUg1lAG6iK1CUicD

My question is: in the result of T3 test, is it possible for the following
three statements to hold without conflict?
1. m_a and m_b to be significantly different
2. m_a and m_c are not significantly different.
3. (m_c - m_a) >= (m_c- m_b)
where m_i is the mean value of group i.

I know that for Tukey test, the above three statements can't hold without
conflict.


The code to run the test is:

 BEGIN 
library(DTK)
df <- read.csv("./tmpData.csv")
DTK_result <- DTK.test(df$measurement, df$model, .05)
print(DTK_result)
 END 

Part of the result is displayed below. It says model05 and model01 are
significantly different, while model04 and model01 are not.

 BEGIN 
   DiffLower CI  Upper CI
model02-model01 0.068468884 -0.04765040 0.1845882
model03-model01 0.143238920 -0.05589008 0.3423679
model04-model01 0.149002642  0.02900301 0.2690023
model05-model01 0.151504289 -0.04775209 0.3507607
model06-model01 0.193093625  0.07023934 0.3159479
...
 END 


The mean value of the groups are shown below. It shows (m_5 - m_1) > (m_4 -
m_1), where m_i is the mean value of model i.

 BEGIN 
library(plyr)
ddply(df, ~model, summarise, mean=mean(measurement))

 model  mean
1  model01 0.5352273
2  model02 0.6036962
3  model03 0.6784662
4  model04 0.6842300
5  model05 0.6867316
6  model06 0.7283210
7  model07 0.7489938
8  model08 0.7941213
9  model09 0.7944798
10 model10 1.1399370
11 model11 1.2582504
12 model12 1.2928783
13 model13 1.5789970
 END 




--
View this message in context: 
http://r.789695.n4.nabble.com/Dunnett-s-T3-test-DTK-package-problem-tp4670649.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.


[R] Missing data problem and ROC curves

2013-07-01 Thread tfj24
Hello all,

Trying to get this piece of code to work on my data set. It is from
http://www.itc.nl/personal/rossiter.

logit.roc <- function(model, steps=100)
{
field.name <- attr(attr(terms(formula(model)), "factors"),
"dimnames")[[1]][1]
eval(parse(text=paste("tmp <- ", ifelse(class(model$data) == 
"data.frame",
"model$data$", ""), field.name, sep="")))
r <- data.frame(pts = seq(0, 1-(1/steps), by=1/steps), sens = 
0, spec=0);
for (i in 0:steps)
{
  thresh <- i/steps;
  r$sens[i] <- sum((fitted(model) >= thresh) & 
tmp)/sum(tmp);
  r$spec[i] <- sum((fitted(model) < thresh) & 
!tmp)/sum(!tmp)
}
return(r)}

where model is the output of a glm.

The problem is the "sum((fitted(model) >= thresh) & tmp)" bit. The lengths
of fitted(model) and tmp are not equal because some of the cases were
deleted from the model due to missing data! fitted(model) is a set of named
numbers while tmp is a set of integers.

My question is:
- How do I determine which cases were deleted from the model and then delete
the associated cases from tmp?

I hope this makes sense and would really appreciate any help that people may
have.

Thanks,
Tim



--
View this message in context: 
http://r.789695.n4.nabble.com/Missing-data-problem-and-ROC-curves-tp4670661.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] Parallel processing random 'save' error

2013-07-01 Thread William Dunlap
> Error in checkForRemoteErrors(val) :
>   one node produced an error: (converted from warning)
> 'D:\_pgf\quantile_analysis2_f13\_save\dbz084_nump48\bins' already exists

That warning looks like it comes from dir.create().  Do you have
code that looks like:
   if (!file.exists(tempDir)) {
  dir.create(tempDir)
   }
If so that could be the problem.  The directory may not exist when file.exists()
is called but by the time dir.create is called another process may have created
it.  Try replacing such code with
suppressWarnings(dir.create(tempDir))
if (!isTRUE(file.info(tempDir)$isdir)) {
stop("Cannot create tempDir=", tempDir)
}


Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf
> Of Rguy
> Sent: Monday, July 01, 2013 1:07 AM
> To: r-help@r-project.org
> Subject: [R] Parallel processing random 'save' error
> 
> Platform: Windows 7
> Package: parallel
> Function: parLapply
> 
> I am running a lengthy program with 8 parallel processes running in main
> memory.
> The processes save data using the 'save' function, to distinct files so
> that no conflicts writing to the same file are possible.
> I have been getting errors like the one shown below on a random basis,
> i.e., sometimes at one point in the execution, sometimes at another,
> sometimes no error at all.
> I should note that the directory referred to in the error message
> ( 'D:\_pgf\quantile_analysis2_f13\_save\dbz084_nump48\bins') contains, as I
> write, 124 files saved to it by the program without any error; which
> underscores the point that most of the time the saves occur with no problem.
> 
> Error in checkForRemoteErrors(val) :
>   one node produced an error: (converted from warning)
> 'D:\_pgf\quantile_analysis2_f13\_save\dbz084_nump48\bins' already exists
> 
> Enter a frame number, or 0 to exit
> 
>  1: main_top(9)
>  2: main_top.r#26: eval(call_me)
>  3: eval(expr, envir, enclos)
>  4: quantile_analysis(2)
>  5: quantile_analysis.r#69: run_all(layr, prjp, np, rules_tb, pctiles_tb,
> parx, logdir, logg)
>  6: run_all.r#73: parLapply(cl, ctrl_all$vn, qa1, prjp, dfr1, "iu__bool",
> parx, logdir, tstamp)
>  7: do.call(c, clusterApply(cl, x = splitList(X, length(cl)), fun = lapply,
> fun, ...), quote = TRUE)
>  8: clusterApply(cl, x = splitList(X, length(cl)), fun = lapply, fun, ...)
>  9: staticClusterApply(cl, fun, length(x), argfun)
> 10: checkForRemoteErrors(val)
> 11: stop("one node produced an error: ", firstmsg, domain = NA)
> 12: (function ()
> {
> error()
> utils::recover()
> })()
> 
> Following the latest error I checked the system's connections as follows:
> 
> Browse[1]> showConnections()
>description class  mode  text isopen   can read can
> write
> 3  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
>  "yes"
> 4  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
>  "yes"
> 5  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
>  "yes"
> 6  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
>  "yes"
> 7  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
>  "yes"
> 8  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
>  "yes"
> 9  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
>  "yes"
> 10 "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
>  "yes"
> Browse[1]>
> 
> It seems that the parallel processes might be sharing the same
> connection--or is it that they are utilizing connections that have the same
> name but are actually distinct because they are running in parallel?
> If the connections are the problem, how can I force each parallel process
> to use a different connection?
> If the connections are not the problem, then can someone suggest a
> diagnostic I might apply to tease out what is going wrong? Or perhaps some
> program setting that I may have neglected to consider?
> 
> Thanks in advance for your help.
> 
>   [[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] Add constraints to rbinom

2013-07-01 Thread Meyners, Michael
You don't need a constraint (rbinom won't give x>n), but you need to make sure 
you are using the n you want to use: try
 x <- cbind(x,rbinom(300,n[i],p[i]))# mind the "[i]" after the n
at the respective line. Furthermore, you need to remove one transformation of x 
to make sure you divide by the right n, try
rate <- t(x/n)

I think that should do the trick. I didn't check the remainder of the code, 
though.

HTH, Michael


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Anamika Chaudhuri
> Sent: Freitag, 28. Juni 2013 04:06
> To: r-help@r-project.org
> Subject: [R] Add constraints to rbinom
> 
> Hi:
> 
> I am trying to generate Beta-Binomial random variables and then calculate
> Binomial exact confidence intervals to the rate..I was wondering if I needed
> to add a constraint such that x<=n to it, how do I go about it. The reason is 
> I
> am getting data where x>n which is giving a rate>1. Heres my code:
> 
> set.seed(111)
> k<-63
> x<-NULL
> p<-rbeta(k,3,3)# so that the mean nausea rate is alpha/(alpha+beta)
> min<-10
> max<-60
> n<-as.integer(runif(k,min,max))
> for(i in 1:k)
> x<-cbind(x,rbinom(300,n,p[i]))
> x<-t(x)
> rate<-t(t(x)/n)
> se_rate<-sqrt(rate*(1-rate)/n)
> 
> 
> 
> # Exact Confidence Interval
> 
> l_cl_exact<-qbeta(.025,x,n-x+1)
> u_cl_exact<-qbeta(.975,x+1,n-x)
> 
> for (i in 1:63){
> 
> for (j in 1:300)
> {
> 
> if (x[i,j]==0)
> {
> l_cl_exact[i,j]<-0
> u_cl_exact[i,j]<-u_cl_exact[i,j]
> }
> else if (x[i,j]==n[i])
> {
> l_cl_exact[i,j]<-l_cl_exact[i,j]
> u_cl_exact[i,j]<-1
> }
> else
> l_cl_exact[i,j]<-l_cl_exact[i,j]
> u_cl_exact[i,j]<-u_cl_exact[i,j]
> 
> #print(c(i,j))
> 
> }
> }
> 
> 
> Really appreciate any help.
> Thanks
> Anamika
> 
> __
> 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] Gene expression clustering using several dependent samples

2013-07-01 Thread James C. Whanger
Hello Moritz,

You may want to take a look at
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3052263/ .  DeSantis et al.
(2009) identified different genomic profiles using  a Bayesian Latent Class
methodology.

Best,

James


On Sun, Jun 30, 2013 at 2:47 PM, Moritz Kebschull wrote:

> Dear list.
>
> I am looking at a dataset comprised of Affy images from disease-affected
> tissue samples that I am trying to cluster.
>
> The problem is that we have 2+ biopsies per study subject, and I am not
> sure how to best account for their dependency. In contrast to cancer
> samples, these biopsies differ to a certain extent in their disease
> severity, i.e. they are not perfect replicates, but share certain
> similarities since they are from the same person.
>
> I first tried to just cluster all available biopsies using
> ConsensusClusterPlus. However, this produced clusters of biopsies according
> to their disease severity - often with different samples from the same
> patient assigned to different clusters - and that´s not what I want. I am
> trying to identify different classes between subjects, not biopsies.
>
> For the diff exp analyses, we dealt with this issue by adding the patient
> as a random effect to the model. Could I do something similar using
> model-based clustering, perhaps also adding a variable for disease
> severity?
>
> As an alternative, I have explored aggregating all available samples per
> subject into one expression profile, and cluster the pattients using these
> aggregates. I am, however, not convinced that this is right, since this
> approach creates 'artificial' data.
>
> Does anyone have an idea?
>
> Many thanks,
>
> Moritz
>
> [[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.
>
>


-- 
*James C. Whanger*
*
*

[[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] Empty pdf

2013-07-01 Thread Adrian Trapletti

Thank you
Adrian

On 07/01/2013 03:04 PM, peter dalgaard wrote:

On Jul 1, 2013, at 14:35 , Adrian Trapletti wrote:


Dear all,

I am comparing "R CMD BATCH script.R" with running the following code snippet 
within R:

pdf("Rplots.pdf")
source("script.R")
dev.off()
q(save="no")

Among other things, one difference is that the former produces no Rplots.pdf while the 
latter produces an empty Rplots.pdf, if script.R does not contain "plotting" 
commands (R version 3.0.1, i486-pc-linux-gnu (32-bit)). What is the difference between 
the two with respect to pdf plotting?


Same as on the command line: If you type quartz() (or whatever is the default 
device for you), you get an empty window if no plotting follows. If you type 
plot(0:9), the quartz() device is opened for you and plotted into.

You could try

options(device=pdf)
source("script.R")
q(save="no")



--
Dr. Adrian Trapletti
Steinstrasse 9b
CH-8610 Uster
Switzerland

Phone : +41 (0) 44 9945630
Mobile : +41 (0) 79 1037131

Email : adr...@trapletti.org
WWW : www.trapletti.org

__
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] Empty pdf

2013-07-01 Thread peter dalgaard

On Jul 1, 2013, at 14:35 , Adrian Trapletti wrote:

> Dear all,
> 
> I am comparing "R CMD BATCH script.R" with running the following code snippet 
> within R:
> 
> pdf("Rplots.pdf")
> source("script.R")
> dev.off()
> q(save="no")
> 
> Among other things, one difference is that the former produces no Rplots.pdf 
> while the latter produces an empty Rplots.pdf, if script.R does not contain 
> "plotting" commands (R version 3.0.1, i486-pc-linux-gnu (32-bit)). What is 
> the difference between the two with respect to pdf plotting?


Same as on the command line: If you type quartz() (or whatever is the default 
device for you), you get an empty window if no plotting follows. If you type 
plot(0:9), the quartz() device is opened for you and plotted into.

You could try

options(device=pdf)
source("script.R")
q(save="no") 

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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.


[R] Empty pdf

2013-07-01 Thread Adrian Trapletti

Dear all,

I am comparing "R CMD BATCH script.R" with running the following code 
snippet within R:


pdf("Rplots.pdf")
source("script.R")
dev.off()
q(save="no")

Among other things, one difference is that the former produces no 
Rplots.pdf while the latter produces an empty Rplots.pdf, if script.R 
does not contain "plotting" commands (R version 3.0.1, i486-pc-linux-gnu 
(32-bit)). What is the difference between the two with respect to pdf 
plotting?


Best regards
Adrian

--
Dr. Adrian Trapletti
Steinstrasse 9b
CH-8610 Uster
Switzerland

Phone : +41 (0) 44 9945630
Mobile : +41 (0) 79 1037131

Email : adr...@trapletti.org
WWW : www.trapletti.org

__
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] Distance Measurement between probability distributions

2013-07-01 Thread Dzu
Dear R -Users,

I wanted to know about some existing functions (despite of euclidiean) to
compute the distance between multiple histograms.
I have found some examples like "kullbakc -Leibler DIvergenz" but the syntax
for this is not available?

Does anybody have an idea?
Thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/Distance-Measurement-between-probability-distributions-tp4670646.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] Male and female signs as subscript in plot

2013-07-01 Thread Prof Brian Ripley

On 01/07/2013 09:03, David Winsemius wrote:


On Jul 1, 2013, at 12:40 AM, Prof Brian Ripley wrote:


On 01/07/2013 03:19, Emily Weiser wrote:

Hello,

I'd like to add labels to my plot that include a male or female symbol as
subscript.
I'm working in Windows Vista and R 3.0.0.
I am able to add the male symbol to the plot as regular text (NOT as
subscript), e.g. with:
mtext("Male\u2642")
This displays the word "Male" followed by the male symbol on the plot.

But "\u2642" does not work when I try to put it as a subscript.
For example,
mtext(expression("Male"["\u2217"]))
successfully adds an asterisk as a subscript after the word "Male".
However,
mtext(expression("Male"["\u2642"]))
displays the word "Male" followed by a subscript of "", i.e. the
symbol is not displayed.

How can I make the male symbol show as a subscript?


You cannot use non-native text with plotmath.  The issue is not that you used a 
subscript but that you passed an expression() call and hence invoked plotmath.  
And the help does say

 In non-UTF-8 locales there is normally no support for symbols not
 in the languages for which the current encoding was intended.


After discovering in the documentation for ?points, ?plotmath, and ?Hershey 
that Hershey fonts which do support astrologic symbols cannot be used in 
plotmath expressions, my suggestion for a work-around is to use plotmath with a 
phantom() call ofappropriate length in the expression and then two calls to 
text with xpd=TRUE:

text( locator(1), "\\VE", vfont=c("sans serif","bold"), xpd=TRUE)  # Venus
text( locator(1), "\\MA", vfont=c("sans serif","bold"), xpd=TRUE)  # Mars

I suppose this might work with approapriate modifications to the positioned 
parameters of that function.


Yes, you could use text() in the margin, in which case (at least on 
windows()) you can use \u notation and don't need Hershey fonts.  I 
considered mentioning that, but the positioning is going to be really 
tricky to do programatically.





Many thanks for any suggestions!


Read all of ?plotmath.



Agree with Prof Ripley. If you are a bit slow as am I, it may take 3 or 4 
readings.
--

David Winsemius
Alameda, CA, USA




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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Lexical scoping is not what I expect

2013-07-01 Thread peter dalgaard

On Jun 30, 2013, at 14:35 , Duncan Murdoch wrote:

> On 13-06-29 11:58 PM, Greg Snow wrote:
>> If you want to write really confusing code it is possible to do:
>> 
>> `1` <- 2
>> 
>> `1` + 1
>> 
>> and things like that, but it is probably a good idea not to.
> 
> This is actually pretty simple, as the White Knight could tell you.  `1` is 
> what the name of 2 is called.  The name really is "2".  It's called "two", 
> but that's only what it's called.  It really is two.
> 
> Duncan Murdoch
> 

Don't you mean "1" and "one"? As in

> as.name("1")
`1`



-pd


>> 
>> 
>> On Fri, Jun 28, 2013 at 7:30 PM, Rolf Turner  wrote:
>> 
>>> On 29/06/13 02:54, John Fox wrote:
>>> 
 Dear Duncan and Steve,
 
 Since Steve's example raises it, I've never understood why it's legal to
 change the built-in global "constants" in R, including T and F. That just
 seems to me to set a trap for users. Why not treat these as reserved
 symbols, like TRUE, Inf, etc.?
 
>>> 
>>> I rather enjoy being able to set
>>> 
>>> pi <- 3
>>> 
>>> :-)
>>> 
>>> cheers,
>>> 
>>> Rolf Turner
>>> 
>>> 
>>> __**
>>> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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.


[R] Parallel processing random 'save' error

2013-07-01 Thread Rguy
Platform: Windows 7
Package: parallel
Function: parLapply

I am running a lengthy program with 8 parallel processes running in main
memory.
The processes save data using the 'save' function, to distinct files so
that no conflicts writing to the same file are possible.
I have been getting errors like the one shown below on a random basis,
i.e., sometimes at one point in the execution, sometimes at another,
sometimes no error at all.
I should note that the directory referred to in the error message
( 'D:\_pgf\quantile_analysis2_f13\_save\dbz084_nump48\bins') contains, as I
write, 124 files saved to it by the program without any error; which
underscores the point that most of the time the saves occur with no problem.

Error in checkForRemoteErrors(val) :
  one node produced an error: (converted from warning)
'D:\_pgf\quantile_analysis2_f13\_save\dbz084_nump48\bins' already exists

Enter a frame number, or 0 to exit

 1: main_top(9)
 2: main_top.r#26: eval(call_me)
 3: eval(expr, envir, enclos)
 4: quantile_analysis(2)
 5: quantile_analysis.r#69: run_all(layr, prjp, np, rules_tb, pctiles_tb,
parx, logdir, logg)
 6: run_all.r#73: parLapply(cl, ctrl_all$vn, qa1, prjp, dfr1, "iu__bool",
parx, logdir, tstamp)
 7: do.call(c, clusterApply(cl, x = splitList(X, length(cl)), fun = lapply,
fun, ...), quote = TRUE)
 8: clusterApply(cl, x = splitList(X, length(cl)), fun = lapply, fun, ...)
 9: staticClusterApply(cl, fun, length(x), argfun)
10: checkForRemoteErrors(val)
11: stop("one node produced an error: ", firstmsg, domain = NA)
12: (function ()
{
error()
utils::recover()
})()

Following the latest error I checked the system's connections as follows:

Browse[1]> showConnections()
   description class  mode  text isopen   can read can
write
3  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
 "yes"
4  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
 "yes"
5  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
 "yes"
6  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
 "yes"
7  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
 "yes"
8  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
 "yes"
9  "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
 "yes"
10 "<-LAPTOP_32G_01:11741" "sockconn" "a+b" "binary" "opened" "yes"
 "yes"
Browse[1]>

It seems that the parallel processes might be sharing the same
connection--or is it that they are utilizing connections that have the same
name but are actually distinct because they are running in parallel?
If the connections are the problem, how can I force each parallel process
to use a different connection?
If the connections are not the problem, then can someone suggest a
diagnostic I might apply to tease out what is going wrong? Or perhaps some
program setting that I may have neglected to consider?

Thanks in advance for your help.

[[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] Male and female signs as subscript in plot

2013-07-01 Thread David Winsemius

On Jul 1, 2013, at 12:40 AM, Prof Brian Ripley wrote:

> On 01/07/2013 03:19, Emily Weiser wrote:
>> Hello,
>> 
>> I'd like to add labels to my plot that include a male or female symbol as
>> subscript.
>> I'm working in Windows Vista and R 3.0.0.
>> I am able to add the male symbol to the plot as regular text (NOT as
>> subscript), e.g. with:
>> mtext("Male\u2642")
>> This displays the word "Male" followed by the male symbol on the plot.
>> 
>> But "\u2642" does not work when I try to put it as a subscript.
>> For example,
>> mtext(expression("Male"["\u2217"]))
>> successfully adds an asterisk as a subscript after the word "Male".
>> However,
>> mtext(expression("Male"["\u2642"]))
>> displays the word "Male" followed by a subscript of "", i.e. the
>> symbol is not displayed.
>> 
>> How can I make the male symbol show as a subscript?
> 
> You cannot use non-native text with plotmath.  The issue is not that you used 
> a subscript but that you passed an expression() call and hence invoked 
> plotmath.  And the help does say
> 
> In non-UTF-8 locales there is normally no support for symbols not
> in the languages for which the current encoding was intended.

After discovering in the documentation for ?points, ?plotmath, and ?Hershey 
that Hershey fonts which do support astrologic symbols cannot be used in 
plotmath expressions, my suggestion for a work-around is to use plotmath with a 
phantom() call ofappropriate length in the expression and then two calls to 
text with xpd=TRUE:

text( locator(1), "\\VE", vfont=c("sans serif","bold"), xpd=TRUE)  # Venus
text( locator(1), "\\MA", vfont=c("sans serif","bold"), xpd=TRUE)  # Mars

I suppose this might work with approapriate modifications to the positioned 
parameters of that function.

> 
>> Many thanks for any suggestions!
> 
> Read all of ?plotmath.
> 

Agree with Prof Ripley. If you are a bit slow as am I, it may take 3 or 4 
readings.
--

David Winsemius
Alameda, CA, USA

__
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] Male and female signs as subscript in plot

2013-07-01 Thread Prof Brian Ripley

On 01/07/2013 03:19, Emily Weiser wrote:

Hello,

I'd like to add labels to my plot that include a male or female symbol as
subscript.
I'm working in Windows Vista and R 3.0.0.
I am able to add the male symbol to the plot as regular text (NOT as
subscript), e.g. with:
mtext("Male\u2642")
This displays the word "Male" followed by the male symbol on the plot.

But "\u2642" does not work when I try to put it as a subscript.
For example,
mtext(expression("Male"["\u2217"]))
successfully adds an asterisk as a subscript after the word "Male".
However,
mtext(expression("Male"["\u2642"]))
displays the word "Male" followed by a subscript of "", i.e. the
symbol is not displayed.

How can I make the male symbol show as a subscript?


You cannot use non-native text with plotmath.  The issue is not that you 
used a subscript but that you passed an expression() call and hence 
invoked plotmath.  And the help does say


 In non-UTF-8 locales there is normally no support for symbols not
 in the languages for which the current encoding was intended.


Many thanks for any suggestions!


Read all of ?plotmath.



Cheers,
Emily

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


No HTML postings please.


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Male and female signs as subscript in plot

2013-07-01 Thread Emily Weiser
Hello,

I'd like to add labels to my plot that include a male or female symbol as
subscript.
I'm working in Windows Vista and R 3.0.0.
I am able to add the male symbol to the plot as regular text (NOT as
subscript), e.g. with:
mtext("Male\u2642")
This displays the word "Male" followed by the male symbol on the plot.

But "\u2642" does not work when I try to put it as a subscript.
For example,
mtext(expression("Male"["\u2217"]))
successfully adds an asterisk as a subscript after the word "Male".
However,
mtext(expression("Male"["\u2642"]))
displays the word "Male" followed by a subscript of "", i.e. the
symbol is not displayed.

How can I make the male symbol show as a subscript?

Many thanks for any suggestions!

Cheers,
Emily

[[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] Gene expression clustering using several dependent samples

2013-07-01 Thread Moritz Kebschull
Dear list.

I am looking at a dataset comprised of Affy images from disease-affected
tissue samples that I am trying to cluster.

The problem is that we have 2+ biopsies per study subject, and I am not
sure how to best account for their dependency. In contrast to cancer
samples, these biopsies differ to a certain extent in their disease
severity, i.e. they are not perfect replicates, but share certain
similarities since they are from the same person.

I first tried to just cluster all available biopsies using
ConsensusClusterPlus. However, this produced clusters of biopsies according
to their disease severity - often with different samples from the same
patient assigned to different clusters - and that´s not what I want. I am
trying to identify different classes between subjects, not biopsies.

For the diff exp analyses, we dealt with this issue by adding the patient
as a random effect to the model. Could I do something similar using
model-based clustering, perhaps also adding a variable for disease severity?

As an alternative, I have explored aggregating all available samples per
subject into one expression profile, and cluster the pattients using these
aggregates. I am, however, not convinced that this is right, since this
approach creates 'artificial' data.

Does anyone have an idea?

Many thanks,

Moritz

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