Re: [R] HLM Model

2011-01-27 Thread Belle
Hi Harold: Yes, this was the R code that I tried, and got different result from SAS. Is that mean I cannot actually use R to run unstructured covariance matrix? How can I solve this problem if I need an unstructured covariance matrix method? Thanks for the help. -- View this message in

Re: [R] HLM Model

2011-01-27 Thread Doran, Harold
Belle: Before I provide any more help, you'll need to follow some posting guide rules and describe what you have done with some R code, describe what the problem is, and describe what you are hoping to accomplish. The fact that the results you get from R and SAS are different doesn't mean

[R] Adding image to plotting area

2011-01-27 Thread Dario Strbenac
Hello, I've drawn a black rectangle over the plotting area, and when I add an image() heatmap, it doesn't take up all the area, but is set inward from the black rectangle. Can anyone suggest how to make it stretch out to the entire area ? Minimal example : y - matrix(runif(2000*20), nrow =

Re: [R] agnes clustering and NAs

2011-01-27 Thread Dario Strbenac
Hello, Yes, that's right, it is a values matrix. Not a dissimilarity matrix. i.e. str(iMatrix) num [1:23371, 1:56] -0.407 0.198 NA -0.133 NA ... - attr(*, dimnames)=List of 2 ..$ : NULL ..$ : chr [1:56] -8100 -7900 -7700 -7500 ... For the snippet of checking for NAs, I get all TRUEs, so

Re: [R] possible bug in packageVersion()?

2011-01-27 Thread dicko ahmadou
May be this problem is OS specific (mac OS or windows...) i use ubuntu and have no problem with this function R packageVersion(base) [1] ‘2.12.1’ R packageVersion('lme4') [1] ‘0.999375.37’ R sessionInfo() R version 2.12.1 (2010-12-16) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1]

[R] subloop - flexible coding - variable number of loops

2011-01-27 Thread Peter Jaksons
Hello, I want to create a flexible code for the following example: In stead of using a different code for each n (as in my example below), I want to write a general code for every n (n from 1 to 10). I tried a lot of things, but I always got stuck with the number of subloops or witch closing

[R] sapply puzzlement

2011-01-27 Thread Ernest Adrogué i Calveras
Hi, I have this data.frame with two variables in it, z V1 V2 1 10 8 2 NA 18 3 9 7 4 3 NA 5 NA 10 6 11 12 7 13 9 8 12 11 and a vector of means, means - apply(z, 2, function (col) mean(na.omit(col))) means V1V2 9.67 10.714286 My intention was substracting means

Re: [R] HLM Model

2011-01-27 Thread Belle
Hi Harold: I know the outputs are different between SAS and R, but the results that I got have big difference. Here is part of the result based on the SAS code I provided earlier: Cov Parm SubjectEstimate Error Value Pr Z

Re: [R] sapply puzzlement

2011-01-27 Thread David A. Johnston
sapply(z, function(row) ...) does not actually grab a row at a time out of 'z'. It grabs a column (because 'z' is a data.frame) You may want: t(apply(z, 1, function(row) row - means)) or: t(t(z) - means) Hope that helps, -David Johnston -- View this message in context:

Re: [R] HLM Model

2011-01-27 Thread Jeremy Miles
The empirical statement on the proc mixed line gives you robust standard errors, I don't think you get them in R. In SAS you specify that the predictors are to be dummy coded using the class . Are they factors in R? I can't tell from the SAS output, because the formatting has been lost.

Re: [R] sapply puzzlement

2011-01-27 Thread David Winsemius
On Jan 27, 2011, at 7:16 PM, Ernest Adrogué i Calveras wrote: Hi, I have this data.frame with two variables in it, z V1 V2 1 10 8 2 NA 18 3 9 7 4 3 NA 5 NA 10 6 11 12 7 13 9 8 12 11 and a vector of means, means - apply(z, 2, function (col) mean(na.omit(col))) means V1

Re: [R] Problem with factor analysis

2011-01-27 Thread Juliet Hannah
It looks like the text didn't show assigning the results of factanal to an object. Try: pgdata-read.table(pgfull.txt,header=T) names(pgdata) pgd-pgdata[,1:54] #missing line model - factanal(pgd,8) par(mfrow=c(2,2)) plot(loadings(model)[,1],loadings(model)[,2],pch=16,xlab=Factor 1,ylab=Factor 2)

Re: [R] sapply puzzlement

2011-01-27 Thread Pete Brecknock
In addition to what has already been suggested you could use .. mapply(function(x,y) x-y, z,means) which returns V1 V2 [1,] 0.333 -2.7142857 [2,] NA 7.2857143 [3,] -0.667 -3.7142857 [4,] -6.667 NA [5,] NA -0.7142857 [6,]

Re: [R] Quantile regression (rq) and complex samples

2011-01-27 Thread Thomas Lumley
You could use the survey package to run the bootstrapping, if you mean the Rao Wu bootstrap that samples n-1 of n PSUs in each replicate. Set up a survey design object with bootstrap replicate weights: use svrepdesign() if you already have replicate weights, use svydesign() and then

Re: [R] sapply puzzlement

2011-01-27 Thread Dario Strbenac
R works by going down the columns. If you make the rows into columns, it then does what you want. You just have to make the columns back into rows to get the original shape of your matrix. So the code in one line is : t(t(z) - means) Original message Date: Fri, 28 Jan 2011 01:16:45

[R] There must be a smarter way

2011-01-27 Thread eric
Newbie and trying to learn the right way of doing things in R. in this case, I just have that feeling that my convoluted line of code is way more complicated than it needs to be. Please help me in seeing the easier way. I want to do something pretty simple. I have a dataframe called x that is

Re: [R] Problem converting zoo object (daily data) to a timeSeries object

2011-01-27 Thread Gabor Grothendieck
On Thu, Jan 27, 2011 at 11:56 AM, John E. Kaprich jkapr...@gmail.com wrote: When I try to convert the zoo object to a timeSeries object, which would allow me to utilize Rmetrics packages, I get an error message. Data-read.zoo(c:\\DOWUBSPRICING.txt,na.strings=NA,sep=\t,header=T) is(Data)

Re: [R] Meaning of pterms in survreg object?

2011-01-27 Thread Johannes Huesing
David Winsemius dwinsem...@comcast.net [Thu, Jan 27, 2011 at 10:08:00PM CET]: You got a perfectly sensible reply from Thereau, the author of the package, a day after your posting and then failed to respond to his questions. I'm not sure what more you are expecting. My apologies. Next time

Re: [R] There must be a smarter way

2011-01-27 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of eric Sent: Thursday, January 27, 2011 7:07 PM To: r-help@r-project.org Subject: [R] There must be a smarter way Newbie and trying to learn the right way of doing things in

Re: [R] Meaning of pterms in survreg object?

2011-01-27 Thread David Winsemius
On Jan 28, 2011, at 12:37 AM, Johannes Huesing wrote: David Winsemius dwinsem...@comcast.net [Thu, Jan 27, 2011 at 10:08:00PM CET]: You got a perfectly sensible reply from Thereau, the author of the package, a day after your posting and then failed to respond to his questions. I'm not sure

Re: [R] subloop - flexible coding - variable number of loops

2011-01-27 Thread David Winsemius
On Jan 27, 2011, at 6:29 PM, Peter Jaksons wrote: Hello, I want to create a flexible code for the following example: In stead of using a different code for each n (as in my example below), I want to write a general code for every n (n from 1 to 10). Have you done any thinking about the

[R] Help with ape - read.GenBank()

2011-01-27 Thread James Meadow
Hi, I am trying to work with the ape package, and there is one thing I am struggling with. When calling the *read.GenBank()* function, I can get it to work with an object created like this: *x - c(AY395554,AY611035, ...)* *read.GenBank(x)* However, I am trying to use the function to fetch

[R] Principal coordinate analysis

2011-01-27 Thread Julie Smith
Could someone please help me with instructions on running a principal coordinate analysis using R? Julie Smith Sent from my iPod __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Please help -- Converting a 2D matrix to 3 columns for graphical representation

2011-01-27 Thread kparamas
Hi, I am trying to convert a 2D correlation matrix to 3 columns for graphical representation: rdata = replicate(100, rnorm(15)) #construct a 2D matrix c1 = cor(rdata) #outputs a correlation matrix Now I want to convert the 2D c1 to (row#, col#, correlation) 1 1 cor1 1 2 cor2 1 3 cor3 ... 2 1

[R] read.table() versus scan()

2011-01-27 Thread H Roark
I need to import a large number of simple, space-delimited text files with a few columns of data each. The one quirk is that some rows are missing data and some contain junk text at the end of each line. A typical file might look like: a b c d 1 2 3 x 4 5 6 7 8 9 x 1 2 3 x c c 4 5 6 x 7 8 9 x

[R] Boxplot

2011-01-27 Thread Ramya
Hi, I have 25 normal and 25 tumor samples and generated 50 boxplots one for each Is there a possibility to alternate the colors for the boxplots Green Red Green Red. Example: A B C D 10 23 23 34 20 24 24 30 20 2434 34 this would generate 4 boxplot one for each. I want the boxplot

Re: [R] Principal coordinate analysis

2011-01-27 Thread Prof Brian Ripley
On Thu, 27 Jan 2011, Julie Smith wrote: Could someone please help me with instructions on running a principal coordinate analysis using R? ?cmdscale Julie Smith -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/

<    1   2