Re: [R] memory.size help
You havn't said anithing about your OS and version. But basicly I means, that you don't have enoigh RAM or swap memory aviable on your system. How large dataset you have? 1. You can optimise your code. :) or 2. You can just add more RAM to your system, or you can add more swap space on your HDD. Work with data in swap will be really slow. In linux OS you can add additional swap space, by these commmands: 2 GB file: dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152 mkswap /swapfile1 swapon /swapfile1 On Friday 31 August 2007 15:27:58 dxc13 wrote: > w1 <- outer(xk$xk1, data[,x1], function(y,z) abs(z-y)) > w2 <- outer(xk$xk2, data[,x2], function(y,z) abs(z-y)) > w1[w1 > d1] <- NA > w2[w2 > d2] <- NA > i1 <- ifelse(!is.na(w1),yvals[col(w1)],NA) > i2 <- ifelse(!is.na(w2),yvals[col(w2)],NA) > zk <- numeric(nrow(xk)) #DEFININING AN EMPTY VECTOR TO HOLD ZK VALUES > for(x in 1:nrow(xk)) { > k <- intersect(i1[x,], i2[x,]) > zk[x] <- mean(unlist(k), na.rm = TRUE) > } > xk$zk <- zk > data <- na.omit(xk) -- Andris Jankevics Assistant Department of Medicinal Chemistry Latvian Institute of Organic Synthesis Aizkraukles 21, LV-1006, Riga, Latvia __ R-help@stat.math.ethz.ch 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] Bind together two vectors of different length...
Dear everyone, I've got difficulties in realizing the following task: I have two vectors: A <- c(1:10) B<- seq(1,10,2) Now I want to make a table form vectors A and B as rows, and if a value of A isn't present B, then I want to put a N/A symbol in it: Output should look like this: 1 2 3 4 5 6 7 8 9 10 1 0 3 0 5 0 7 0 9 0 How can I do this in R? Thank you. -- Andris Jankevics Assistant Department of Medicinal Chemistry Latvian Institute of Organic Synthesis Aizkraukles 21, LV-1006, Riga, Latvia __ R-help@stat.math.ethz.ch 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] Greek symbols in xtable rows
Thank You for answer. I Tried code that You provided in reply to my question on both PC's with Linux and Widows OS. On linux box output is: > xtable(diag(c("$\\sigma_1^2$","$\\sigma_2^2$"))) % latex table generated in R 2.4.0 by xtable 1.4-3 package % Tue Apr 17 09:18:31 2007 \begin{table}[ht] \begin{center} \begin{tabular}{rll} \hline & 1 & 2 \\ \hline 1 & \$$\backslash$sigma\_1\verb|^|2\$ & 0 \\ 2 & 0 & \$$\backslash$sigma\_2\verb|^|2\$ \\ \hline \end{tabular} \end{center} \end{table} System information: > sessionInfo () R version 2.4.0 (2006-10-03) i686-redhat-linux-gnu locale: LC_CTYPE=lv_LV.UTF-8;LC_NUMERIC=C;LC_TIME=lv_LV.UTF-8;LC_COLLATE=lv_LV.UTF-8;LC_MONETARY=lv_LV.UTF-8;LC_MESSAGES=lv_LV.UTF-8;LC_PAPER=lv_LV.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=lv_LV.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] "tcltk" "methods" "stats" "graphics" "grDevices" "utils" [7] "datasets" "base" other attached packages: xtable pls ellipse "1.4-3" "1.2-1" "0.3-2" > version platform i686-redhat-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) And there is an output form my windows PC: > mat <- diag (c("$\\sigma_1^2","$\\sigma_2^2$")) > xtable (mat) % latex table generated in R 2.4.1 by xtable 1.4-3 package % Tue Apr 17 09:39:09 2007 \begin{table}[ht] \begin{center} \begin{tabular}{rll} \hline & 1 & 2 \\ \hline 1 & \$$\backslash$sigma\_1\verb|^|2 & 0 \\ 2 & 0 & \$$\backslash$sigma\_2\verb|^|2\$ \\ \hline \end{tabular} \end{center} \end{table} > sessionInfo () R version 2.4.1 (2006-12-18) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods" "base" other attached packages: xtable "1.4-3" > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.1 year 2006 month 12 day18 svn rev40228 language R version.string R version 2.4.1 (2006-12-18) Thank You, Andris Jankevics On Pirmdiena, 16. Aprīlis 2007 22:38, Charles C. Berry wrote: > On Mon, 16 Apr 2007, Andris Jankevics wrote: > > Dear R-helpers, > > > > I am using xtable package to prepare a Latex code of some R tables. > > Is this possible to have a greek symbols in xtable cells? > > > > How can I get for example a string of : $\Delta$ > > > >> "$\Delta$" > > > > [1] "$Delta$" > > > > And string: > "$\\Delta$" > > [1] "$\\Delta$" > > > > Gives a latex aoutput like: \$$\backslash$Delta\$ > > The posting guide says > > Sometimes it helps to provide a small example that someone can > actually run. > > which you did not do. > > This makes it hard for us to pinpoint the error. > > For me, this works > > > mat <- diag(c("$\\sigma_1^2$","$\\sigma_2^2$")) > > xtable(mat) > > % latex table generated in R 2.4.1 by xtable 1.4-2 package > % Mon Apr 16 12:27:54 2007 > \begin{table}[ht] > \begin{center} > \begin{tabular}{rll} >\hline > & 1 & 2 \\ >\hline > 1 & $\sigma_1^2$ & 0 \\ >2 & 0 & $\sigma_2^2$ \\ > \hline > \end{tabular} > \end{center} > \end{table} > > > > and placing the text output in between > > \documentclass{article} > > \begin{document} > > and > > \end{document} > > saving the file and running latex (or pdflatex) produces nicely set > output with the Greek letter 'sigma' properly rendered. > > > Thank You in advance > > > > Andris Jankevics > > > > __ > > R-help@stat.math.ethz.ch mailing list &
[R] Greek symbols in xtable rows
Dear R-helpers, I am using xtable package to prepare a Latex code of some R tables. Is this possible to have a greek symbols in xtable cells? How can I get for example a string of : $\Delta$ > "$\Delta$" [1] "$Delta$" And string: > "$\\Delta$" [1] "$\\Delta$" Gives a latex aoutput like: \$$\backslash$Delta\$ Thank You in advance Andris Jankevics __ R-help@stat.math.ethz.ch 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] Get "home" directory and simple I/O
If you want get a username of user currently running R on Linux,you can use a system command and read enviroment variables: paste("/home/",system ("whoami",intern=TRUE),sep="") Andris Jankevics On Piektdiena, 23. Marts 2007 14:30, Alberto Monteiro wrote: > Is there any generic function that gets the "home" directory? This > should return /home/ in Linux and > x:/Documents and Settings/ (or whatever) in Windows XP. > > Another (unrelated) question: what is the _simplest_ way to > read and write R variables to/from files such that they are > stored in a human-readable but R-like form? For example, if > (say), x is a vector defined as x <- c(1, 2, 3), can I write > (and read) x as a file with just one line, namely: c(1, 2, 3) ? > > Alberto Monteiro > > __ > R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Start and Restart R over SSH
Hi, You can take a look at GNU screen programm: http://www.gnu.org/software/screen/ Andris Jankevics On Pirmdiena, 19. Februāris 2007 15:56, Nils Höller wrote: > Hi, > > I have some big calculations in R to be done. > Since I can use R on a server with ssh, i was wondering if I can reopen > a R Shell after exiting ssh. > > I don't want to use the batch mode and nohup doesn't work. > > I want to use something like > ssh [EMAIL PROTECTED] > R > ---do something in R and start calculation --- > close ssh but let R remain on the server, doing the calculation > > ssh [EMAIL PROTECTED] > open the existing R Shell / Process > > Has anyone done something similiar? > Can you help me or suggest an other solution ? > > Thank you for your help > > Nils > > __ > R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Interactive plots with R
Hi, I wrote some simple rpanel package script for visual spectral data comparison. At this example i have a three samples and i want to zoom through x and y axis to compare differences between samples. With my script below I can zoom to some data region and add some other spetra to the plot, through text input field. But I can't figure out, how to change axis scaling for all displayed spectra, because only first spectra are redrawed after axis scaling. Or maybe I need to study samples and documentation for tcltk package? My script: DATAPPM=seq(0,11,0.004) DATAPPM=data.frame(DATAPPM,DATAPPM,DATAPPM) DATAS=data.frame (S1=sample(1:3260,2751),S2=sample(1:3260,2751),S3=sample(1:3260,2751)) library (rpanel) pplotNMR <- function (panel) { with (panel,{ VECP <- DATAPPM[,sample] VECS <- DATAS[,sample] names (VECP) <- rownames(DATAPPM) names (VECS) <- rownames(DATAS) SEL <- names(VECP[VECP>MIN & VECPMIN & VECPhttps://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] question about apply function
Dear R-Users, For example i have a data matrix with five samples and three variables. DATA <- matrix(c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5),nrow=5,ncol=3,byrow=TRUE) colnames (DATA) <- c("V1","V2","V3") rownames (DATA) <- c("S1","S2","S3","S4","S5") I want to normalize all samples to same sum of variables: NormFun <- function (i) {(i*(1/sum(i)))} Dnorm <- apply(DATA,1,NormFun) Why I am getting tranposed matrix Dnorm? And with my experimental data (with 32k variables) i am getting a slighty different results from: apply(DATA,1,NormFun) apply(t(DATA),2,NormFun) Thankyou, Andris Jankevics __ R-help@stat.math.ethz.ch 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] PCA reconstruction funtion
Also new values can be easy calculated from prcomp object: Data <- scale(iris[,1:4],center=TRUE,scale=TRUE) iris.pc <- prcomp(Data) # Explained variation (iris.pc$sdev^2/sum(iris.pc$sdev^2))*100 # Loadings iric.pc$rotation #Scores iris.pc$x #Fitted Values for each PC # Xfit = T*P^t PCfit <- function (i,pcdata) {PCI <- pcdata$x[,i]%*%t(pcdata$rotation[,i])} Fitted <- lapply (c(1:4),PCfit,pcdata=iris.pc) for ( i in c(1:4) ) { assign (paste("IrisPC",i,sep=""),Fitted[[i]])} #Residuals EPC1 <- round(Data - IrisPC1,3) EPC2 <- round(Data - (IrisPC1+IrisPC2),3) EPC3 <- round(Data - (IrisPC1+IrisPC2+IrisPC3),3) EPC4 <- round(Data - (IrisPC1+IrisPC2+IrisPC3+IrisPC4),3)# 0 Andris Jankevics On Piektdiena, 10. Novembris 2006 05:58, Renaud Lancelot wrote: > See ?rconst in package ade4. You will need to fit the PCA with > dudi.pca (same package). > > Best, > > Renaud > > 2006/11/9, Poizot Emmanuel <[EMAIL PROTECTED]>: > > Dear all, > > > > I did performed a PCA analysis (using prcomp function) on a data matrix. > > Then I would like to reconstruction part of the original data set using > > only specifics and choosen eigenvectors. > > I would like to know if there is a function under R witch can perform > > this reconstruction. > > Regards > > > > -- > > > > > > Emmanuel Poizot > > Cnam/Intechmer > > B.P. 324 > > 50103 Cherbourg Cedex > > > > Phone (Direct) : (00 33)(0)233887342 > > Fax : (00 33)(0)233887339 > > > > > > > > > > __ > > R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Simple question about Lists
Hello, You can try to merge network$wieght in the data frame, and the plot a first row from it. DataF <- do.call (rbind,network$weight) Andris On Ceturtdiena, 2. Novembris 2006 12:53, Wee-Jin Goh wrote: > Hello, > > I know this must be a very simple problem, but I can't work it out > from the documentation that is available. I've got a list of data I > would like to plot (the weights of a single neuron that was trained > using the neural package). The problem I'm encountering is that this > set of weights, are in the form of a list. > > > network$weigth[1] > > [[1]] > [,1] > [1,] -0.04687623 > [2,] -0.54087443 > [3,] -1.68130221 > [4,] -0.82295266 > [5,] 1.60848361 > [6,] 1.55903277 > [7,] 0.29005900 > [8,] 1.24387657 > [9,] -0.05129092 > [10,] -1.22469042 > [11,] -2.64470326 > [12,] 0.10517494 > [13,] 1.87561741 > [14,] 1.93962447 > [15,] 0.99212323 > [16,] 0.46430803 > [17,] -0.31660246 > [18,] -0.81997588 > [19,] 0.22277782 > [20,] 0.97456769 > [21,] 0.46083111 > [22,] 1.46876956 > [23,] -0.19702465 > [24,] -0.34898054 > [25,] 1.22504724 > > Now, I've tried as.vector to convert it to a vector for plotting. > Doesn't work. Tried as.matrix, that too doesn't work. I've tried > accessing individual elements, but that doesn't work as network$weigth > [1] returns what seems to me is a matrix but it doens't act like a > matrix. > > Any help would be much obliged. > > Wee-Jin > > __ > R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Multivariate regression
Also you can take a look on Partial Least Squares (PLS) regression. http://www.statsoft.com/textbook/stpls.html R-package: http://mevik.net/work/software/pls.html Andris Jankevics On Sestdiena, 28. Oktobris 2006 06:04, Ritwik Sinha wrote: > You can use gee ( > http://finzi.psych.upenn.edu/R/library/geepack/html/00Index.html) or maybe > the function gls in nlme. > > Ritwik. > > On 10/27/06, Ravi Varadhan <[EMAIL PROTECTED]> wrote: > > Hi, > > > > > > > > Suppose I have a multivariate response Y (n x k) obtained at a set of > > predictors X (n x p). I would like to perform a linear regression taking > > into consideration the covariance structure of Y within each unit - this > > would be represented by a specified matrix V (k x k), assumed to be the > > same > > across units. How do I use "lm" to do this? > > > > > > > > One approach that I was thinking of is as follows: > > > > > > > > Flatten Y to a vector, say, Yvec (n*k x 1). Create Xvec (n*k, p*k) such > > that it is made up of block matrices Bij (k x k), where Bij is a diagonal > > matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p). Now I can > > use "lm" in a univariate mode to regress Yvec against Xvec, with > > covariance matrix Vvec (n*k x n*k). Vvec is a block-diagonal matrix with > > blocks of V along the diagonal. This seems like a valid approach, but I > > still don't know how to specify the covariance structure to do weighted > > least squares. > > > > > > > > Any help is appreciated. > > > > > > > > Best, > > > > Ravi. > > > > > > > > > > - > >--- --- > > > > Ravi Varadhan, Ph.D. > > > > Assistant Professor, The Center on Aging and Health > > > > Division of Geriatric Medicine and Gerontology > > > > Johns Hopkins University > > > > Ph: (410) 502-2619 > > > > Fax: (410) 614-9625 > > > > Email: [EMAIL PROTECTED] > > > > Webpage: > > http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html > > > > > > > > > > - > >--- > > > > > > > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] question about dataframe ("sensory") in PLS package
Hello, I do this in such way: DATAX <- matrix(seq(1,6,1),2,3) DATAY <- matrix (seq(1,4,1),2,2) rownames(DATAX) <- c("s1","s2") rownames(DATAY) <- c("s1","s2") colnames (DATAX) <- c("v1","v2","v3") colnames (DATAY) <- c("respone_1","response_2") KAL <- data.frame (N = rownames(DATAX)) KAL$Y <- DATAY KAL$X <- DATAX KAL$X KAL$Y DATAX is a matrix of testing data, but DATAY is a matrix of responses. Andris Jankevics On Pirmdiena, 31. Jūlijs 2006 05:45, [EMAIL PROTECTED] wrote: > Dear all, > > I am trying to my dataframe for the PLS analysis using the PLS package. > However I have some trouble generating the correct dataframe. The main > problem is how to use one name to represent several columns in the > dataframe. > > The example dataframe in PLS package is called "sensory". I cannot > directly read the data file since it's a binary file. If I use > "names(sensory)" command, I will get two names: "Quality" and "Panel". But > if I use "summary(sensory)" command, I will get information of five > columns for "Quality" and 6 columns for "Panel" (such as "Quality.Acidity" > "Quality.Peroxide"...). So when I use PLS regression, the function is > simply "Panel ~ Quality" (but it's actually multiple regression). > > Does anyone know how to build such dataframe? Please share some > experience. Really appreciate the help! > > Sincerely, > Jeny > > __ > R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] data extraction
This should work: data[seq(1,nrow(data),10),] Andris On Piektdiena, 30. Jūnijs 2006 14:45, yohannes alazar wrote: > Dear mailing list I have a data that have 20,000 rows and 20 columns. Io > wonted to extract the 10th row only. Example the 10th, 20th, 30th > 40th�..2 th. can you please help me how do I do that.Than kyou. > Example is below. > Inpute: > AG GG GG AG > CC CC CC CC > CT CC CT CT > GG GG GG GG > CC CC CC CC > GG GG GG GG > CC CC CC CC > GG CG CG GG > GG GG GG GG > *CC CC CC CC* > AA AG AG AA > AA AA AA AA > GG AG AG GG > GG AG AG GG > GG GG GG GG > TT TT TT TT > AA AG AG AA > CT CC CT TT > AG AA AG GG > *AA AA AG AG* > AA AA AA AA > CC CC CC CG > GG GG GG AG > CT TT CT CT > AT AA AT AT > GG GG GG AG > CG CC CG GG > GG GG GG AG > CC CC CC CT > GG GG GG GG > *GG GG AG AG > *CC CC CC CT > TT TT TT CT > AG GG AG AG > GG GG GG GG > AG AG AA AA > AG GG AG AA > CT TT CT CT > CT CT CC CT > *AC CC AC AC* > > output > *CC CC CC CC > AA AA AG AG > GG GG GG GG > AC CC AC AC* > > thankyou a lot inadvance! > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Indexing vector with repeated values
Hi all, I have a vector which contains many repeated values. >Z <- c(1,2,3,4,5,1,2,3,4,5,1,2,3,5,5,2,3,4,5) I need to know how many times each number in this vecetor is repeated. I can use a command like this: > table (cut(Z,seq(1,5,1))) (1,2] (2,3] (3,4] (4,5] 4 4 3 5 But how can I find a break points for vector with random values and random number sequence intervals? Why result for interval (1,2) is 4, if there is only 3 values of "1"? Can I get from vector Z a smal vector Zs 1,2,3,4,5 ? Thanks a lot! Andris Jankevics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Question about PLS regression
I am sorry. It was my fault. My example is wrong. I need also rearrange a validation data set too. But I have a sligthy different results with my real data. Where can the problem be? Andris Jankevics On Otrdiena, 18. Aprīlis 2006 17:55, Andris Jankevics wrote: > Hello useRs, > > I am new user to R and also statistics. Why predicted results in this > example are different? Is the order of variables in X matrix important? > > library (pls) > set.seed (1) > Y1 <- c(1,2,3,4,5,6,7,8,9,10) > Y2 <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0) > X1 <- rnorm(10,sd=0.2) > X2 <- rnorm(10,sd=1) > X3 <- rnorm(10,sd=0.1) > X4 <- rnorm(10,sd=0.1) > X5 <- rnorm(10,sd=0.1) > > KAL <- data.frame(num=c(1:10)) > KAL$Y <- as.matrix(cbind (Y1,Y2)) > KAL$X <- as.matrix(cbind (X1,X2,X3,X4,X5)) > KAL2 <- data.frame(num=c(1:10)) > KAL2$Y <- as.matrix(cbind (Y1,Y2)) > KAL2$X <- as.matrix(cbind (X5,X4,X3,X2,X1)) > > PLS <- plsr (Y~X,data=KAL, 4,validation = "CV") > PLS2 <- plsr (Y~X,data=KAL2,4, validation = "CV") > > X1v <- rnorm(10,sd=0.1) > X2v <- rnorm(10,sd=1) > X3v <- rnorm(10,sd=0.1) > X4v <- rnorm(10,sd=0.1) > X5v <- rnorm(10,sd=0.1) > VAL <- data.frame(num=c(1:10)) > VAL$X <- as.matrix(cbind(X1v,X2v,X3v,X4v,X5v)) > > predict (PLS,VAL,4) > predict (PLS2,VAL,4) > > Thank You, > > Andris Jankevics > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Question about PLS regression
Hello useRs, I am new user to R and also statistics. Why predicted results in this example are different? Is the order of variables in X matrix important? library (pls) set.seed (1) Y1 <- c(1,2,3,4,5,6,7,8,9,10) Y2 <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0) X1 <- rnorm(10,sd=0.2) X2 <- rnorm(10,sd=1) X3 <- rnorm(10,sd=0.1) X4 <- rnorm(10,sd=0.1) X5 <- rnorm(10,sd=0.1) KAL <- data.frame(num=c(1:10)) KAL$Y <- as.matrix(cbind (Y1,Y2)) KAL$X <- as.matrix(cbind (X1,X2,X3,X4,X5)) KAL2 <- data.frame(num=c(1:10)) KAL2$Y <- as.matrix(cbind (Y1,Y2)) KAL2$X <- as.matrix(cbind (X5,X4,X3,X2,X1)) PLS <- plsr (Y~X,data=KAL, 4,validation = "CV") PLS2 <- plsr (Y~X,data=KAL2,4, validation = "CV") X1v <- rnorm(10,sd=0.1) X2v <- rnorm(10,sd=1) X3v <- rnorm(10,sd=0.1) X4v <- rnorm(10,sd=0.1) X5v <- rnorm(10,sd=0.1) VAL <- data.frame(num=c(1:10)) VAL$X <- as.matrix(cbind(X1v,X2v,X3v,X4v,X5v)) predict (PLS,VAL,4) predict (PLS2,VAL,4) Thank You, Andris Jankevics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Random variable input in mlm
Hello useRs, I have a Liquid Chromatography data of mixtures. I have a 13 variables which are integrals of peaks, and 40 observations as chromatography samples, and concentrations of subtances as response variablse Y. I am trying to bild the best regression model with MLM and PLS for these data, and athe beginning I want to find out which variables are impotant for model. For this reason I wrote this simple function which start with 2 variables and do +1 in each step in data frame and calculate ar SSE of predicton on Validation data at each model. Also I wrote these functions to select variables: D <- Z[length(Z):(1+i) , F3 <- function (i) { center <- round(length(Z)/2) D <- Z[center:(length(Z)-i)] } F4 <- function (i) { center <- round(length(Z)/2) D <- Z[center:(i)] } F5 <- function (i) { center <- round(length(Z)/2) D <- Z[(center+i):(center-i)] } Is there any function in R to randomize a variable selection from data? My be I should optimeze something in my code below? set.seed (1) X1 <- rnorm(10,sd=0.1) X2 <- rnorm(10,sd=1) X3 <- rnorm(10,sd=0.1) X4 <- rnorm(10,sd=0.1) X5 <- rnorm(10,sd=0.1) Y1 <- seq(0,1.8,0.2) Y2 <- seq(1,1.9,0.1) Z <- data.frame (X1,X2,X3,X4,X5) Y1v <- (1:10) Y2v <- (10:1) X1v <- rnorm(10,sd=0.1) X2v <- rnorm(10,sd=1) X3v <- rnorm(10,sd=0.1) X4v <- rnorm(10,sd=0.1) X5v <- rnorm(10,sd=0.1) Zv <- data.frame (X1v,X2v,X3v,X4v,X5v) Fl <- function (i) {D <- Z[,1:(1+i)] CAL <- data.frame (D,Y1,Y2) MLM <- lm(cbind(Y1,Y2)~., data = CAL) V <- Zv[,1:(1+i)] VAL <- data.frame(V,Y1v,Y2v) PRED <- predict (MLM,VAL) Y2x <- Y2 - PRED[,2] Y1x <- Y1 - PRED[,1] SSEY1 <- sum(Y1x[1:length(V[,2])]^2) SSEY2 <- sum(Y2x[1:length(V[,2])]^2) RES <- data.frame (Vars = structure(dimnames(as.matrix(D))[2],dim =1),SSEY1 = SSEY1, SSEY2 = SSEY2) print (RES) } lapply (1:(length(Z)-1),Fl) Andris Jankevics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Question about for loop?
Hello useRs, I can't figure out how can I store a data frame of values of X and D from this loop: Z <- c(1:10) for (i in 1:(length(Z)-2)) {D <- x[1:(2+i)]; X <- paste("x",sep="",i) print (X) print (D) } Thank You, Andris Jankevics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R Installation in Ubuntu 5.04 [Hoardy Hedgehog]
You have to install Xserver (x.org or XFree86) devel packages before compiling. On Piektdiena, 10. Marts 2006 17:31, M Senthil Kumar wrote: > Hello there, > > I had been learning to use R for some time and I am trying to install it > on Ubuntu 5.04 Linux. I downloaded the tarball, there was some problem > with the installation. Perhaps someone who faced similar problems might > help me. > > I downloaded the latest release R Version 2.2.1 from their website. > > I did: > $ tar -xzvf R-2.2.1.tar.gz > > then: > > $ cd R-2.2.1/ > > followed by: > > $./configure > > There were no error messages at this point. > > then: > sudo make > > which gave the following: > > make[1]: Entering directory `/home/senthil/R-2.2.1/m4' > make[1]: Nothing to be done for `R'. > make[1]: Leaving directory `/home/senthil/R-2.2.1/m4' > make[1]: Entering directory `/home/senthil/R-2.2.1/tools' > make[1]: Nothing to be done for `R'. > make[1]: Leaving directory `/home/senthil/R-2.2.1/tools' > make[1]: Entering directory `/home/senthil/R-2.2.1/doc' > make[2]: Entering directory `/home/senthil/R-2.2.1/doc/html' > make[3]: Entering directory `/home/senthil/R-2.2.1/doc/html/search' > make[3]: Leaving directory `/home/senthil/R-2.2.1/doc/html/search' > make[2]: Leaving directory `/home/senthil/R-2.2.1/doc/html' > make[2]: Entering directory `/home/senthil/R-2.2.1/doc/manual' > make[2]: Nothing to be done for `R'. > make[2]: Leaving directory `/home/senthil/R-2.2.1/doc/manual' > make[1]: Leaving directory `/home/senthil/R-2.2.1/doc' > make[1]: Entering directory `/home/senthil/R-2.2.1/etc' > make[1]: Leaving directory `/home/senthil/R-2.2.1/etc' > make[1]: Entering directory `/home/senthil/R-2.2.1/share' > make[1]: Leaving directory `/home/senthil/R-2.2.1/share' > . > . > . > . > . > g77 -g -O2 -c xxxpr.f -o xxxpr.o > gcc -Wl,--export-dynamic -L/usr/local/lib -o R.bin Rmain.o CConverters.o > CommandLineArgs.o Rdynload.o Renviron.o RNG.o apply.o arithmetic.o apse.o > array.o attrib.o base.o bind.o builtin.o character.o coerce.o colors.o > complex.o connections.o context.o cov.o cum.o dcf.o datetime.o debug.o > deparse.o deriv.o dotcode.o dounzip.o dstruct.o duplicate.o engine.o > envir.o errors.o eval.o format.o fourier.o gevents.o gram.o gram-ex.o > graphics.o identical.o internet.o iosupport.o lapack.o list.o logic.o > main.o mapply.o match.o memory.o model.o names.o objects.o optim.o > optimize.o options.o par.o paste.o pcre.o platform.o plot.o plot3d.o > plotmath.o print.o printarray.o printvector.o printutils.o qsort.o > random.o regex.o registration.o relop.o saveload.o scan.o seq.o > serialize.o size.o sort.o source.o split.o sprintf.o startup.o subassign.o > subscript.o subset.o summary.o sysutils.o unique.o util.o version.o > vfonts.o xxxpr.o ../unix/libunix.a ../appl/libappl.a ../nmath/libnmath.a > -lg2c -lm -lgcc_s ../extra/zlib/libz.a ../extra/bzip2/libbz2.a > ../extra/pcre/libpcre.a -lreadline -ldl -lm > make[4]: Entering directory `/home/senthil/R-2.2.1/src/main' > /home/senthil/R-2.2.1/bin/exec/R is unchanged > make[4]: Leaving directory `/home/senthil/R-2.2.1/src/main' > make[3]: Leaving directory `/home/senthil/R-2.2.1/src/main' > make[2]: Leaving directory `/home/senthil/R-2.2.1/src/main' > make[2]: Entering directory `/home/senthil/R-2.2.1/src/modules' > make[3]: Entering directory `/home/senthil/R-2.2.1/src/modules/X11' > make[4]: Entering directory `/home/senthil/R-2.2.1/src/modules/X11' > making dataentry.d from dataentry.c > making devX11.d from devX11.c > making rotated.d from rotated.c > making rbitmap.d from rbitmap.c > make[4]: Leaving directory `/home/senthil/R-2.2.1/src/modules/X11' > make[4]: Entering directory `/home/senthil/R-2.2.1/src/modules/X11' > gcc -I. -I../../../src/include -I../../../src/include -I/usr/X11R6/include > -I/usr/local/include -DHAVE_CONFIG_H -fPIC -g -O2 -c dataentry.c -o > dataentry.lo > gcc -I. -I../../../src/include -I../../../src/include -I/usr/X11R6/include > -I/usr/local/include -DHAVE_CONFIG_H -fPIC -g -O2 -c devX11.c -o > devX11.lo > devX11.c:45:74: X11/Intrinsic.h: No such file or directory > In file included from devX11.c:68: > devX11.h:57:74: X11/Intrinsic.h: No such file or directory > make[4]: *** [devX11.lo] Error 1 > make[4]: Leaving directory `/home/senthil/R-2.2.1/src/modules/X11' > make[3]: *** [R] Error 2 > make[3]: Leaving directory `/home/senthil/R-2.2.1/src/modules/X11' > make[2]: *** [R] Error 1 > make[2]: Leaving directory `/home/senthil/R-2.2.1/src/modules' > make[1]: *** [R] Error 1 > make[1]: Leaving directory `/home/senthil/R-2.2.1/src' > make: *** [R] Error 1 > > I don't know if this is the right place to ask for help. But i tried > googling with the above error message and it did not even fetch a single > page. > > Thanks in advance, > > Senthil > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posti
Re: [R] Update R 2.1.1-1 -> 2.2.1 on UBUNTU
In my opinion line in /etc/apt/sources.lst shoud be similar like this: deb http://cran.r-project.org/bin/linux/debian/stable ./ On Trešdiena, 1. Marts 2006 10:13, Florence Débarre wrote: > On Mer 1 mars 2006 8:58, Prof Brian Ripley a écrit : > > Maybe you need to spell cran.R-project.org in English, with a 'c'? > > Thanks, but... still doesn't work... > > W: Impossible de localiser la liste des paquets sources > http://cran.R-project.org stable/ Packages > (/var/lib/apt/lists/cran.R-project.org_bin_linux_debian_stable_Packages) - > stat (2 Aucun fichier ou répertoire de ce type) > > -- > FD > > > On Wed, 1 Mar 2006, Florence Débarre wrote: > >> I've installed Ubuntu 5.10 Breezy on my Mac. When using MacOSX, I used > >> to > >> work with R 2.2.1, but now, with Ubuntu, I can't download it with > >> synaptic. I can only download R 2.1.1-1, and I really need 2.2.1. > >> > >> I've tried to edit the sources.list file, typing > >> > >> deb http://cran.R-projet.org/bin/linux/debian stable/ > >> > >> R/r, using a different mirror,... but when I run synaptic, it says: > >> > >> W: Impossible de localiser la liste des paquets sources > >> http://cran.R-projet.org stable/ Packages > >> (/var/lib/apt/lists/cran.R-projet.org_bin_linux_debian_stable_Packages) > >> - > >> stat (2 Aucun fichier ou répertoire de ce type) > >> > >> [W: Impossible to localize the list of source packages > >> > >> no file or folder of this kind] > >> > >> What can I do ? > >> > >> Thanks, > >> > >> -- > >> Florence DEBARRE > >> > >> __ > >> R-help@stat.math.ethz.ch mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide! > >> http://www.R-project.org/posting-guide.html > > > > -- > > Brian D. Ripley, [EMAIL PROTECTED] > > 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@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] install RPM file on Redhat
Hello, As a root users type a command like this: rpm -iU R-2.2.1-1.rh4AS.i686.rpm On Pirmdiena, 27. Februāris 2006 08:02, Erin Hodgess wrote: > Dear R People: > > I downloaded the RPM for Red Hat Linux. > > How do I install this, please? When I looked > at the R Intallation manual, it seemed to be > referring to installing from source. > > Thanks in advance! > > Sincerely, > Erin Hodgess > Associate Professor > Department of Computer and Mathematical Sciences > University of Houston - Downtown > mailto: [EMAIL PROTECTED] > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html