[R] [] and escaping in regular expressions

2013-09-24 Thread Juliet Hannah
Is it correct that one does not need to escape special characters such as * (are these properly called metacharacters) inside []. If so, what is the logic to this? mytest - he*llo sub([*],,mytest) sub(\\*,,mytest) [] is easier to read for me than \\. Is this what people tend to use? Thanks.

Re: [R] mgcv: how select significant predictor vars when using gam(...select=TRUE) using automatic optimization

2013-04-24 Thread Juliet Hannah
Hi Jan and Simon, If possible, could you attach the diagnostic plots. I would be curious to see them. Thanks, Juliet On Fri, Apr 19, 2013 at 4:39 AM, jholstei jan.holst...@awi.de wrote: Simon, that was very instructive—very special thanks to you. I already noticed that the model was bad,

Re: [R] Speeding reading of a large file

2012-12-06 Thread Juliet Hannah
All, Can someone describe what x[] - lapply(x, as.numeric) I see that it is putting the list elements into a data frame. The results for lapply are a list, so how does this become a data frame. Thanks, Juliet On Mon, Dec 3, 2012 at 5:49 PM, Fisher Dennis fis...@plessthan.com

Re: [R] Speeding reading of a large file

2012-12-06 Thread Juliet Hannah
: Hello, Because x[] keeps the dimensions, unlike just x. Hope this helps, Rui Barradas Em 06-12-2012 16:24, Juliet Hannah escreveu: All, Can someone describe what x[] - lapply(x, as.numeric) I see that it is putting the list elements into a data frame. The results for lapply

Re: [R] testing parallel slopes assumption for Ordinal Logistic Regression

2012-05-04 Thread Juliet Hannah
See the post by Frank Harrell at: http://groups.google.com/group/medstats/browse_thread/thread/cbff7871179e9508?pli=1 or google regrouping to satisfy proportional odds On Tue, May 1, 2012 at 2:14 AM, 80past2 benny...@gmail.com wrote: Hi everyone, I'm a bit new here (and new to R), and I was

[R] resampling syntax for caret package

2012-04-06 Thread Juliet Hannah
Max and List, Could you advise me if I am using the proper caret syntax to carry out leave-one-out cross validation. In the example below, I use example data from the rda package. I use caret to tune over a grid and select an optimal value. I think I am then using the optimal selection for

[R] glmnet: obtain predictions using predict and also by extracting coefficients

2012-03-21 Thread Juliet Hannah
, but the scaling is also off, which suggests a bigger mistake. Thanks for your help. Juliet Hannah library(ElemStatLearn) library(glmnet) data(prostate) # training data data.train - prostate[prostate$train,] y - data.train$lpsa # isolate predictors data.train - as.matrix(data.train[,-c(9,10

Re: [R] glmnet: obtain predictions using predict and also by extracting coefficients

2012-03-21 Thread Juliet Hannah
Oops. Coefficients are returned on the scale of the original data. testX - cbind(1,data.test) yhat2 - testX %*% beta # works plot(yhat2,yhat_enet) On Wed, Mar 21, 2012 at 2:35 PM, Juliet Hannah juliet.han...@gmail.com wrote: All, For my understanding, I wanted to see if I can get glmnet

Re: [R] Normalization in R

2012-01-24 Thread Juliet Hannah
For quantile normalization check out normalize.quantiles in the Biocondcutor preProcess package. Also, there is a Bioconductor mailing list for future where these topics are discussed. http://svitsrv25.epfl.ch/R-doc/library/preprocessCore/html/normalize.quantiles.html On Sat, Jan 21, 2012 at

Re: [R] Bioconductor. MA plot for qPCR array

2011-12-15 Thread Juliet Hannah
You may find the following discussion helpful. http://comments.gmane.org/gmane.science.biology.informatics.conductor/37388 On Sun, Dec 11, 2011 at 8:08 AM, ali_protocol mohammadianalimohammad...@gmail.com wrote: Dear all, Is there anyway too generate MA plot for 2 qPCR assays (an array of 2x

[R] aggregate syntax for grouped column means

2011-11-29 Thread Juliet Hannah
I am calculating the mean of each column grouped by the variable 'id'. I do this using aggregate, data.table, and plyr. My aggregate results do not match the other two, and I am trying to figure out what is incorrect with my syntax. Any suggestions? Thanks. Here is the data. myData -

Re: [R] Reading a specific column of a csv file in a loop

2011-11-15 Thread Juliet Hannah
In the solution below, what is the advantage of using 0L. M0 - read.csv(M1.csv, nrows = 1)[0L, ] Thanks! 2011/11/8 Gabor Grothendieck ggrothendi...@gmail.com: 2011/11/8 Sergio René Araujo Enciso araujo.enc...@gmail.com: Dear all: I have two larges files with 2000 columns. For each file I

Re: [R] heritability estimation

2011-10-17 Thread Juliet Hannah
Search: mcmcglmm heritability to see some discussions using the mcmcglmm package. This package is discussed often on the mixed model list. You can also use the kinship package. It will take some time to get familiar with R. Work through a few of the examples for variance component models, and then

Re: [R] expression set (Bioconductor) problem

2011-10-09 Thread Juliet Hannah
Note that exprs returns a matrix, so we can manipulate that just as we would for any other type of matrix. There is also a Bioconductor mailing list, which may be helpful. On Thu, Oct 6, 2011 at 4:56 AM, Clayton K Collings ccoll...@purdue.edu wrote: Hello R people, dim(exprs(estrogenrma) I

Re: [R] Printing an xtable with type = html

2011-10-01 Thread Juliet Hannah
Maybe some of the comments in this post may be informative to you: http://r.789695.n4.nabble.com/improve-formatting-of-HTML-table-td3736299.html On Wed, Sep 28, 2011 at 6:21 AM, David Scott d.sc...@auckland.ac.nz wrote: I have been playing around with producing tables using xtable and the type

[R] sqldf syntax, selecting rows, and skipping

2011-09-29 Thread Juliet Hannah
I am using the example in this post: https://stat.ethz.ch/pipermail/r-help/2010-October/257204.html # create a file write.table(iris,iris.csv,row.names=FALSE,sep=,,quote=FALSE) # this does not work # has the syntax changed or is there a mistake in my usage? # the line from the post above is:

Re: [R] error building package: packaging into .tar.gz failed

2011-09-07 Thread Juliet Hannah
Workshop was at the beginning. With this, my attempts at package creation worked. On Thu, Jun 30, 2011 at 12:51 PM, Juliet Hannah juliet.han...@gmail.com wrote: I am trying to build a package using windows xp. Here is the error I am getting: R CMD build myfunctions * checking for file

[R] formatting a 6 million row data set; creating a censoring variable

2011-08-31 Thread Juliet Hannah
List, Consider the following data. gender mygroup id 1 F A 1 2 F B 2 3 F B 2 4 F B 2 5 F C 2 6 F C 2 7 F C 2 8 F D 2 9 F D 2 10 F D 2 11 F D 2 12 F

[R] data manipulation and summaries with few million rows

2011-08-24 Thread Juliet Hannah
I have a data set with about 6 million rows and 50 columns. It is a mixture of dates, factors, and numerics. What I am trying to accomplish can be seen with the following simplified data, which is given as dput output below. head(myData) mydate gender mygroup id 1 2012-03-25 F

Re: [R] data manipulation and summaries with few million rows

2011-08-24 Thread Juliet Hannah
= length(rle(mygroup)$lengths) - 1), by = 'id']   # ditto HTH, Dennis On Wed, Aug 24, 2011 at 9:48 AM, Juliet Hannah juliet.han...@gmail.com wrote: I have a data set with about 6 million rows and 50 columns. It is a mixture of dates, factors, and numerics. What I am trying to accomplish

Re: [R] getting names of dimnames of xtabs into xtable latex output

2011-08-18 Thread Juliet Hannah
Thanks to Duncan Mackay and Dennis Murphy for help. The following solution seems to give me what I need. library(memisc) toLatex(ftable(cyl ~ am,data=mtcars)) For this to work, we have to use: \documentclass{article} \usepackage{booktabs} \usepackage{dcolumn} \begin{document} at the beginning

Re: [R] getting names of dimnames of xtabs into xtable latex output

2011-08-17 Thread Juliet Hannah
Thanks for the suggestion, Duncan. However, I was trying to maintain the contingency table/cross-classification structure of the original table. My use of xtable on this table, maintains the structure I want, but the labels for the rownames and colum names is lost. On Tue, Aug 16, 2011 at

[R] getting names of dimnames of xtabs into xtable latex output

2011-08-16 Thread Juliet Hannah
In R, the output of xtabs displays the names of the dimnames. In the example below, these are change_diet and mydiet. Is there a way to have xtable incorporate these names directly into the latex output. Thanks for your help. table2 - structure(c(26, 0, 40, 0, 10, 0, 188, 0, 281, 0), .Dim =

[R] improve formatting of HTML table

2011-08-11 Thread Juliet Hannah
I am trying to improve the look of an HTML table for a report (that needs to be pasted into Word). Here is an example. table2 - structure(c(26L, 0L, 40L, 0L, 10L, 0L, 0L, 188L, 0L, 281L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 4L), .Dim = c(6L, 3L), .Dimnames = structure(list( myvar = c(Don't know,

Re: [R] suggestions regarding reading in a messy file

2011-07-13 Thread Juliet Hannah
...@comcast.net wrote: On Jul 12, 2011, at 4:37 PM, Juliet Hannah wrote: I have a file in stata format, which I have read in, and I am trying to create a text file. I have exported the data using various delimiters, but I'm unable to read it back in. I originally read in the file

[R] suggestions regarding reading in a messy file

2011-07-12 Thread Juliet Hannah
I have a file in stata format, which I have read in, and I am trying to create a text file. I have exported the data using various delimiters, but I'm unable to read it back in. I originally read in the file with: library(foreign) myData - read.dta(mydata.dta) I then exported it with write.table

Re: [R] deming regresion to make 2 variables comparable

2011-07-11 Thread Juliet Hannah
See if the following thread http://www.mail-archive.com/r-help@r-project.org/msg85070.html and the paper cited in it are helpful. Terry Therneau provides code for a Deming regression. On Thu, Jul 7, 2011 at 12:58 PM, devon woodcomb d.woodco...@gmail.com wrote: Hi, I have a dataset which

[R] error building package: packaging into .tar.gz failed

2011-06-30 Thread Juliet Hannah
I am trying to build a package using windows xp. Here is the error I am getting: R CMD build myfunctions * checking for file 'myfunctions/DESCRIPTION' ... OK * preparing 'myfunctions': * checking DESCRIPTION meta-information ... OK * checking for LF line-endings in source and make files *

[R] indexing with which, logical indexing, and missing values

2011-06-28 Thread Juliet Hannah
I have a data frame in which missing values exist, and I need to recode the string missing to a missing value. For the example, let's assume I cannot do this while reading it in. Even though this has been discussed extensively, I'm still a little confused about when to index with which and when to

Re: [R] Help on selecting genes showing highest variance

2011-06-10 Thread Juliet Hannah
# Let's say your expression data is in a matrix # named expression in which the rows are genes # and the columns are samples myvars - apply(expression,1, var,na.rm=TRUE) myvars - sort(myvars,decreasing=TRUE) myvars - myvars[1:200] expression - expression[names(myvars),] dim(expression) Also

Re: [R] Subsetting a data frame by dropping correlated variables

2011-04-27 Thread Juliet Hannah
The 'findCorrelation' function in the caret package may be helpful. On Tue, Apr 19, 2011 at 3:10 PM, Rita Carreira ritacarre...@hotmail.com wrote: Hello R Users! I have a data frame that has many variables, some with missing observations, and some that are correlated with each other. I

Re: [R] GLM output for deviance and loglikelihood

2011-04-20 Thread Juliet Hannah
As you mentioned, the deviance does not always reduce to: D = -2(loglikelihood(model)) It does for ungrouped data, such as for binary logistic regression. So let's stick with the original definition. In this case, we need the log-likelihood for the saturated model. x = rnorm(10) y =

Re: [R] no solution yet, please help: extract p-value from mixed model in kinship package

2011-04-18 Thread Juliet Hannah
Maybe the pedigree is not set up correctly. If this is the case, the kinship matrix will not be constructed correctly. I see that in this example, the diagonal terms differ. diag(kmat) lmekin runs fine for me, and I can extract p-values with: lmekinfit - lmekin(...) pval -

Re: [R] converting affybatch object to matrix

2011-04-04 Thread Juliet Hannah
Use exprs on the output from RMA (or another method you like) library(affy) myData -ReadAffy() myRMA - rma(myData) e = exprs(myRMA) Also, check out the Bioconductor mailing list where Bioconductor-related topics are discussed. On Fri, Apr 1, 2011 at 9:54 AM, Landes, Ezekiel

Re: [R] About proportional odds ratio model with LASSO in ordinal regression

2011-03-27 Thread Juliet Hannah
If you can work with a different penalty check out the lrm function from the rms package, which uses penalized likelihood to fit proportional odds. 2011/3/24 Jheng-Jhong Wang iiamba...@gmail.com: Dear R-users,         I try to fit proportional odds ratio model with LASSO in ordinal

Re: [R] covar

2011-02-20 Thread Juliet Hannah
Relatedness if often defined in terms of the kinship matrix. It may be helpful to search for this. Several packages in R use this matrix including the kinship package. On Wed, Feb 16, 2011 at 3:14 PM, Val valkr...@gmail.com wrote: Hi all, I want to construct relatedness among individuals and

Re: [R] series of boxplots

2011-02-11 Thread Juliet Hannah
If you could provide a small example of an actual data set (using dput), you may get some suggestions specific to your goals. Here are a few examples of boxplots. If these look along the lines of what you are looking for, you may want to search the ggplot2 mailing list for more examples.

Re: [R] GWAF package: lme.batch.imputed(): object 'kmat' not found

2011-02-07 Thread Juliet Hannah
GWAF uses the kinship package. The documentation is pretty good for it, and I've used it successfully. It may be helpful to get that working before trying automate some tasks using GWAF. On Fri, Feb 4, 2011 at 2:20 PM, Jim Moon moo...@ohsu.edu wrote: Hello, All, GWAF 1.2 R.Version() is below.

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] Heat map in R

2011-01-09 Thread Juliet Hannah
Make sure your data is a matrix. There are many examples of expression heatmaps available on the bioconductor list. After checking out these examples, I would post to the bioconductor list if you are still having problems. Also consider a small example to get you a working heatpmap. You have to

Re: [R] how to add frequencies to barplot

2010-11-23 Thread Juliet Hannah
Also check out the following post: http://permalink.gmane.org/gmane.comp.lang.r.general/210897 On Sat, Nov 20, 2010 at 4:32 PM, casperyc caspe...@hotmail.co.uk wrote: Hi, I have count data x2=rep(c(0:3),c(13,80,60,27)) x2  0  1  2  3 13 80 60 27 I want to graph to be ploted as

Re: [R] Number above the bar?

2010-11-14 Thread Juliet Hannah
Check out ggplot2, specifically geom_bar and geom_text. http://had.co.nz/ggplot2/ You have to get used to its syntax, which can take some time, but after that it can make things a lot easier. Here is an example. library(ggplot2) df - data.frame(xvar = factor(c(1, 2)), yvar = c(1, 5)) p -

Re: [R] Ordered logit with polr won't match SPSS output

2010-09-30 Thread Juliet Hannah
I think the most common reason to see different parameter estimates with ordinal regression is that programs set up the model differently. For example, check out library(MASS) ?polr We see polr uses: logit P(Y = k | x) = zeta_k - eta and notes that other software packages may use the opposite

Re: [R] post

2010-09-18 Thread Juliet Hannah
See if rowttests is any faster. library(genefilter) ?rowttests You have to install Bioconductor. I've used this on large datasets, but I haven't compared timings. On Mon, Sep 13, 2010 at 4:26 PM, Alexey Ush usha...@yahoo.com wrote: Hello, I have a question regarding how to speed up the

Re: [R] R Founding

2010-09-16 Thread Juliet Hannah
Hi Group, I have a possibly naive question, but it seems like it fits into this discussion. I have observed that when researchers publish findings that are deemed to be high-impact, generous funding often follows. R is used everywhere, and, of course, for many of these projects. So my naive

[R] average columns of data frame corresponding to replicates

2010-09-07 Thread Juliet Hannah
Hi Group, I have a data frame below. Within this data frame there are samples (columns) that are measured more than once. Samples are indicated by idx. So id1 is present in columns 1, 3, and 5. Not every id is repeated. I would like to create a new data frame so that the repeated ids are

[R] error possibly related to sweave, path, and spaces on windows

2010-08-21 Thread Juliet Hannah
I have downloaded a file that I don't know how to describe correctly. It contains R code and Latex, and I should be able to reproduce an analysis by running an R script in this folder. There is a line in the R script: junk - system(paste(/usr/texbin/pdflatex ,latexFiles[i1]),

Re: [R] error possibly related to sweave, path, and spaces on windows

2010-08-21 Thread Juliet Hannah
, Juliet Hannah wrote: I have downloaded a file that I don't know how to describe correctly. It contains R code and Latex, and I should be able to reproduce an analysis by running an R script in this folder. There is a line in the R script:   junk- system(paste(/usr/texbin/pdflatex ,latexFiles[i1

Re: [R] reading a text file, one line at a time

2010-08-18 Thread Juliet Hannah
Hi Jim, I was trying to use your template without success. With the toy data below, could you explain how to use this template to change all bs to zs -- just as an exercise, reading in 3 lines at a time. I need to use this strategy for a larger problem, but I haven't been able to get the basics

Re: [R] Lattice xyplots plots with multiple lines per cell

2010-08-16 Thread Juliet Hannah
You may want to check out examples in lattice and ggplot2. Both of these make plotting subsets much easier. I can't remember the lattice syntax off the top of my head, but if you post some example data – either by creating it or using dput – people will be able to help out easier. Here is some

[R] partial match of one column in data frame to another character vector

2010-08-10 Thread Juliet Hannah
Here is some data (dput output below) myData id group 1 D599 A 2 002-0004 B 3 F01932

[R] replace negative numbers by smallest positive value in matrix

2010-07-15 Thread Juliet Hannah
Hi Group, I have a matrix, and I would like to replace numbers less than 0 by the smallest minimum number. Below is an small matrix, and the loop I used. I would like to get suggestions on the R way to do this. Thanks, Juliet # example data set mymat - structure(c(-0.503183609420937,

Re: [R] replace negative numbers by smallest positive value in matrix

2010-07-15 Thread Juliet Hannah
, Juliet Hannah wrote: Hi Group, I have a matrix, and I would like to replace numbers less than 0 by the smallest minimum number. Below is an small matrix, and the loop I used. I would like to get suggestions on the R way to do this. Thanks, Juliet # example data set mymat - structure(c

Re: [R] long to wide on larger data set

2010-07-14 Thread Juliet Hannah
), by=list(V2) ] Why you you need to reshape from long to wide ? HTH, Matthew Juliet Hannah juliet.han...@gmail.com wrote in message news:aanlktinyvgmrvdp0svc-fylgogn2ro0omnugqbxx_...@mail.gmail.com... Hi Jim, Thanks for responding. Here is the info I should have included before. I should

Re: [R] long to wide on larger data set

2010-07-12 Thread Juliet Hannah
. This would be impossible on a 32-bit version of R. On Mon, Jul 12, 2010 at 1:25 AM, Juliet Hannah juliet.han...@gmail.com wrote: I have a data set that has 4 columns and 53860858 rows. I was able to read this into R with: cc - rep(character,4) myData - read.table(myData.csv,header=FALSE

[R] long to wide on larger data set

2010-07-11 Thread Juliet Hannah
I have a data set that has 4 columns and 53860858 rows. I was able to read this into R with: cc - rep(character,4) myData - read.table(myData.csv,header=FALSE,skip=1,colClasses=cc,nrow=53860858,sep=,) I need to reshape this data from long to wide. On a small data set the following lines work.

Re: [R] logistic regression - glm() - example in Dalgaard's book ISwR

2010-07-03 Thread Juliet Hannah
You may find both of Alan Agresti's books on categorcial data analysis useful. Try googling both books and then search the word grouped within each book. Agresti refers to the difference you describe as grouped versus ungrouped data. The likelihoods differ and all summaries based on the likelihood

Re: [R] reg: R genetics problem

2010-06-23 Thread Juliet Hannah
I've used this package before, and it always gives me the message: NOTE: THIS PACKAGE IS NOW OBSOLETE. So I stopped using it. I just tried installing it and it gave me some new errors (below). Maybe you should also post your sessionInfo(). library(genetics) Loading required package: combinat

Re: [R] how to extract the 1st field from a vector of strings

2010-05-31 Thread Juliet Hannah
What is the meaning of \\1 here? Thanks. desc - c(hsa-let-7a MIMAT062 Homo sapiens let-7a,hsa-let-7a* MIMAT0004481 Homo sapiens let-7a*,hsa-let-7a-2* MIMAT0010195 Homo sapiens let-7a-2*) I'm missing something: gsub( MIMA.*, \\1, desc) [1] hsa-let-7ahsa-let-7a* hsa-let-7a-2* gsub(

[R] suggestions/improvements for recoding strategy

2010-05-17 Thread Juliet Hannah
I am recoding some data. Many values that should be 1.5 are recorded as 1-2. Some example data and my solution is below. I am curious about better approaches or any other suggestions. Thanks! # example input data myData - read.table(textConnection(id, v1, v2, v3 a,1,2,3 b,1-2,,3-4

Re: [R] Questions about ggplot2

2010-05-16 Thread Juliet Hannah
I started with the summarized data, and there are different ways to do this. For this example, let there be four columns and a corresponding sum of 1s. library(ggplot2) mydf - data.frame(colname = c(A,B,C,D),mycolsum=c(1:4)) p - ggplot(mydf,aes(x=colname,y=mycolsum)) p - p + geom_bar(stat =

[R] uninstalling and installing on linux

2010-04-23 Thread Juliet Hannah
Hi List, I have a question about uninstalling and installing R on linux, which I am new to. sessionInfo() R version 2.10.1 (2009-12-14) x86_64-unknown-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C

Re: [R] uninstalling and installing on linux

2010-04-23 Thread Juliet Hannah
This has not worked for me, meaning I can still use R, so instead I removed the directory rm -fR R-2.10.1 Is one method preferable to another. And what am I doing incorrectly with make uninstall? Don't know, probably not many are using it and it may be fairly untested. If not many are

[R] doBy and Hmisc on R version 2.11.0

2010-04-23 Thread Juliet Hannah
I installed R 2.11.0, and I don't think I can load the doBy package now. Any suggestions? library(doBy) Loading required package: survival Loading required package: splines Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) : there is no package called 'Hmisc' Error: package/namespace

Re: [R] doBy and Hmisc on R version 2.11.0

2010-04-23 Thread Juliet Hannah
I should have mentioned that I also tried: install.packages(Hmisc) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘Hmisc’ is not available On Fri, Apr 23, 2010 at 3:15 PM, David Winsemius dwinsem...@comcast.net wrote: On Apr 23, 2010, at 3:09 PM, Juliet

Re: [R] Help with multtest (rawp2adjp)

2010-03-06 Thread Juliet Hannah
Some code to cut and paste would be helpful. The following may help out. library(multtest) # create some p-values p - runif(100) p - sort(p) p_adj - mt.rawp2adjp(p, proc=BH, alpha = 0.05) str(p_adj) List of 4 $ adjp : num [1:100, 1:2] 0.0142 0.0174 0.0254 0.0258 0.0736 ... ..- attr(*,

Re: [R] Three most useful R package

2010-03-03 Thread Juliet Hannah
I use rms, lme4, ggplot2 frequently (also lattice and MASS). On Tue, Mar 2, 2010 at 3:13 PM, Ralf B ralf.bie...@gmail.com wrote: Hi R-fans, I would like put out a question to all R users on this list and hope it will create some feedback and discussion. 1) What are your 3 most useful R

Re: [R] How to do: Correlation with blocks (or - repeated measures ?!) ?

2010-02-28 Thread Juliet Hannah
I didn't follow your question completely. But do a search for intraclass correlation with nlme or lmer and see if those results relate to the question you are asking. If so, I would suggest following up on the mixed model list. I know you wanted to avoid mixed models, but if I have understood your

Re: [R] Problem with installing genetics package

2010-02-22 Thread Juliet Hannah
I just installed it, and it worked fine. sessionInfo() R version 2.10.1 (2009-12-14) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached

Re: [R] Unordered Factors For ggplot?

2010-02-21 Thread Juliet Hannah
It would be easier with some example data. Make sure the data is represented by factors and check the levels and relevel if needed. Something like: df$day - factor(df$day, levels = c(30, 29, 20)) Also search the ggplot2 mailing list for factor and order. I think similar questions are asked often

Re: [R] Hierarchical data sets: which software to use?

2010-02-04 Thread Juliet Hannah
Check out the book Linear Mixed Models: A Practical Guide Using Statistical Software by Brady West. It sets up analyses, similar to ones you described, in SPSS, R, and others as well. In general, I think it is good to know a couple of different packages, especially if you plan on doing a lot

[R] convert data frame of values into correlation matrix

2010-01-30 Thread Juliet Hannah
Hi Group, Consider a data frame like this: mylabel1 - rep(c(A,B,C),each=3) mylabel2 - rep(c(A,B,C),3) corrs - c(1,.8,.7,.8,1,.7,.7,.7,1) myData - data.frame(mylabel1,mylabel2,corrs) myData mylabel1 mylabel2 corrs 1AA 1.0 2AB 0.8 3AC 0.7

Re: [R] simulation of binary data

2010-01-23 Thread Juliet Hannah
Check out the help page of the lrm function in the rms library. To show how lrm is used, the examples simulate data for logistic regression. This may give you some ideas. On Wed, Jan 20, 2010 at 10:41 AM, omar kairan omarkaira...@gmail.com wrote: Hi, could someone help me with dilemma on the

Re: [R] Eigenvectors and values in R and SAS

2010-01-15 Thread Juliet Hannah
Here is an example that may be helpful. A - matrix(c(-3,5,4,-2),nrow=2,byrow=TRUE) eigs - eigen(A) eigs $values [1] -7 2 $vectors [,1] [,2] [1,] -0.7808688 -0.7071068 [2,] 0.6246950 -0.7071068 The eigenvectors may be scaled differently because they are not unique (or have a

[R] data manipulation/subsetting and relation matrix

2009-12-07 Thread Juliet Hannah
Hi List, Here is some example data. myDat - read.table(textConnection(group id 1 101 1 201 1 301 2 401 2 501 2 601 3 701 3 801 3 901),header=TRUE) closeAllConnections() corr_mat -read.table(textConnection(1 1 .5 0 0 0 0 0 0 0 2 .5 1 0 0 0 0 0 0 0 3 00 1.0 0

Re: [R] Partial correlations and p-values

2009-12-05 Thread Juliet Hannah
Your R code looks correct. Because this is a straightforward calculation, I would be surprised if there were any differences with SPSS. It may be worthwhile to check if SPSS gives partial correlations or semipartial correlations. For example, if you take the correlation between py - resid(lm(y

Re: [R] Sampling dataframe

2009-11-28 Thread Juliet Hannah
Here are some options that may help you out. First, let's put the data in a format that can be cut-and-pasted into R. myData - read.table(textConnection(var1 var2 var3 1 111 2 312 3 813 4 614 51015 6 221 7 422 8

Re: [R] Need help for graphical representation

2009-11-21 Thread Juliet Hannah
Check out examples in the lattice package and ggplot2 package. For example let's say you plot points and confidence intervals. These packages will then allow you to plot these values by group and by combinations of groups. Look up conditioning and faceting in these packages. On Wed, Nov 18, 2009

Re: [R] when vectorising does not work: silent function fail?

2009-11-14 Thread Juliet Hannah
Also, you probably get less data copying by using a for() or while() loop than by using apply() in this context. Why may there be less data copying with for and while compared to apply? Finally, the overhead of formula parsing and model matrix construction repeated thousands of times

Re: [R] QQ plotting of various distributions...

2009-09-27 Thread Juliet Hannah
I think it's helpful to show the sampling variability in a QQ plot under repeated sampling. An example is given in Venables, Ripley pg 86. The variance is higher at the tails. Even when the distributions are the same, the QQ plot does not have to resemble a straight line because of sampling. I

Re: [R] Error in make.names when trying to read.table in if statement

2009-09-25 Thread Juliet Hannah
Does this work for you? data_list - list() filepattern=modrate* all_files - list.files(pattern=filepattern) data_list - lapply(all_files, read.table,header=TRUE,sep=,) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Compare a group of line slopes

2009-09-18 Thread Juliet Hannah
The test that a slope differs by group is a test that the variable*group interaction equals zero (overall test). Maybe searching post-hoc comparisons in regression will give you some leads. On Tue, Sep 15, 2009 at 10:57 AM, Jun Shen jun.shen...@gmail.com wrote: Hi, all, I am thinking to

Re: [R] Scan and read.table

2009-09-09 Thread Juliet Hannah
Do you run into problems if you use something like: cc - rep(numeric,9) mydata - read.table(yourdata,header=TRUE,colClasses=cc,skip=1,nrows=numRows) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] using an array of strings with strsplit, issue when including a space in split criteria

2009-09-07 Thread Juliet Hannah
I get a different result: txt - c(sales to 23 August 2008 published 29 August,sales to 6 September 2008 published 11 September) strsplit(txt, 'published ', fixed=TRUE) [[1]] [1] sales to 23 August 2008 29 August [[2]] [1] sales to 6 September 2008 11 September sessionInfo() R version 2.9.0

Re: [R] permutation test - query

2009-09-03 Thread Juliet Hannah
You may find the multtest package helpful. It implements methods from Westfall and Young (Resampling based multiple testing). On Mon, Aug 31, 2009 at 5:37 AM, Yonatan Nissenbaumyoni@mail.huji.ac.il wrote: Hi, My query is regarding permutation test and reshuffling of genotype/phenotype

Re: [R] Logistic Politomic Regression in R

2009-09-01 Thread Juliet Hannah
Check out Chapter 7 of Laura Thompson's R Companion to Agresti (you can find it online). It will show you how to fit proportional odds models (polr in MASS, and lrm in the Design library) and multinomial regression models. __ R-help@r-project.org

Re: [R] Within factor random factor

2009-08-29 Thread Juliet Hannah
Let's say that location defined a group, and observations may be more similar in a group. You could account for this similarity with the following model. model1 -lme(X~CorP,random=~1|location,data=mydata,method=ML) This fits a random intercept model grouped by location. This would assume that

Re: [R] How can I do a generic specification in multiple logistic regression

2009-08-25 Thread Juliet Hannah
Is multinom the function you are looking for? library(nnet) library(MASS) ?multinom indicates that this fits multinomial log-linear models. If you are looking for multiple logistic regression you may want to read up on glm or lrm from the Design package. Could you elaborate on what you mean by

Re: [R] Strange package installation error

2009-08-21 Thread Juliet Hannah
Hi Janet, Were you able to install the package? I just installed it without problems. I don't think there should be any issues installing it. If it has not worked yet, make sure your R is updated, and if it is, maybe reinstall it. Best, Juliet On Mon, Aug 17, 2009 at 8:43 PM, Janet

Re: [R] xyplot and subscripts

2009-08-13 Thread Juliet Hannah
I'm not sure how to do this in lattice, but here is an option with ggplot2. library(ggplot2) set.seed(123) # Make sure the data has a variable that indicates # which group is red and which one is black DF - data.frame(x = rnorm(10), y = rnorm(10), gr = rep(1:5, 2),endpoint =

Re: [R] plotting points in random but different colors based on condition

2009-08-05 Thread Juliet Hannah
Maybe this is helpful. Install ggplot2. #Create a small example x - seq(1:20) y - (2*x) + rnorm(length(x),0,1) id - rep(1:5,each=4) dat - data.frame(x,y,id) library(ggplot2) p - ggplot(dat,aes(x=x,y=y,colour=factor(id))) p - p + geom_point() p If this is not the correct structure, maybe

Re: [R] suggestion for paired t-tests

2009-07-25 Thread Juliet Hannah
Hi Jack, Maybe this helps. # make some data set.seed(123) condition - factor(rep(c(a,b), each = 5)) score - rnorm(10); lg - data.frame(condition, score) # Carry out commands a - subset(lg,condition==a)[score] b - subset(lg,condition==b)[score] t.test(a,b,paired=TRUE) #Error in

Re: [R] Simulate residuals with different properties for a linear model (regression)

2009-07-20 Thread Juliet Hannah
Here are a couple of examples. # residuals not normal n - 100; x = seq(n) y = 10 + 10 *x + 20 * rchisq(n,df=2) non_normal_lm = lm(y~x) #non-constant variance n - 100; x = seq(n) y = 100 + 3 * x + rnorm(n,0,3) * x; het_var_lm = lm(y~x) #For each of these try: plot(non_normal_lm) plot(het_var_lm)

[R] c-index validation from Design library

2009-07-17 Thread Juliet Hannah
Hi Group, I have a question about obtaining the bias-corrected c-index using validate from the Design library. As an example, consider the example from help page: library(Design) ?validate.lrm n - 1000 age- rnorm(n, 50, 10) blood.pressure - rnorm(n, 120, 15) cholesterol-

[R] strategy to iterate over repeated measures/longitudinal data

2009-07-15 Thread Juliet Hannah
Hi Group, Create some example data. set.seed(1) wide_data - data.frame( id=c(1:10), predictor1 = sample(c(a,b),10,replace=TRUE), predictor2 = sample(c(a,b),10,replace=TRUE), predictor3 = sample(c(a,b),10,replace=TRUE), measurement1=rnorm(10), measurement2=rnorm(10))

[R] correct way to subset a vector

2009-07-09 Thread Juliet Hannah
Hi, #make example data dat - data.frame(matrix(rnorm(15),ncol=5)) colnames(dat) - c(ab,cd,ef,gh,ij) If I want to get a subset of the data for the middle 3 columns, and I know the names of the start column and the end column, I can do this: mysub - subset(dat,select=c(cd:gh)) If I wanted to do

Re: [R] skip the error to continue the logistic regression in a loop

2009-07-04 Thread Juliet Hannah
Here are two things to try. First check the data. There may be a factor that does not have variation in the sample. For example, if you had a predictor such as 'present'/'absent', in the current sample, all of them may be 'present'. Second, you can put a 'try' statement in your function. try(

Re: [R] [Repost][Off Topic] Pointers needed for breakthrough in statistics

2009-06-19 Thread Juliet Hannah
You may find the following two books useful: Lehmann, Reminiscences of a Statistician (Springer). David Salsburg, The lady testing tea. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] learning about panel functions in lattice

2009-06-14 Thread Juliet Hannah
Hi All, I am trying to understand panel functions. Let's use this example. library(lattice) time-c(rep(1:10,5)) y -time+rnorm(50,5,2) group-c(rep('A',30),rep('B',20)) subject-c(rep('a',10),rep('b',10),rep('c',10),rep('d',10),rep('e',10)) myData -data.frame(subject,group,time,y) head(myData)

Re: [R] How to set a filter during reading tables

2009-05-31 Thread Juliet Hannah
There are several things you can tell read.table to make it faster. First, as mentioned, setting colClasses helps. I think telling read.table how many rows and columns there are also helps. When this was not sufficient, I've had to do the data processing using Python, Perl, or awk. If that had

  1   2   >