[R] mb.long {timecourse}

2012-03-29 Thread statfan
How do you identify the genes which are differentially expressed using the mb.long function? More specifically, in the fruitfly example (see below), we begin with an expression matrix containing 2000 genes. How do I obtain not only the proportion of differentially expressed genes, but also the su

[R] limma design matrix

2012-03-25 Thread statfan
I am trying to construct my design matrix needed in the {limma} function "lmfit" but am having trouble with the formula I am to specify in the function "model.matrix". Namely when to I use ~0 + factors (ex 1) vs ~-1 + factors (ex 2). Any clarification on this would be greatly appreciated. Thanks

Re: [R] hypergeometric function in ‘ mvtnorm’

2012-03-19 Thread statfan
Thanks for your advice. I actually meant to ask about the "pmvt" for the distribution function. Viewing the source code "pmvt" uses the function "mvt" which uses the function "probval" which sources the fortran code: Fortran("mvtdst", N = as.integer(n), NU = as.integer(df), LOWER = as.d

[R] hypergeometric function in ‘ mvtnorm’

2012-03-18 Thread statfan
Is there any way to know how the "dmvt" function computes the hypergeometric function needed in the calculation for the density of multivariate t distribution? -- View this message in context: http://r.789695.n4.nabble.com/hypergeometric-function-in-mvtnorm-tp4483730p4483730.html Sent from the

[R] try to silence errors

2011-12-22 Thread statfan
I am trying to use the dmt function in the package {mnormt}. Throughout my algorithm, the covariance matrix is sometime calculated to be singular. When attempting to calculate the dmt function with a covariance that is not positive definite, I would like it to return Inf or NaN instead of an erro

[R] breaking up n object into random groups

2011-12-02 Thread statfan
say n = 100 I want to partition this into 4 random groups wheren n1 + n2 + n3 + n4 = n and ni is the number of elements in group i. Thank you for you help -- View this message in context: http://r.789695.n4.nabble.com/breaking-up-n-object-into-random-groups-tp4147476p4147476.html Sent from the R

[R] tryCatch with integration

2011-10-30 Thread statfan
I am trying to compute the approximate numerical integration of the following expression using the integrate function: > (integrate(function(x) {log(1+x^2)*(1+x^2)^(-20.04543)},low,Inf)$val) Error in integrate(function(x) { : the integral is probably divergent which gives me an error. If

Re: [R] symmetric matrix multiplication

2011-10-23 Thread statfan
Thank you Dan and Ted for these helpful comments. I will implement this simple force symmetry code you suggested and make sure I familiarize with this floating-point calculation problem so I can recognize such issues in the future. -- View this message in context: http://r.789695.n4.nabble.com/sy

[R] symmetric matrix multiplication

2011-10-22 Thread statfan
I have a symmetric matrix B (17x17), and a (17x17) square matrix A. If do the following matrix multiplication I SHOULD get a symmetric matrix, however i don't. The computation required is: C = t(A)%*%B%*%A here are some checks for symmetry > (max(abs(B - t(B [1] 0 > C = t(A)%*%B%*%A > (max(

Re: [R] sampling from the multivariate truncated normal

2011-07-05 Thread statfan
Well, for 0.828324 < x[2] < Inf the probablility is roughly 0 hence not easy to draw random numbers out there Uwe Ligges How is this probability roughly 0? -- View this message in context: http://r.789695.n4.nabble.com/sampling-from-the-multivariate-truncated-normal-tp3626438p3647039.ht

[R] sampling from the multivariate truncated normal

2011-06-26 Thread statfan
I am trying generate a sample for a truncated multivariate normal distribution via the rtmvnorm function in the {tmvtnorm} package. Why does the following produce NaNs? rtmvnorm(1, mean = rep(0, 2), matrix(c(0.06906084, -0.07463565, -0.07463565, 0.08078086),2),c(-0.4316738, 0.8283240), c(Inf,

[R] rtmvt

2011-05-30 Thread statfan
I want to use the rtmvt from the {tmvtnorm} package using the "gibbs" algorithm but how to i specify the nested function rtmvnorm to use gibbs as well? Right now I am using the code: for (i in 1:g){ for (j in 1:n){ sgamma[,,i,j] = rtmvt(n=50, mean=

[R] rtmvt

2011-04-10 Thread statfan
I have been using the rtmvt function in the {tmvtnorm} package i'm getting the warning: "Acceptance rate is very low and rejection sampling becomes inefficient. Consider using Gibbs sampling." but i AM specifying the gibbs algorithm!!: rtmvt(M, mean=q[,,i,j], sigma=((u[i,j] + nu[i])/(p+nu[i]))*d

[R] multivariate t distribution

2011-04-06 Thread statfan
I have been working the the pmt function in the {mnormt} package and which requires "S a positive definite matrix representing the scale matrix of the distribution, such that S*df/(df-2) is the variance-covariance matrix when df>2; a vector of length 1 is also allowed (in this case, d=1 is

Re: [R] truncated distributions

2011-04-02 Thread statfan
The definition of the "mean vector" is essentially what my question boils down to. In the functions details, the author states "We sample x ~ T(mean, Sigma, df) subject to the rectangular truncation lower <= x <= upper. Currently, two random number generation methods are implemented: rejection sa

[R] truncated distributions

2011-04-02 Thread statfan
I am sampling from the truncated multivariate student t distribution "rtmvt" in the package {tmvtnorm}. My question is about the mean vector. Is it possible to define a mean vector outside of the truncated region? Thank you in advance for any help. -- View this message in context: http://r.78969

[R] pmt

2011-03-27 Thread statfan
I am working with the pmt function in the {mnormt} package, and i am getting negative values returned. the following is an example of one of my outputs: pmt(x = c(3.024960, -1.010898), mean = c(21.18844, 21.18844), S = matrix(c(.319,.139,.139,0.319), 2, 2),df = 42) # -6.585641e-18 Any help on wh