[R] try-error can not be test. Why?

2010-09-08 Thread telm8

Hi,

I am having some strange problem with detecting try-error. From what I
have read so far the following statement:


try( log(a) ) == try-error


should yield TRUE, however, it yields FALSE. I can not figure out why. Can
someone help?

Many thanks
-- 
View this message in context: 
http://r.789695.n4.nabble.com/try-error-can-not-be-test-Why-tp2531675p2531675.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] try-error can not be test. Why?

2010-09-08 Thread telm8

Thank worked! Thank you so much!!!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/try-error-can-not-be-test-Why-tp2531675p2531726.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] A basic question in model/formula specification

2010-09-04 Thread telm8

Hi,

I am currently trying to fit a multinomial logit model on my data. I have
tried to search for some example, and this is the one that I followed and
worked. 

http://www.ats.ucla.edu/stat/r/dae/mlogit.htm

However, I am having difficulties finding out the meaning of the model
specified in the following line:

mlogit.model- mlogit(brand~1|female+age, data = mldata, reflevel=1)

The main issue is the |. I found out that it means multi-part formula but
I have no idea what it means mathematically in this particular case. Can
anyone enlighten me?

Many thanks



-- 
View this message in context: 
http://r.789695.n4.nabble.com/A-basic-question-in-model-formula-specification-tp2526765p2526765.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] Problem with clusterCall, Error in checkForRemoteErrors(lapply(cl, recvResult)) :

2010-08-26 Thread telm8

Did anyone manage to have a look at this? I have now tried foreach with doMC
backen and multicore, but still no luck. If someone can help that would be
much appreciated!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-clusterCall-Error-in-checkForRemoteErrors-lapply-cl-recvResult-tp2338375p2340076.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] Problem with clusterCall, Error in checkForRemoteErrors(lapply(cl, recvResult)) :

2010-08-25 Thread telm8

Hi all,

I am trying to use snow package to do a parallel MCMC. I have read a few
guides and articles, the following is that I came up with.

When I run it I got the error message:
Error in checkForRemoteErrors(lapply(cl, recvResult)) : 
  4 nodes produced errors; first error: could not find function ui.Next

The data is a longitudinal data with few repeated readings on a number of
individuals. However, the response is organised in a vector rather than a
matrix. E.g. (y_11 , y_12 , y_13 , y_14 , y_21 , y_22 , ... , y_n1 , ... ,
y_nTn )^T

X , Z are covariates.

beta is a matrix of coefficients associated with X

C is the latent class membership indicator

sigma.sq is the diagonal elements of the covariance matrix of u, which is a
random effect parameter and the one I am trying to sample with the function.

sd is the diagonal elements of the covariance matrix of the proposal
distribution.

The following is the particular function:

ui.Full.Sample.Cluster = function( levels , Y , X , beta , Z , C , sigma.sq
, sd , burnin , iteration )
{
cluster = makeCluster( 4 , type = MPI);
clusterSetupRNG( cluster );

patients = unique( levels );

q = length( X[1,] );

u = ui.Ini( q , length( patients ) );

n = levels[ length(patients) ];

marker = levels == patients[1];

y = Y[ marker ];
x = X[ marker, ];
z = Z[ marker, ];

u[1,] = ui.1.Sample( u[1,] , y , x , beta , z , C[1] , sigma.sq , sd ,
burnin , iteration )$uFinal;

for( i in 2:n)
{
marker = levels == patients[i];

y = Y[ marker ];
x = X[ marker, ];
z = Z[ marker, ];

print( i );

u[i, ] = clusterCall( cluster , ui.1.Sample, u[i,] , y , x , 
beta , z ,
C[i] , sigma.sq , sd , burnin , iteration )$uFinal;

print( i );
}

stopCluster( cluster );

u;
}



If anyone could help that would be much appreciated! But big thanks for
taking your time to read the post!

TelM8
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-clusterCall-Error-in-checkForRemoteErrors-lapply-cl-recvResult-tp2338375p2338375.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] Problem with clusterCall, Error in checkForRemoteErrors(lapply(cl, recvResult)) :

2010-08-25 Thread telm8

Oh, I forgot to say, ui.Next() is a function I defined to sample from the
proposal distribution given the current state.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-clusterCall-Error-in-checkForRemoteErrors-lapply-cl-recvResult-tp2338375p2338378.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.