[R] Quadratic Optimization
Hi, I need to solve an optimization problem in R having linear objective function and quadratic constraints(number of variables is around 80). What are the possible choices to do this in R. optim() function only allows box constrained problems. Is it possible in nlm()? Or please tell me if there is any other routine. Thanks Amit Cheap talk? [[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.
Re: [R] Questions about generating samples in R
Christian Schulz [EMAIL PROTECTED] writes: split - sample(2,nrow(dataframe),replace=T,prob=c(0.04,0.96)) dataframe[split==1,] # 200 dataframe[split==2,] # 4800 regards, christian ?sample should tell you what you need to know. It does, but the above is not how. To get exactly 200 samples, use sel - sample(200, nrow(dataframe)) dataframe[sel,] On 26/11/06, Alexander Geisler [EMAIL PROTECTED] wrote: Hello! I have a data set with 8 columns and in about 5000 rows. What I want to do is to generate samples of this data set. Samples of a special size, as example 200. What is the easiest way to do this? No special things are needed, only the random selection of 200 rows of the data set. Thanks Alex -- Alexander Geisler * Kaltenbach 151 * A-6272 Kaltenbach email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 | skpye: al1405ex __ 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. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] Package Installation Error: Ruuid, RBGL,-- RGui2.4.0
Dear All, I added packages using :Install Packages from Local Zip files. I have downloaded Ruuid,RGraphviz,graph from BioConductor: I try installed the packages then i tried the following line of code: library(RBGL) the popup message from RGUI 2.4.0 : RGUI:Rgui.exe- Entry point not Found followed by: Loading required package: graph Loading required package: Ruuid Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library 'C:/PROGRA~1/R/R-24~1.0/library/Ruuid/libs/Ruuid.dll': LoadLibrary failure: The specified procedure could not be found. Error: package 'Ruuid' could not be loaded *Then i tried to install Ruuid etc: again the same ERROR:* Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library 'C:/PROGRA~1/R/R-24~1.0/library/Ruuid/libs/Ruuid.dll': LoadLibrary failure: The specified procedure could not be found. Error: package/namespace load failed for 'Ruuid' Need Help! JJ -- Lecturer J. Joshua Thomas KDU College Penang Campus Research Student, University Sains Malaysia [[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.
Re: [R] Splitting criterion in tree and rpart
Datum: Fri, 24 Nov 2006 17:54:38 +0100 Von: Paolo Radaelli [EMAIL PROTECTED] An: r-help@stat.math.ethz.ch Betreff: [R] Splitting criterion in tree and rpart Dear all, I'm interested in fitting a classification tree by using a user-specified splitting criterion. If I am right, Tree package allows to use only deviance or gini while rpart package offers anova, poisson, class or exp. and tries to make an intelligent guess if method is missing. anova, ... are not splitting criteria, but the kind of tree you want to construct, which depends on the dependent variable of your data. I also found that, in rpart, method can be a list of functions named init, split and eval but I really don't know how can I do it. Does someone can suggest me some documentation I can have a look do define my splitting criterion and pass it to rpart ? Here you can find an Technical Report that might help you: http://www.mayo.edu/hsr/techrpt/61.pdf Henri Thanks Paolo Paolo Radaelli Dipartimento di Metodi Quantitativi per le Scienze Economiche ed Aziendali Facoltà di Economia Università degli Studi di Milano-Bicocca e-mail [EMAIL PROTECTED] [[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.
Re: [R] random effect question and glm
At 06:28 26/11/2006, you wrote: Below is the output for p5.random.p,p5.random.p1 and m0 My question is in p5.random.p, variance for P is 5e-10. But in p5.random.p1,variance for P is 0.039293. Why they are so different? Please do as the posting guide asks and reply to the list, not just the individual. a - I might not know the answer b - the discussion might help others You give very brief details of the underlying problem so it is hard to know what information will help you most. Remember, if a computer estimates a non-negative quantity as very small perhaps it is really zero. I think you might benefit from reading Pinheiro and Bates, again see the posting list. Is that wrong to write Y~P+(1|P) if I consider P as random effect? I suppose terminology differs but I would have said the model with Y~1+(1|P) was a random intercept model Also in p5.random.p and m0, it seems that there are little difference in estimate for P. Why? thanks, Aimin Yan p5.random.p - lmer(Y~P+(1|P),data=p5,family=binomial,control=list(usePQL=FALSE,msV=1)) summary(p5.random.p) Generalized linear mixed model fit using Laplace Formula: Y ~ P + (1 | P) Data: p5 Family: binomial(logit link) AIC BIC logLik deviance 1423 1452 -705.4 1411 Random effects: Groups NameVariance Std.Dev. P (Intercept) 5e-102.2361e-05 number of obs: 1030, groups: P, 5 Estimated scale (compare to 1 ) 0.938 Fixed effects: Estimate Std. Error z value Pr(|z|) (Intercept) 0.153404 0.160599 0.9552 0.3395 P8ABP -0.422636 0.202181 -2.0904 0.0366 * P8adh0.009634 0.194826 0.0495 0.9606 P9pap0.108536 0.218875 0.4959 0.6200 P9RNT0.376122 0.271957 1.3830 0.1667 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) P8ABP P8adh P9pap P8ABP -0.794 P8adh -0.824 0.655 P9pap -0.734 0.583 0.605 P9RNT -0.591 0.469 0.487 0.433 p5.random.p1 - lmer(Y~1+(1|P),data=p5,family=binomial,control=list(usePQL=FALSE,msV=1)) summary(p5.random.p1) Generalized linear mixed model fit using Laplace Formula: Y ~ 1 + (1 | P) Data: p5 Family: binomial(logit link) AIC BIC logLik deviance 1425 1435 -710.6 1421 Random effects: Groups NameVariance Std.Dev. P (Intercept) 0.039293 0.19823 number of obs: 1030, groups: P, 5 Estimated scale (compare to 1 ) 0.9984311 Fixed effects: Estimate Std. Error z value Pr(|z|) (Intercept) 0.1362 0.1109 1.2280.219 m0-glm(Y~P,data=p5,family=binomial(logit)) summary(m0) Call: glm(formula = Y ~ P, family = binomial(logit), data = p5) Deviance Residuals: Min 1Q Median 3Q Max -1.4086 -1.2476 0.9626 1.1088 1.2933 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.154151 0.160604 0.960 0.3371 P8ABP -0.422415 0.202180 -2.089 0.0367 * P8adh0.009355 0.194831 0.048 0.9617 P9pap0.108214 0.218881 0.494 0.6210 P9RNT0.374693 0.271945 1.378 0.1683 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 1425.5 on 1029 degrees of freedom Residual deviance: 1410.8 on 1025 degrees of freedom AIC: 1420.8 Number of Fisher Scoring iterations: 4 At 06:13 AM 11/24/2006, you wrote: At 21:52 23/11/2006, Aimin Yan wrote: consider p as random effect with 5 levels, what is difference between these two models? p5.random.p - lmer(Y ~p+(1|p),data=p5,family=binomial,control=list(usePQL=FALSE,msV=1)) p5.random.p1 - lmer(Y ~1+(1|p),data=p5,family=binomial,control=list(usePQL=FALSE,msV=1)) Well, try them and see. Then if you cannot understand the output tell us a) what you found b) how it differed from what you expected in addtion, I try these two models, it seems they are same. what is the difference between these two model. Is this a cell means model? m00 - glm(sc ~aa-1,data = p5) m000 - glm(sc ~1+aa-1,data = p5) See above thanks, Aimin Yan Michael Dewey http://www.aghmed.fsnet.co.uk -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.431 / Virus Database: 268.14.16/551 - Release Date: 25/11/2006 10:55 Michael Dewey http://www.aghmed.fsnet.co.uk __ 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] GLM and LM singularities
At 23:12 26/11/2006, Tim Sippel wrote: Hi- I'm wrestling with some of my data apparently not being called into a GLM or an LM. I'm looking at factors affecting fish annual catch rates (ie. CPUE) over 30 years. Two of the factors I'm using are sea surface temperature and sea surface temperature anomaly. A small sample of my data is below: I could not make much sense of the dataset and your output is incomplete (what happened to Year?) but usually the message you received means that one of your predictors is a linear combination of some of the others. CPUE Year Vessel_ID Base_Port Boat_Lgth Planing SST Anomaly 0.127 1976 2 BOI 40 Planing 19.4 -0.308 0.059 1976 30 BOI 40 Displacement 19.4 -0.308 0.03 1977 46 BOI 45 Displacement 18.5 -1.008 0.169231 1977 2 BOI 40 Planing 18.5 -1.008 0.044118 1977 19 BOI 34 Planing 18.5 -1.008 0.114286 1977 29 WHANGAROA 42 Displacement 18.5 -1.008 Have defined Year, Vessel_ID, Base_Port, Boat_Lgth, Planing as factors, and CPUE, SST, Anomaly are continuous variables. The formula I'm calling is: glm(formula = log(CPUE) ~ Year + Vessel_ID + SST, data = marlin). A summary of the glm includes the following output: Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(|t|) Vessel_ID80 -0.540930.23380 -2.314 0.021373 * Vessel_ID83 -0.364990.20844 -1.751 0.080977 . Vessel_ID84 -0.233860.19098 -1.225 0.221718 SST NA NA NA NA Can someone explain the output Coefficients: (1 not defined because of singularities)? What does this mean? I'm guessing that something to do with my SST data is causing a singularity but I don't know where to go from there? Have inspected various R discussions on this, but I haven't found the information I need. Many thanks, Tim Sippel (MSc) School of Biological Sciences Auckland University Private Bag 92019 Auckland 1020 New Zealand +64-9-373-7599 ext. 84589 (work) +64-9-373-7668 (Fax) +64-21-593-001 (mobile) [[alternative HTML version deleted]] Michael Dewey http://www.aghmed.fsnet.co.uk __ 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] Erosion, mathematical morphology
Hi. My bioconductor.org package, EBImage, should do that -- it allows you to specify the structuring element, which can be a circle of any given radius if you want. The package includes erosion, dilation, opening and closing. It is also a general package for image analysis and processing built around ImageMagick library with many functions added. The only minus, still no Windows support -- Linux, Unix or Mac. Best, Oleg Sklyar On 20/11/06, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote: Hi there, Try this require(adehabitat) ?morphology You can also try this for binary image require(rimage) ?maxImg HTP Miltinho Brazil [EMAIL PROTECTED] escreveu: Hello! I need a function to compute the erosion of a binary image by a structuring element. I need the structuring element to be a ball of a given radius. As far as I know the libraries adehabitat and spatstat include functions of mathematical morphology but I couldn't find a function which computes the erosion by a ball. Any idea? Thanks! __ 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. - Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas! [[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. [[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] quantile regression - estimation of CAViaR
How is it possible to estimate the conditional autoregressive Value-at-Risk model qantile_t(tau)=a0+a1*qantile_(t-1)(tau)+a2*abs(r_(t-1)) see http://www.faculty.ucr.edu/~taelee/paper/BLSpaper1.pdf (page 10)) of Engle Manganelli in R? The qantile_(t-1)(tau)-term causes headache. Kind regards, Jaci -- Ein Herz für Kinder - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht! __ 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] odfTable: how to escape
Francesco, odfTable writes out a table in xml format directly into an xml file. The issues is that the characters and (among others) have to be converted to gt; and lt;. I will build a new version where this happens automatically. In the meantime, you should be able to use the colnames argument of odfTable and odfTranslate to convert the column headings: odfTranslate(these need to be fixed: and , toR = FALSE) [1] these need to be fixed: lt; and gt; Max -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Francesco Cernuto Sent: Friday, November 24, 2006 10:06 AM To: r-help@stat.math.ethz.ch Subject: [R] odfTable: how to escape Dear All, I'm appreciating odfWeave as a nice reporting tool, but I had some pain in producing tables with odfTable command where the first column began with or such as in age class heading, for example: 35 35-39 40-49 50-50 60 In this case, to avoid a content.xml error, I had to change 35 in less than 35 and 60 in over 60. Anyone knows how to escape those characters while producing a table in R or in a document chunk? Thanks in advance, Francesco Cernuto __ 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. -- LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}} __ 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] NaN with ccf() for vector with all same element
hello, i have been using ccf() to look at the correlation between lightning and electrogamnetic data. for the most part it has worked exactly as expected. however, i have come across something that puzzles me a bit: x - c(1, 0, 1, 0, 1, 0) y - c(0, 0, 0, 0, 0, 0) ccf(x, x, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 0.333 -0.500 0.667 -0.833 1.000 -0.833 0.667 -0.500 0.333 ccf(x, y, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 NaN NaN NaN NaN NaN NaN NaN NaN NaN y - c(1, 1, 1, 1, 1, 1) ccf(x, y, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 NaN NaN NaN NaN NaN NaN NaN NaN NaN i don't see why the result from ccf() would be NaN if the elements of y are all the same... perhaps i am just being silly or missing something. but if i work this out by hand, then i get a proper result. so, why not with ccf()? thanks for the help! best regards, andrew. -- Andrew B. Collier Space Physics Group Hermanus Magnetic Observatory Antarctic Research Fellow tel: +27 31 2601157 Space Physics Research Institutefax: +27 31 2616550 University of KwaZulu-Natal, Durban, 4041, South Africa gsm: +27 83 3813655 __ 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 capscale (vegan)
Hi Gavin, I have been analyzing real data (sorry but I am not allowed to post these data here) and what I got was this, mydistmat_f.cap - capscale(distmat_f ~ F + L + F:L, mfactors_frame) Warning messages: 1: some of the first 30 eigenvalues are 0 in: cmdscale(X, k = k, eig = TRUE, add = add) 2: Se han producido NaNs in: sqrt(ev) mydistmat_f.cap Call: capscale(formula = distmat_f ~ F + L + F:L, data = mfactors_frame) Inertia Rank Total 0.3758 Constrained0.21104 Unconstrained 0.16484 Inertia is squared distance Some constraints were aliased because they were collinear (redundant) Eigenvalues for constrained axes: CAP1 CAP2 CAP3 CAP4 1.679e-01 2.954e-02 1.349e-02 1.233e-05 Eigenvalues for unconstrained axes: MDS1 MDS2 MDS3 MDS4 1.388e-01 2.601e-02 4.076e-05 2.064e-07 So, by these results I can tell that there are 4 axes that explain 0.1648 of the total variance and another 4 axes that explain 0.2110 of the total variance. But I don't understand the difference between constrained and unconstrained. anova(mydistmat_f.cap) Permutation test for capscale under direct model Model: capscale(formula = distmat_f ~ F + L + F:L, data = mfactors_frame) DfVar F N.Perm Pr(F) Model 4 0.21 1.2798 400.00 0.0875 . Residual 4 0.16 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 summary(anova(mydistmat_f.cap)) Df Var F N.PermPr(F) Min. :4 Min. :0.1648 Min. :1.280 Min. :200 Min. :0.12 1st Qu.:4 1st Qu.:0.1764 1st Qu.:1.280 1st Qu.:200 1st Qu.:0.12 Median :4 Median :0.1879 Median :1.280 Median :200 Median :0.12 Mean :4 Mean :0.1879 Mean :1.280 Mean :200 Mean :0.12 3rd Qu.:4 3rd Qu.:0.1994 3rd Qu.:1.280 3rd Qu.:200 3rd Qu.:0.12 Max. :4 Max. :0.2110 Max. :1.280 Max. :200 Max. :0.12 NA's :1.000 NA's : 1 NA's :1.00 Then, I want to know the sum of squares of anova to check with other analysis that we performed but I can't see them by the output of anova. Besides, I am wondering if there is any manner to identify the main effects, factor effects and interaction in this anova analysis. I would be very grateful if you could help me to understand these results. Thank you very much, Alicia __ 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] NaN with ccf() for vector with all same element
The denominator holds the variance and since the variance is zero you get that. Calculate the covariance instead of the correlation: ccf(x, y, plot = FALSE, type = cov) On 11/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hello, i have been using ccf() to look at the correlation between lightning and electrogamnetic data. for the most part it has worked exactly as expected. however, i have come across something that puzzles me a bit: x - c(1, 0, 1, 0, 1, 0) y - c(0, 0, 0, 0, 0, 0) ccf(x, x, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 0.333 -0.500 0.667 -0.833 1.000 -0.833 0.667 -0.500 0.333 ccf(x, y, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 NaN NaN NaN NaN NaN NaN NaN NaN NaN y - c(1, 1, 1, 1, 1, 1) ccf(x, y, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 NaN NaN NaN NaN NaN NaN NaN NaN NaN i don't see why the result from ccf() would be NaN if the elements of y are all the same... perhaps i am just being silly or missing something. but if i work this out by hand, then i get a proper result. so, why not with ccf()? thanks for the help! best regards, andrew. -- Andrew B. Collier Space Physics Group Hermanus Magnetic Observatory Antarctic Research Fellow tel: +27 31 2601157 Space Physics Research Institutefax: +27 31 2616550 University of KwaZulu-Natal, Durban, 4041, South Africa gsm: +27 83 3813655 __ 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 capscale (vegan)
On Mon, 2006-11-27 at 15:37 +0100, Alicia Amadoz wrote: Hi Gavin, I have been analyzing real data (sorry but I am not allowed to post these data here) and what I got was this, mydistmat_f.cap - capscale(distmat_f ~ F + L + F:L, mfactors_frame) I believe you can write that formula as: distmat_f ~ F * L Warning messages: 1: some of the first 30 eigenvalues are 0 in: cmdscale(X, k = k, eig = TRUE, add = add) 2: Se han producido NaNs in: sqrt(ev) Sorry, I don't know enough about this method to know whether this a problem you should worry about or not. You should read up on the method some more to decide if the first warning is something you should be worried about. IIRC, negative eigenvalues are to be expected with this method as they are handled explicitly by capscale, and as this is a warning coming from cmdscale(), I suspect it is a helpful feature of that function, which you don't need to worry about when used in capscale(). mydistmat_f.cap Call: capscale(formula = distmat_f ~ F + L + F:L, data = mfactors_frame) Inertia Rank Total 0.3758 Constrained0.21104 Unconstrained 0.16484 Inertia is squared distance Some constraints were aliased because they were collinear (redundant) Eigenvalues for constrained axes: CAP1 CAP2 CAP3 CAP4 1.679e-01 2.954e-02 1.349e-02 1.233e-05 Eigenvalues for unconstrained axes: MDS1 MDS2 MDS3 MDS4 1.388e-01 2.601e-02 4.076e-05 2.064e-07 So, by these results I can tell that there are 4 axes that explain 0.1648 of the total variance and another 4 axes that explain 0.2110 of the total variance. But I don't understand the difference between constrained and unconstrained. The constrained axes are axes that are linear combinations of your explanatory variables (F, L and F:L), so this is the bit of your genomic data that is explained by those explanatory factors. The unconstrained bit is the remaining variance not explained, and are MDS (PCoord) axes. So you can explain c. 56% of the variance in your genomic data with F, L, and F:L. Note the warning about aliased constraints - this means that at least the variance of one variable in the model (inc interactions) is completely correlated with another variable (or combination of variables?) and is redundant. Type alias(mydistmat_f.cap) to see which coefficients are aliased and ?alias to see what this means. anova(mydistmat_f.cap) Permutation test for capscale under direct model Model: capscale(formula = distmat_f ~ F + L + F:L, data = mfactors_frame) DfVar F N.Perm Pr(F) Model 4 0.21 1.2798 400.00 0.0875 . Residual 4 0.16 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 summary(anova(mydistmat_f.cap)) Df Var F N.PermPr(F) Min. :4 Min. :0.1648 Min. :1.280 Min. :200 Min. :0.12 1st Qu.:4 1st Qu.:0.1764 1st Qu.:1.280 1st Qu.:200 1st Qu.:0.12 Median :4 Median :0.1879 Median :1.280 Median :200 Median :0.12 Mean :4 Mean :0.1879 Mean :1.280 Mean :200 Mean :0.12 3rd Qu.:4 3rd Qu.:0.1994 3rd Qu.:1.280 3rd Qu.:200 3rd Qu.:0.12 Max. :4 Max. :0.2110 Max. :1.280 Max. :200 Max. :0.12 NA's :1.000 NA's : 1 NA's :1.00 Then, I want to know the sum of squares of anova to check with other analysis that we performed but I can't see them by the output of anova. Besides, I am wondering if there is any manner to identify the main effects, factor effects and interaction in this anova analysis. I would be very grateful if you could help me to understand these results. There isn't a summary method for anova.cca, and anyway, this anova isn't working on sums of squares, but on other measures of variance. It is a permutation test, and simply works out with brute force how likely you are to have a model explaining 56% of the total variance given your sample size and model complexity, under a null/random model. It sounds like you haven't grasped fully the fundamentals of the methods you are employing, and I would strongly advise you to do some more reading up on these methods. I can, at best, only guide you as I am not that familiar with the technique myself. A good start would be the refs in ?capscale and then search for papers that cite Anderson Willis and that use the methodology. Thank you very much, Alicia HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
[R] [R-pkgs] kernlab 0.9-0 on CRAN
A new version of kernlab has just been released. kernlab is a kernel-based Machine Learning package for R. kernlab includes the following functions: o ksvm() : Support Vector Machines for classification, regression, novelty detection, native multi-class classification, support for class-probability output and confidence intervals in regression. o gausspr() : Gaussian Processes for classification and regression o lssvm() : Least Squares Support Vector Machines for classification o rvm() : Relevance Vector Machines for regression o specc() : Spectral Clustering o kkmeans() : Kernel k-means clustering o ranking() : Kernel-based ranking method o onlearn() : Kernel-based Online Learning algorithms for classification, novelty detection and regression o kpca() : Kernel Pricipal Components Analysis o kcca() : Kernel Canonical Correlation Analysis o kfa() : Kernel Feature Analysis o sigest() : Hyperparameter estimation for the Gaussian and the Laplacian kernels o inchol() : Incomplete Cholesky decomposition method o csi() : Cholesky decomposition with side information o ipop() : Interior point-based Quadratic Optimizer Kernlab also includes a range of functions enabling the easy implementation of new kernel methods including functions for computing commonly used kernel expressions (e.g. kernel matrix, kernel expansion, etc.) and implementations of nine kernels (e.g. Linear, Gaussian, Polynomial, Sigmoid, Laplace, String kernels, etc.) which can be used with any of the functions included in the package. Ready computed kernel matrices and user defined kernel functions can also be used. kernlab is based on the S4 object model. A vignette describing a large portion of the functions and features is included. cheers Alexandros ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] NaN with ccf() for vector with all same element
On Mon, 27 Nov 2006, [EMAIL PROTECTED] wrote: hello, i have been using ccf() to look at the correlation between lightning and electrogamnetic data. for the most part it has worked exactly as expected. however, i have come across something that puzzles me a bit: x - c(1, 0, 1, 0, 1, 0) y - c(0, 0, 0, 0, 0, 0) ccf(x, x, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 0.333 -0.500 0.667 -0.833 1.000 -0.833 0.667 -0.500 0.333 ccf(x, y, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 NaN NaN NaN NaN NaN NaN NaN NaN NaN y - c(1, 1, 1, 1, 1, 1) ccf(x, y, plot = FALSE) Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 NaN NaN NaN NaN NaN NaN NaN NaN NaN i don't see why the result from ccf() would be NaN if the elements of y are all the same... perhaps i am just being silly or missing something. but if i work this out by hand, then i get a proper result. so, why not with ccf()? How do you get a non-zero value for the variance of y? Dividing zero by zero is NaN, and that is what is happening here. -- 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 and provide commented, minimal, self-contained, reproducible code.
[R] Using a specified splitting criterion in tree and rpart
Dear all I'm interested in fitting a classification tree by using a user-specified splitting criterion. If I am right, Tree package allows to use only deviance or gini while the rpart package offers the possibility to specify, in the parms optional parameters for the splitting function, the component split (index) that can be chosen between gini and information. Does someone can suggest me some documentation I can have a look do define my splitting criterion and pass it to rpart ? Thanks Paolo Paolo Radaelli Dipartimento di Metodi Quantitativi per le Scienze Economiche ed Aziendali Facoltà di Economia Università degli Studi di Milano-Bicocca P.zza dell'Ateneo Nuovo, 1 20126 Milano Italy e-mail [EMAIL PROTECTED] Tel +39 02 6448 3163 Fax +39 02 6448 3105 __ 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] EM algorithm for truncated multivariate mixture of normals
I couldn't find a direct answer in CRAN to this question, so I'm asking with some trepidation. I have a multivariate dataset (data.frame) with columns that can be expressed as a set of mixed normals (at least I think) and need to impute values that have constraints (truncated mixture of normals where the values cannot be below zero). If there isn't a package that can do this, is there a package similar to em.norm() that can be used for truncated data? I'm not sure if this is a pie in the sky question or not. Thanks, Jeff. __ 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] ANN: BioC Advanced Course, Jan 10-12 in Seattle
Hello all, We will be holding an advanced BioC course January 10th-12th in Seattle. Lectures will be based on content from _Bioinformatics and Computational Biology Solutions Using R and Bioconductor_. During the hands-on labs, attendees will learn how to use R and Bioconductor to: * perform quality assessment on microarray experiments * use Hypergeometric and GSEA tools for carrying out downstream analyses * integrate related, but different microarray experiments For more information and details on registering for this course, please visit: https://secure.bioconductor.org/biocadv/ + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ 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] Questions about generating samples in R
Further to Alexander's question ... could anyone provide assistance with random stratified sampling? Let's say we have Alex's dataframe and we want to stratify the random selection by group membership (which is contained in one of the eight columns). We might want to randomly select: 1) a constant number (e.g., 5) of rows from each group, or 2) a percentage (e.g. 10%) of rows from each group resulting in groups being represented proportionally in the sample (with respect to the population). I am aware of stratsrs but this function does not seem to allow the second of the above two options. Any ideas how to achieve this in R? Thanks, Mark On 11/26/06, Alexander Geisler [EMAIL PROTECTED] wrote: Hello! I have a data set with 8 columns and in about 5000 rows. What I want to do is to generate samples of this data set. Samples of a special size, as example 200. What is the easiest way to do this? No special things are needed, only the random selection of 200 rows of the data set. Thanks Alex -- Alexander Geisler * Kaltenbach 151 * A-6272 Kaltenbach email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 | skpye: al1405ex __ 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] calling R from cmd line, loading in data sets on the call
Hi - I have read the archives on R cmd and passing parameters, and I guess I am not totally clear if that solved this problem ... I would like to call an R script from the command line, and in the process pass in data sets and parameters ... right now, I manually specify the files to be read in as the data sets for the script, and then it processes, but I need to be able to automate this action from the cmd line. Rcmd myprogram.R is clearly documented as unable to take parameters passed to it ... I am on Windows, R 2.3.1 Thanks Matt [[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] RSQLite basic
Hi. I am still trying to figure out how connection and RSQLIte function. When i run the following commands library(RSQLite) m - dbDriver(SQLite, max.con = 25) con - dbConnect(m, dbname=sqlite.db) on my windows laptop everthing works fine. For example: m - dbDriver(SQLite, max.con = 25) con - dbConnect(m, dbname=sqlite.db) version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 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) However, this gives all kinds of errors when I run it on a linux box and I am not sure what the error message is telling me. I thought I'd crave your indulgence and ask for advice. m - dbDriver(SQLite, max.con = 25) con - dbConnect(m, dbname=sqlite.db) Error in sqliteNewConnection(drv, ...) : RS-DBI driver: (could not connect to dbname sqlite.db ) version _ platform i686-pc-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) thanks - the nerdy. _ Share your latest news with your friends with the Windows Live Spaces friends module. __ 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] automatic cleaning of workspace
I'm having that problem where I am sometimes using an object that's from a previous workspace when I don't want to be doing that. I was thinking of putting rm(objects=ls()) in my first.R function But, the problem with doing this, is that it doesn't prompt you with are you sure and there could be very rare cases where I don't want to delete the workspace ? Is there a way to make the cleaning of the workspace automatic but still prompt you ? I guess I can always just try to remember to manually do rm(objects=ls())when I start up in whatever workspace I am in but I don't think I can trust my memory. Thanks. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ 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] [R-sig-Geo] plot() and Jpeg() increase font size and resolution
Hi Edzer, png also does not increase the file size. Following the commands. The data are located at ftp://ftp.csiro.au/Herry, file qldproperty.Rdata. trellis.par.get(fontsize)-fontsize fontsize$default-16 fontsize$points-16 fontsize$text-18 trellis.par.set(fontsize,fontsize) trellis.par.get(fontsize) plot(v1,plot.number=F, model=m2, ylim=c(4,9)) plt1-plot(v1,plot.number=F, model=m1, ylim=c(4,9), col=black, pch=+, scales=list(cex=1.5,)) jpeg(file=LOTPLAN_variogram_mod.png, bg=white, res=300, pointsize=16, width=800, height=800) plt1 dev.off() XXX SessionInfo: R version 2.4.0 (2006-10-03) i686-pc-linux-gnu locale: LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=en_US;LC_MONETARY=e n_US;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHON E=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: geoRgstat MCMCpack MASS coda lattice 1.6-11 0.9-34 0.7-4 7.2-29 0.10-7 0.14-13 mcmc RColorBrewer maps maptools sp foreign 0.5-1 0.2-3 2.0-32 0.6-3 0.9-4 0.8-17 spatial 7.2-29 Thanks Herry Dr Alexander Herr Spatial and statistical analyst CSIRO, Sustainable Ecosystems Davies Laboratory, University Drive, Douglas, QLD 4814 Private Mail Bag, Aitkenvale, QLD 4814 Phone/www (07) 4753 8510; 4753 8650(fax) Home: http://herry.ausbats.org.au Webadmin ABS: http://ausbats.org.au Sustainable Ecosystems: http://www.cse.csiro.au/ -Original Message- From: Edzer J. Pebesma [mailto:[EMAIL PROTECTED] Sent: Monday, November 27, 2006 5:34 PM To: Herr, Alexander Herr - Herry (CSE, Townsville) Cc: r-help@stat.math.ethz.ch; r-sig-geo@stat.math.ethz.ch Subject: Re: [R-sig-Geo] plot() and Jpeg() increase font size and resolution [EMAIL PROTECTED] wrote: Thanks to Edzer and Roger, I can now plot with increased font sizes. However, jpeg still does not reproduce these, nor does it show up in high quality. What I would like to do is produce some highresolution jpegs. Please specify the commands that you used, preferrably such that we can reproduce them, and specify which worked and which didn't the way you expected. Also please give the output of sessionInfo(), and tell us the platform you work on. Have you tried producing png, did that work? -- Edzer Any help would be appreciated Thanx Herry R2.4 on Mandriva 10.2 linux. Dr Alexander Herr Spatial and statistical analyst CSIRO, Sustainable Ecosystems Davies Laboratory, University Drive, Douglas, QLD 4814 Private Mail Bag, Aitkenvale, QLD 4814 Phone/www (07) 4753 8510; 4753 8650(fax) Home: http://herry.ausbats.org.au Webadmin ABS: http://ausbats.org.au Sustainable Ecosystems: http://www.cse.csiro.au/ -Original Message- From: Edzer J. Pebesma [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 5:37 PM To: Herr, Alexander Herr - Herry (CSE, Townsville) Cc: r-help@stat.math.ethz.ch; r-sig-geo@stat.math.ethz.ch Subject: Re: [R-sig-Geo] plot() and Jpeg() increase font size and resolution plotting variograms in gstat is done through xyplot in lattice; you'll find where it gets it's defaults by library(lattice) trellis.par.get() ?trellis.par.set -- Edzer [EMAIL PROTECTED] wrote: Dear list, I am having troubles increasing the fontize when plotting a variogram{gstat} and its model (vgm) with plot and using jpeg(). Also the resolution in the jpeg call does not work. I am using R2.4 on Mandriva 10.2 linux. I can change fontsize with cex.axis in a normal plot, so I presume it has to do with plotting the variogram model. Any help on how to increase the font size and resolution would be appreciated? R-calls: v1-variogram(log(z)~x+y, loc=coordinates(shp1),data=shp1) m1-vgm(0.0175, Gau, 20,0.052) jpeg(file=LOTPLAN_variogram_mod.jpg, bg=white, res=300, pointsize=16, width=1200, height=1200, quality=100) plot(v1,plot.number=F, model=m1, ylim=c(0.04,0.08), col=black, cex.axis=1.5) dev.off() Thanks Herry Dr Alexander Herr Spatial and statistical analyst CSIRO, Sustainable Ecosystems Davies Laboratory, University Drive, Douglas, QLD 4814 Private Mail Bag, Aitkenvale, QLD 4814 Phone/www (07) 4753 8510; 4753 8650(fax) Home: http://herry.ausbats.org.au Webadmin ABS: http://ausbats.org.au Sustainable Ecosystems: http://www.cse.csiro.au/ ___ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[R] comments in scan
I had a question about scan in R. For better code readability, I would like to have lines in the block of data to be scanned that are commented - not just lines that have a comment at the end. For example #age, weight, height 33,128,65 34,56,155 instead of having to do something like 33,128,65 #age, weight, height 34,56,155 Is this at all possible? __ 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] automatic cleaning of workspace
On Mon, 2006-11-27 at 18:29 -0500, Leeds, Mark (IED) wrote: I'm having that problem where I am sometimes using an object that's from a previous workspace when I don't want to be doing that. I was thinking of putting rm(objects=ls()) in my first.R function But, the problem with doing this, is that it doesn't prompt you with are you sure and there could be very rare cases where I don't want to delete the workspace ? Is there a way to make the cleaning of the workspace automatic but still prompt you ? I guess I can always just try to remember to manually do rm(objects=ls())when I start up in whatever workspace I am in but I don't think I can trust my memory. Thanks. I assume you are saving your workspace when exiting R, and then when restarting R in same directory it is auto loading the saved workspace? If so, try not saving the workspace at the end of the session when quitting, but explicitly save the objects you wish to save using save() and load() it when restarting. You might need to locate and delete the file .Rdata in the working directory first, before you start R for example, to stop it being loaded when you start R again. Alternatively, give it a new name with a .Rdata extension, so you can load the workspace again if needed. You might also want save.image if you are interested in saving workspaces rather than individual objects. This way you are in control of what is and is not saved/reloaded and you won't have to rely on your memory. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] comments in scan
On 11/27/2006 7:25 PM, Jarrett Byrnes wrote: I had a question about scan in R. For better code readability, I would like to have lines in the block of data to be scanned that are commented - not just lines that have a comment at the end. For example #age, weight, height 33,128,65 34,56,155 instead of having to do something like 33,128,65 #age, weight, height 34,56,155 Is this at all possible? If it's on the first line, it's easy: just use skip=1 to skip the first line. The general case #age, weight, height 33,128,65 # and now for something completely different 34,56,155 probably needs something like this: scan(foo, what=list(0,0,0), comment.char=#, sep=,, multi.line=T) i.e. you need to tell it how many objects are in a record, and allow records to span multiple lines. Watch out for typos in the file that put different numbers of entries on each line, because scan() won't complain about it. Duncan Murdoch __ 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] automatic cleaning of workspace
I believe the usal advice here is to store data and associated functions together in separate .Rdata datasets (workspaces) via ?save. You can ?load them as needed. Bert Gunter Genentech Nonclinical Statistics South San Francisco, CA 94404 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leeds, Mark (IED) Sent: Monday, November 27, 2006 3:30 PM To: r-help@stat.math.ethz.ch Subject: [R] automatic cleaning of workspace I'm having that problem where I am sometimes using an object that's from a previous workspace when I don't want to be doing that. I was thinking of putting rm(objects=ls()) in my first.R function But, the problem with doing this, is that it doesn't prompt you with are you sure and there could be very rare cases where I don't want to delete the workspace ? Is there a way to make the cleaning of the workspace automatic but still prompt you ? I guess I can always just try to remember to manually do rm(objects=ls())when I start up in whatever workspace I am in but I don't think I can trust my memory. Thanks. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ 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] RSQLite +textConnection()
Hi ! I am trying to read in 1000 really small text files. When on adams, R bails out after reading 125 files with the error message Error in textConnection(readLines(f, n = 2)) : all connections are in use I have traced this to a call to the scan() function which is at that point trying to read tge 126th data file. I have tried specifically closing each connection i open after loading a file to avoid this. But that fails and I get the same error message. I googled and hit on a conversation between Professor Ripley and Dirk Eddelbuettel https://stat.ethz.ch/pipermail/r-sig-db/2006-July/000208.html that talks about a similar problem - there the suggestion made which apparently worked was to fix a function called mysqlImportFile(). But i dont see this function being even in memory now. Peculiarly, I am able to read upto 200 files when i am in windows. I am hoping someone with more expereince with linux and/or RSQLite will have some suggestions. thanks! Alex _ Fixing up the home? Live Search can help __ 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] RSQLite basic
Hi Seth, I didn't realize that this conversation went off the list with Bentilon. It turns out the source of the problem was that I was trying to write into a linux sub-directory to which I didn't have write permissions. I am able to read and write now using dbWriteTale() thanks for suggesting using sessionInfo() - i didn't know of the command. Al From: Seth Falcon [EMAIL PROTECTED] To: Alexander Nervedi [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] RSQLite basic Date: Mon, 27 Nov 2006 16:47:40 -0800 Hi Alexander, Alexander Nervedi [EMAIL PROTECTED] writes: However, this gives all kinds of errors when I run it on a linux box and I am not sure what the error message is telling me. I thought I'd crave your indulgence and ask for advice. m - dbDriver(SQLite, max.con = 25) con - dbConnect(m, dbname=sqlite.db) Error in sqliteNewConnection(drv, ...) : RS-DBI driver: (could not connect to dbname sqlite.db ) What is your working directory when you run this command? getwd() will tell you. You should verify that you have write access there. Does sqlite.db already exist? If so, was it created with a different version of sqlite than you are running? Which brings me to: it would be helpful to see the output of sessionInfo() so we know what versions of DBI and RSQLite you are running. + seth _ Share your latest news with your friends with the Windows Live Spaces friends module. __ 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] RSQLite basic
Hi Alexander, Alexander Nervedi [EMAIL PROTECTED] writes: However, this gives all kinds of errors when I run it on a linux box and I am not sure what the error message is telling me. I thought I'd crave your indulgence and ask for advice. m - dbDriver(SQLite, max.con = 25) con - dbConnect(m, dbname=sqlite.db) Error in sqliteNewConnection(drv, ...) : RS-DBI driver: (could not connect to dbname sqlite.db ) What is your working directory when you run this command? getwd() will tell you. You should verify that you have write access there. Does sqlite.db already exist? If so, was it created with a different version of sqlite than you are running? Which brings me to: it would be helpful to see the output of sessionInfo() so we know what versions of DBI and RSQLite you are running. + seth __ 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] comments in scan
From ?scan : If |comment.char| occurs (except inside a quoted character field), it signals that the rest of the line should be regarded as a comment and be discarded. Lines beginning with a comment character (possibly after white space with the default separator) are treated as blank lines. So, set comment.char=# and you should be fine. Cheers, Simon. Jarrett Byrnes wrote: I had a question about scan in R. For better code readability, I would like to have lines in the block of data to be scanned that are commented - not just lines that have a comment at the end. For example #age, weight, height 33,128,65 34,56,155 instead of having to do something like 33,128,65 #age, weight, height 34,56,155 Is this at all possible? __ 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. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ 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] pivot algorithm
I am trying to simulate a self avoiding random walk in 2d of length 100. So I am using two vectors of length 100 to encode the x and y coordinates. At each step I want apply a orthogonal transformation at a random point and then check to see if the walk intersects with itself. This amounts to simply checking to see if any of the ordered pairs of (x,y) coordinates in 1:j are repeated in j+1:100. This seems like it should be really easy. But I cannot find a simple method. I have been calling the pivoted portion of the walk (xn[],yn[]) for(i in 1:j) for(m in {j+1}:100) if(xn[m]==x[i]) if(yn[m]==y[i]) dont_transform=1 else dont_transform=0 if(dont_transform==0) for(g in j:100) {x[g]=xn[g] ; y[g]=yn[g]} z=c(x,y) dim(z)=c(100,2) z maybe the right solution would be to use intersection() but I couldnt figure out how to make it work. Any advice would be appreciated. Thanks Seth Latimer -- View this message in context: http://www.nabble.com/pivot-algorithm-tf2715472.html#a7571334 Sent from the R help mailing list archive at Nabble.com. __ 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] comments in scan
You may want to set blank.lines.skip=TRUE too. Simon. From ?scan : If |comment.char| occurs (except inside a quoted character field), it signals that the rest of the line should be regarded as a comment and be discarded. Lines beginning with a comment character (possibly after white space with the default separator) are treated as blank lines. So, set comment.char=# and you should be fine. Cheers, Simon. Jarrett Byrnes wrote: I had a question about scan in R. For better code readability, I would like to have lines in the block of data to be scanned that are commented - not just lines that have a comment at the end. For example #age, weight, height 33,128,65 34,56,155 instead of having to do something like 33,128,65 #age, weight, height 34,56,155 Is this at all possible? __ 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. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ 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] RSQLite +textConnection()
Alexander Nervedi [EMAIL PROTECTED] writes: Hi ! I am trying to read in 1000 really small text files. When on adams, R bails out after reading 125 files with the error message Error in textConnection(readLines(f, n = 2)) : all connections are in use Please try updating your version of DBI and RSQLite, I believe this has been fixed. + seth __ 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] Questions about generating samples in R
On Mon, 27 Nov 2006, Mark Na wrote: Further to Alexander's question ... could anyone provide assistance with random stratified sampling? Let's say we have Alex's dataframe and we want to stratify the random selection by group membership (which is contained in one of the eight columns). We might want to randomly select: 1) a constant number (e.g., 5) of rows from each group, or 2) a percentage (e.g. 10%) of rows from each group resulting in groups being represented proportionally in the sample (with respect to the population). I am aware of stratsrs but this function does not seem to allow the second of the above two options. Any ideas how to achieve this in R? Suppose 'grp.numbers' holds the group identitities. Define wrappers for sample(): sample.just.5 - function(x) sample(x ,size = 5 ) sample.10.pct - function(x) sample(x,size=round(0.10*length(x))) Then use tapply: samples.of.5 - tapply(seq(along=grp.numbers),grp.numbers, sample.just.5 ) Check this with: table( grp.numbers[ unlist( samples.of.5 ) ] ) Again use tapply: samples.of.10.pct - tapply(seq(along=grp.numbers),grp.numbers, sample.10.pct ) Check this with: table( grp.numbers[ unlist( samples.of.10.pct ) ] ) There are loads of variations ... Thanks, Mark On 11/26/06, Alexander Geisler [EMAIL PROTECTED] wrote: Hello! I have a data set with 8 columns and in about 5000 rows. What I want to do is to generate samples of this data set. Samples of a special size, as example 200. What is the easiest way to do this? No special things are needed, only the random selection of 200 rows of the data set. Thanks Alex -- Alexander Geisler * Kaltenbach 151 * A-6272 Kaltenbach email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 | skpye: al1405ex __ 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. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ 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] RSQLite +textConnection()
They are uptodate. When I run it on windows the i can load upto 200 files, while on Linux it stops after loading 125. From: Seth Falcon [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: Re: [R] RSQLite +textConnection() Date: Mon, 27 Nov 2006 17:22:57 -0800 Alexander Nervedi [EMAIL PROTECTED] writes: Hi ! I am trying to read in 1000 really small text files. When on adams, R bails out after reading 125 files with the error message Error in textConnection(readLines(f, n = 2)) : all connections are in use Please try updating your version of DBI and RSQLite, I believe this has been fixed. + seth __ 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. _ by Pandora http://radio.msn.com/?icid=T002MSN03A07001 __ 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] comments in scan
Right, but what if it is not the first line? For example #data block 1 34,54,23 23,53,12 35,23,23 #data block 2 64,24,13 354,24,12 324,13,3 On Nov 27, 2006, at 4:39 PM, Duncan Murdoch wrote: On 11/27/2006 7:25 PM, Jarrett Byrnes wrote: I had a question about scan in R. For better code readability, I would like to have lines in the block of data to be scanned that are commented - not just lines that have a comment at the end. For example #age, weight, height 33,128,65 34,56,155 instead of having to do something like 33,128,65 #age, weight, height 34,56,155 Is this at all possible? If it's on the first line, it's easy: just use skip=1 to skip the first line. The general case #age, weight, height 33,128,65 # and now for something completely different 34,56,155 probably needs something like this: scan(foo, what=list(0,0,0), comment.char=#, sep=,, multi.line=T) i.e. you need to tell it how many objects are in a record, and allow records to span multiple lines. Watch out for typos in the file that put different numbers of entries on each line, because scan() won't complain about it. Duncan Murdoch __ 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] Slight discrepancy between predict.lm() and all.effects()
In the course of exploring response prediction, I stumbled upon a small discrepancy between the CIs produced by predict.lm() and all.effects() require(mlmRev) require(effects) hsb.lm - lm(mAch ~ minrty * sector, Hsb82) hsb.new - data.frame( minrty = rep(c('No', 'Yes'), 2), sector = rep(c('Public', 'Catholic'), each = 2)) hsb.eff - all.effects(hsb.lm) cbind( hsb.new, predict(hsb.lm, hsb.new, interval = 'confidence', type = 'response') ) # the following lower and upper bounds differ starting with the fourth decimal place data.frame( hsb.new, fit = hsb.eff[[1]]$fit, lwr = hsb.eff[[1]]$lower, upr = hsb.eff[[1]]$upper ) Is this due to rounding or algorithm? _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ __ 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] Fixed zeros in tables
A.R. Criswell [EMAIL PROTECTED] wrote: Hello Andrew Robinson and R-List Thanks, Andrew, but this does not work. Puttting zero weights on structural zeros, one's elsewhere in glm() does not deliver the appropriate expected cell counts loglm() provides as one would expect. If you run the code provided below, you'll see loglm() delivers zero cell counts with loglm() but using glm() with the weights you suggest, the expected cell counts are not zero. Still hoping for a resolution. Andrew Criswell Associate Professor Hedmark University Postboks 104, Rena 2510, NORWAY If they are structural zeros, I believe you want: glm(COUNT ~ CONCERNS + AGE + GENDER, data=health, subset=(WEIGHTS0), family=poisson) David Duffy. -- | David Duffy (MBBS PhD) ,-_|\ | email: [EMAIL PROTECTED] ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v __ 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] comments in scan
On 11/27/2006 9:23 PM, Jarrett Byrnes wrote: Right, but what if it is not the first line? If it's not the first line, then you should follow the instructions that start on the 4th line of my reply. Duncan Murdoch For example #data block 1 34,54,23 23,53,12 35,23,23 #data block 2 64,24,13 354,24,12 324,13,3 On Nov 27, 2006, at 4:39 PM, Duncan Murdoch wrote: On 11/27/2006 7:25 PM, Jarrett Byrnes wrote: I had a question about scan in R. For better code readability, I would like to have lines in the block of data to be scanned that are commented - not just lines that have a comment at the end. For example #age, weight, height 33,128,65 34,56,155 instead of having to do something like 33,128,65 #age, weight, height 34,56,155 Is this at all possible? If it's on the first line, it's easy: just use skip=1 to skip the first line. The general case #age, weight, height 33,128,65 # and now for something completely different 34,56,155 probably needs something like this: scan(foo, what=list(0,0,0), comment.char=#, sep=,, multi.line=T) i.e. you need to tell it how many objects are in a record, and allow records to span multiple lines. Watch out for typos in the file that put different numbers of entries on each line, because scan() won't complain about it. Duncan Murdoch __ 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] Open source electronic lab notebook with R-driven analysis
All, I thought you may be interested in hearing about the new web software we have developed. LabSynch is a fully integrated: - Electronic lab notebook - Web-based collaboration service - Sample tracking system - R-based data capture and analysis tool It is designed to help bench scientists record better information with less work and share complete experimental and analytical methods and data, in context. Check it out here: http://www.labsynch.com You can use it hosted on our site for free, or we can set up a private work area for you. It is also available as open source and runs on LAMP+R servers and OS X. Please contact me directly with questions etc, John email: [EMAIL PROTECTED] office: (858) 551-0459 skype: johnamcneil http://www.labsynch.com __ 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] RSQLite +textConnection()
Alexander Nervedi [EMAIL PROTECTED] writes: They are uptodate. When I run it on windows the i can load upto 200 files, while on Linux it stops after loading 125. Could you provide as much of a reproducible example as possible (along with sessionInfo())? I will try and have a look. + seth __ 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] LP Formulation of Preference Analysis
Dear All, I have posted a project on GetAFreelancer.com for a LINMAP (LINear programming techniques for multidimensional Analysis of Preference) R package. http://www.getafreelancer.com/projects/110792.html See if you are interested to bid. Redards, Marco LO USeebi Visual BI http://www.geocities.com/useebi - __ [[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.