Re: [R] survival survfit with newdata
Thanks David for prompt reply. I agree with you. However, I still fail to get the survfit function to work with newdata. In my previous example I changed the column names of testX matrix and I still fail. colnames(testX)-names(coxph.model$coefficients) sfit- survfit(coxph.model,newdata=data.frame(testX)) Error in model.frame.default(formula = Surv(trainTime, trainStatus) ~ : variable lengths differ (found for 'trainX') What would be solution in my simple example to get the survival curves for testX? Thanks in advance. DK CC: r-help@r-project.org From: dwinsem...@comcast.net To: dkrsta...@hotmail.com Subject: Re: [R] survival survfit with newdata Date: Thu, 17 May 2012 00:52:55 -0400 On May 16, 2012, at 5:08 PM, Damjan Krstajic wrote: Dear all, I am confused with the behaviour of survfit with newdata option. Yes. It has the same behavior as any other newdata/predict from regression. You need to supply a dataframe with the same names as in the original formula. Doesn't look as though that strategy is being followed. The name of the column needs to be 'trainX' since that was what was its name on the RHS of hte formula, and you may want to specify times. If you fail to follow those rules, the function falls back on offering estimates from the original data. I am using the latest version R-2-15-0. In the simple example below I am building a coxph model on 90 patients and trying to predict 10 patients. Unfortunately the survival curve at the end is for 90 patients. As is proper with a malformed newdata argument. Could somebody please from the survival package confirm that this behaviour is as expected or not - because I cannot find a way of using 'newdata' with really new data. Thanks in advance. DK x-matrix(rnorm(100*20),100,20) time-runif(100,min=0,max=7) status-sample(c(0,1), 100, replace = TRUE) trainX-x[11:100,] trainTime-time[11:100] trainStatus-status[11:100] testX-x[1:10,] coxph.model- coxph(Surv(trainTime,trainStatus)~ trainX) sfit- survfit(coxph.model,newdata=data.frame(testX)) dim(sfit$surv) [1] 90 90 [[alternative HTML version deleted]] __ R-help@r-project.org 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. David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] hu6800cdf
Hi, I'm using a command in bioconductor that seems to require a package called hu6800cdf. I've installed this properly but I still get the same error: Could not find array definition file ' hu6800cdf.qcdef '. Simpleaffy does not know the QC parameters for this array type. See the package vignette for details about how to specify QC parameters manually. I've tried specifying the cdfname file by using data-ReadAffy(cdfname=hu6800cdf) but it still returns the same error. The version of R that I'm using is 2.15 and the bioconductor version is 2.10. Does anyone know how to solve this? Thanks, srod -- View this message in context: http://r.789695.n4.nabble.com/hu6800cdf-tp4630337.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Error on easy way for JoSAE Package
I have attached to this message the first 20 lines of the output for dput(amigo). Unfortunately, i can't send it the overall output. Thank you. On Wed, May 16, 2012 at 6:10 PM, David Winsemius [via R] ml-node+s789695n4630253...@n4.nabble.com wrote: On May 16, 2012, at 1:33 AM, ana24maria wrote: Thank you very much. After using dput and the easy way ( result - eblup.mse.f.wrap(domain.data = amigo, lme.obj = fit.lme)), i have got the following error: Error in `[.data.frame`(sample.data, , variabs) : undefined columns selected What John was asking you to do was at your console just type: dput(amigo) ... and then copy the output to an email and send that to the list. Your first posting had data that was ambiguous as to content as well as mangled by the various email clients and servers that processed on the path to our eyes. What should I do? You should also read the Posting Guide. -- View this message in context: http://r.789695.n4.nabble.com/Error-on-easy-way-for-JoSAE-Package-tp4625684p4630220.html PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- David Winsemius, MD West Hartford, CT __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4630253i=0mailing 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. -- If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Error-on-easy-way-for-JoSAE-Package-tp4625684p4630253.html To unsubscribe from Error on easy way for JoSAE Package, click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4625684code=YW5hMjRtYXJpYUBnbWFpbC5jb218NDYyNTY4NHwxNzE3MDQ5Njc1 . NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://r.789695.n4.nabble.com/Error-on-easy-way-for-JoSAE-Package-tp4625684p4630339.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Job opportunity in Beijing, China at Xian-Janssen Pharmaceutical Ltd
The Quantitative Decision Strategies group at Janssen Research Development, Johnson Johnson, is looking for a candidate to represent QDS in Beijing, China in the subsidiary company of Xian-Janssen Pharmacetical Ltd. The basic requirements for this candidate are 1) 3+ years experience in a quantitative field, but not necessarily pharmaceutical; 2) PhD in statistics or related field preferred but not absolutely necessary; 3) speak fluent Chinese and English but willing to be located in Beijing; 4) excellent communications skill. The full job description follows, if interested, please send resume directly to Liwei Wang [lwan...@its.jnj.com] https://jnjc.taleo.net/careersection/2/jobdetail.ftl?lang=enjob=03XM Senior Quantitative Scientist-03XM Description PRINCIPAL RESPONSIBILITIES: List major responsibilities and duties of the position. List most complex or difficult parts of job first and indicate percentage of time required to perform each task. Describe those quantitative aspects of the position which reflect measures that are applicable to the position's major responsibilities or end results. (TYPE BELOW THIS LINE) Support for broad implementation of innovative approaches: Implement strategy for promoting the broader utilization of innovative approaches across the development portfolio, through coordinated efforts involving clinical, operational, regulatory areas. Bring together key stakeholders from different key areas, identify potential hurdles for broader use of innovation in drug development and participate in finding solutions for them. Collaborate in talent identification for QDS group, hiring and development. Ensure focus on innovation is maintained in QDS group. Evaluate and implement innovative approaches: participate in hands-on implementation of innovative approaches, through direct interactions with clinical teams and other relevant groups. This involves, but is not limited to planning, running, and summarizing simulation studies to evaluate the operating characteristics of alternative designs and methods; and participating in the implementation of the selected approaches by engaging in protocol and SAP write-up. Engage external consultants and qualified CROs to provide support in the development and implementation of innovative methods, supervising them as needed. Identification of opportunities for innovation: participate in CDP reviews/discussions; interact directly with clinical teams and therapeutic area representatives for early identification of opportunities for innovative approaches. Assess feasibility and help establish prioritization of identified opportunities. Ensure implementation of selected opportunities Ensuring proper knowledge and awareness of innovative methods and designs: help identify, develop, organize, provide and/or arrange training and presentations on innovative approaches across the Development organization (including statisticians, modelers, clinicians, and other stakeholder groups) to ensure awareness and adequate knowledge about these methods. Keep up-to-date knowledge of designs and analysis methods for clinical trials, including adaptive designs, model-based methods, etc. External collaborations, visibility, and impact: engage in external collaborations within professional associations, participating in working groups, organizing sessions and presenting at scientific meetings, and publishing in peer reviewed journals. Influence the pharmaceutical industry and regulatory environments, by engaging in scientific advocacy working groups and committees. Qualifications Doctorate (Ph.D.) in statistics or related field, with a minimum of 3 years experience in drug development and/or applied quantitative methods for decision making, significant knowledge of scientific programming Familiarity with industry principles of drug development, modeling and simulation, clinical pharmacology, clinical trial design and regulatory guidelines. Sound knowledge of biostatistics applied to clinical trials and model-based drug development. Working knowledge of statistical software, such as SAS, R, and S-PLUS, WinBugs Have experience with trial simulations to design and document adaptive trials and have working knowledge of Bayesian methods. Stay current with the latest statistical methodologies with focus on trial optimization, simulation and adaptive designs. Good verbal and written communication skills, including formal presentation skills. Experience presenting to technical and lay groups at public meetings desirable. Written skills as evidenced by publication and journal articles also desirable. Ability to successfully multi-task and work independently, under minimal supervision; excellent teamwork skills. Ability to influence,
[R] step function stops with subscript out of bounds
I've been having a problem using the step function to evaluate models. I've simplified the code and get the same problem using the dataset Titanic. The relevant code and output is below. The problem disappears (i.e., 'step' runs correctly) if I rerun the code but change the 'loglm' call to explicitly reference Titanic instead of X (as in: loglm(as.formula(Y),data=Titanic)). What is causing this? TIA, DAV -- catn-function(...) cat(...,\n) local({ X-Titanic; print(class(X)); Y-paste('~',paste(names(dimnames(X)),collapse=*)); print(Y); sm-loglm(as.formula(Y),data=X); catn(SM); print(sm); catn('running'); step(sm,direction='backward') }) Output: [1] table [1] ~ Class*Sex*Age*Survived SM Call: loglm(formula = as.formula(Y), data = X) Statistics: X^2 df P( X^2) Likelihood Ratio 0 01 Pearson NaN 01 running Start: AIC=64 ~Class * Sex * Age * Survived Error in loglin(data, margins, start = start, fit = fitted, param = param, : subscript out of bounds Enter a frame number, or 0 to exit 1: local({ X - Titanic print(class(X)) Y - paste(~, paste(names(dimnames(X)), collapse = *)) print(Y) sm - loglm(as.formula(Y), data = X 2: eval.parent(substitute(eval(quote(expr), envir))) 3: eval(expr, p) 4: eval(expr, envir, enclos) 5: eval(quote({ X - Titanic print(class(X)) Y - paste(~, paste(names(dimnames(X)), collapse = *)) print(Y) sm - loglm(as.formula(Y), dat 6: eval(expr, envir, enclos) 7: #1: step(sm, direction = backward) 8: #1: drop1(fit, scope$drop, scale = scale, trace = trace, k = k, ...) 9: #1: drop1.default(fit, scope$drop, scale = scale, trace = trace, k = k, ...) 10: #1: update(object, as.formula(paste(~ . -, tt)), evaluate = FALSE) 11: #1: update.loglm(object, as.formula(paste(~ . -, tt)), evaluate = FALSE) 12: #1: eval.parent(call) 13: #1: eval(expr, p) 14: #1: eval(expr, envir, enclos) 15: #1: loglm(formula = ~Class + Sex + Age + Survived + Class:Sex + Class:Age + Sex:Age + Class:Survived + Sex:Survived + Age:Survived + Class:Sex:Age + Class: 16: #1: loglm1(formula, data, ..., .call = .call, .formula = .formula) 17: #1: loglm1.default(formula, data, ..., .call = .call, .formula = .formula) 18: #1: loglin(data, margins, start = start, fit = fitted, param = param, eps = eps, iter = iter, print = print) Selection: 0 __ R-help@r-project.org 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] oldlogspline probabilities
I using oldlogspline (from logspline package) to model data distributions, and having a problem. My data are search area sizes. They are based on circular search radii from random points to the nearest edge of the nearest grass tussock. Search area sizes are distributed from 0 (the random point intercepts a tussock) and upwards (as points are further from any tussocks). The density of all my distributions (using doldlogspline) are highest at size=0, and decline as search area increases. I am most interested in the probability of a value in the distribution being equal to 0 (ie probability of a direct hit on a tussock). I know I can just use the proportion of actual hits, but am curious to compare this to an estimate from a density estimation. Unfortunately when using poldlogspline, this probability is always=0 (simulated data example is below). How can this be, given that the density is highest at area=0? simdat-c(rep(0,8),rexp(92)) myspline-oldlogspline(simdat,lbound=0) poldlogspline(fit=myspline, q=0) [1] 0 Any help to work out the probability of an area value in my distribution = 0 would be appreciated Terry Beutel Agri-Science Queensland [[alternative HTML version deleted]] __ R-help@r-project.org 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] trouble with multi statement queries
Using both RMySQL or RODBC packages I can connect to a mySQL database and return results from simple queries. However, I cannot return anything from queries even with just two lines, each ending with semicolons. Using RMySQL, the latter yields a message about an error in mysqlFetch, RS-DBI driver, corrupt resultSet, missing fieldDescription. Using RMySQL I have set the client.flag=CLIENT_MULTI_STATEMENTS but to no avail. I am running Debian Squeeze. Please help -- View this message in context: http://r.789695.n4.nabble.com/trouble-with-multi-statement-queries-tp4630341.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to sum and group data by DATE in data frame
Thank you, Michael :) Michael Weylandt wrote If that doesn't nail it down, I'll need you to answer the questions I asked in my previous email. Previously I made a mistake with *dput()*, this is the correct output: dput(X) new(timeSeries , .Data = structure(c(124.3, 124.38, 124.67, 125.19, 124.9, 125.27, 125.5, 125.58, 125.91, 125.8, 125.83, 126.215, 126.25, 126.25, 124.901, 124.43, 124.4654, 124.46, 124.68, 124.86, 124.73, 125.22, 125.48, 125.5601, 125.4091, 125.15, 125.43, 125.481, 125.91, 125.29, 124.79, 124.77, 124.7, 124.37, 124.56, 124.86, 125.3, 125.59, 125.95, 125.73, 126.27, 126.26, 127.33, 126.37, 126.46, 126, 126.06, 126.2662, 126.23, 126.4499, 127.12, 127.48, 127.49, 127.69, 127.88, 127.88, 124.51, 124.42, 124.92, 125.18, 125.23, 124.81, 125.07, 124.61, 123.8869, 123.24, 123.3329, 123.6, 123.19, 123.161, 123.96, 123.58, 123.42, 123.68, 124.19, 123.985, 124.24, 124.61, 124.6566, 124.18, 123.795, 124.36, 124.32, 124.32, 126.1101, 126.42, 126.8181, 126.79, 126.675, 126.68, 126.685, 126.725, 126.65, 126.77, 126.55, 126.63, 126.67, 126.66, 125.8829, 126.05, 125.97, 125.99, 125.59, 125.21, 125.31, 125.46, 125.39, 125.23, 124.93, 125.32, 125.46, 125.46, 125.62, 125.34, 125.163, 125.01, 125.115, 125.67, 126.08, 126.15, 126.33, 126.19, 126.3955, 126.71, 126.083, 126.083, 125.23, 124.96, 125.595, 125.77, 125.4, 125.38, 125.54, 126.01, 126.05, 126.01, 125.72, 124.79, 124.05, 124.08, 123.35, 123.85, 123.75, 123.5, 123.58, 122.9285, 122.14, 122.02, 121.86, 121.58, 121.79, 121.68, 122.18, 122.105, 122.37, 122.02, 122.4765, 122.31, 121.99, 121.8401, 121.85, 122.17, 122.27, 122.26, 122.08, 122.02, 121.979, 121.979, 119.74, 119.55, 118.95, 119.12, 119.14, 118.91, 119.0201, 119.235, 118.93, 119.51, 119.51, 120.04, 119.63, 119.661, 119.77, 119.78, 118.89, 118.85, 118.9, 119.2671, 119.73, 119.8, 119.52, 119.43, 119.16, 119.28, 119.19, 119.19, 117.43, 117.18, 117.3, 116.87, 117.07, 117.0565, 117.4497, 117.47, 117.07, 116.856, 116.91, 117.075, 116.6, 116.56, 117.09, 117.361, 117.35, 117.2787, 116.72, 116.76, 116.34, 116.34, 116.34, 119.88, 119.98, 119.8095, 119.995, 119.88, 119.685, 119.48, 119.845, 119.505, 119.65, 119.36, 119.02, 119.73, 119.71, 120.44, 120.65, 120.45, 120.53, 120.41, 120.67, 120.399, 120.39, 119.91, 120.069, 120.18, 120.37, 120.05, 120.05, 123.9711, 124.01, 124.47, 124.14, 124.14, 124.12, 124.14, 123.94, 123.86, 124, 124.07, 124.33, 125.04, 124.99, 125.47, 125.39, 124.91, 124.5802, 124.88, 124.89, 124.48, 124.88, 125.335, 125.12, 125.07, 125.25, 124.96, 124.97, 126.02, 126.41, 126.19, 125.93, 125.5199, 125.575, 125.6702, 125.471, 125.506, 125.41, 125.14, 125.18, 124.86, 124.86, 126.63, 127.01, 126.881, 126.86, 126.81, 126.86, 127.05, 126.945, 126.2946, 126.1511, 126.28, 125.54, 126.24, 126.22, 125.99, 126.41, 126.12, 126.05, 126.17, 126.13, 126.14, 126.43, 126.26, 126.35, 126.89, 126.645, 126.26, 126.26, 125.5, 125.12, 125.49, 125.86, 125.96, 126.28, 126.37, 126.35, 126.115, 126.1, 125.83, 126.42, 126.73, 126.73, 125.79, 125.32, 125.4, 124.98, 125.0601, 125, 124.84, 124.5, 124.6246, 124.56, 124.29, 124.78, 123.98, 123.95, 125.13, 125.24, 125.48, 125.84, 125.73, 125.76, 125.87, 126.02, 125.9, 126.09, 126.19, 126.21, 126.05, 126.05, 124.208, 123.96, 124.04, 123.9, 123.4, 123.48, 123.5046, 123.55, 123.5911, 123.59, 123.71, 123.825, 124.19, 124.21, 125.38, 125.0199, 124.64, 124.64, 124.85, 124.675, 124.79, 124.67, 124.79, 124.53, 123.86, 123.1, 123.05, 123.05, 122.42, 122.25, 121.81, 121.77, 121.66, 121.94, 122.1484, 122.5, 122.0654, 122.07, 121.67, 121.96, 121.71, 121.74, 123.06, 122.57, 122.21, 122.55, 122.31, 122.71, 122.47, 122.4773, 122.405, 122.31, 122.18, 122.37, 122.18, 122.185, 122.44, 122.68, 122.69, 122.51, 121.9, 121.74, 121.6, 121.78, 121.5999, 121.46, 121.67, 121.57, 121.59, 121.59, 122.05, 121.892, 121.47, 121.28, 120.85, 121.09, 121.15, 121.02, 121.24, 121.02, 121.07, 120.21, 120.32, 120.29, 122.99, 123.3, 123.35, 123.47, 123.4254, 123.469, 123.54, 123.72, 123.7, 123.72, 123.9, 123.97, 123.92, 123.93, 123.26, 123.49, 123.31, 123.13, 123.2, 122.85, 123.34, 123.34, 123.59, 123.57, 123.73, 124.03, 124.17, 124.17, 124.98, 124.97, 124.78, 124.8, 124.88, 125.25, 125.22, 125.3, 125.201, 125.3289, 125.1, 125.345, 125.4, 125.27, 125.66, 125.68, 125.73, 125.946, 126.04, 126.11, 126.2, 126.08, 126.11, 126.02, 126.05, 126.005, 126.41, 126.39, 126.77, 126.78, 126.39, 126.57, 126.55, 126.635, 126.58, 126.55, 126.72, 126.62, 126.7, 126.65, 126.49, 126.49, 125.74, 125.4, 125.39, 125.1, 125.05, 125.08, 124.94, 125.14, 125.29, 125.13, 124.99, 124.78, 124.88, 124.83, 125.42, 125.6991, 125.83, 125.64, 125.9505, 125.8001, 125.83, 125.8077, 125.88, 125.89, 125.86, 126, 126.12, 126.12, 126.1685, 126.08, 126.11, 126.22, 126.03, 126, 126.04, 126, 126.04, 125.78, 125.839, 125.94, 125.5, 125.5, 127.95, 128.19, 128.24, 128.18, 127.955, 127.937, 127.52, 127.56, 127.73, 127.85, 128.04, 127.78, 127.49, 127.495, 127.36, 126.9246,
[R] Error in lasso regression (linear dependence issue?)
I have a rather large dataset which I just inserted hundreds of interaction terms, and I guess R is saying there is a linear dependence when I run: l1ce(y~., data=x, bound = .5, absolute.t = FALSE). The error is below: /Error in if (any(bound 0)) stop('bound'(s) must be non negative) : missing value where TRUE/FALSE needed In addition: Warning message: In l1ce(poss6 ~ ., data = x, bound = 0.5, absolute.t = FALSE) : X Matrix (transformed variables) has rank 1081 p = 1086, i.e., is deficient/ Google doesn't show anything regarding the first error. Any ideas what is causing this? Also, how can I find which column vectors have a linear dependence? -- View this message in context: http://r.789695.n4.nabble.com/Error-in-lasso-regression-linear-dependence-issue-tp4630347.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] step function stops with subscript out of bounds
On 17/05/2012 09:25, David A Vavra wrote: I've been having a problem using the step function to evaluate models. I've simplified the code and get the same problem using the dataset Titanic. The relevant code and output is below. The problem disappears (i.e., 'step' runs correctly) if I rerun the code but change the 'loglm' call to explicitly reference Titanic instead of X (as in: loglm(as.formula(Y),data=Titanic)). What is causing this? A lack of understanding of 'non-standard evaluation'. X (or at least, the X you want) is not visible from the standard search path. TIA, DAV -- catn-function(...) cat(...,\n) local({ X-Titanic; print(class(X)); Y-paste('~',paste(names(dimnames(X)),collapse=*)); print(Y); sm-loglm(as.formula(Y),data=X); catn(SM); print(sm); catn('running'); step(sm,direction='backward') }) Which will tell you Error in eval(expr, envir, enclos) : could not find function loglm If you correct that and use a vanilla session you will get Error in loglm(formula = ~Class + Sex + Age + Survived + Class:Sex + Class:Age + : object 'X' not found which is more informative. So the solution is to - use less easily masked names than 'X'. - ensure the data object is visible on the search path. Output: [1] table [1] ~ Class*Sex*Age*Survived SM Call: loglm(formula = as.formula(Y), data = X) Statistics: X^2 df P( X^2) Likelihood Ratio 0 01 Pearson NaN 01 running Start: AIC=64 ~Class * Sex * Age * Survived Error in loglin(data, margins, start = start, fit = fitted, param = param, : subscript out of bounds Enter a frame number, or 0 to exit 1: local({ X- Titanic print(class(X)) Y- paste(~, paste(names(dimnames(X)), collapse = *)) print(Y) sm- loglm(as.formula(Y), data = X 2: eval.parent(substitute(eval(quote(expr), envir))) 3: eval(expr, p) 4: eval(expr, envir, enclos) 5: eval(quote({ X- Titanic print(class(X)) Y- paste(~, paste(names(dimnames(X)), collapse = *)) print(Y) sm- loglm(as.formula(Y), dat 6: eval(expr, envir, enclos) 7: #1: step(sm, direction = backward) 8: #1: drop1(fit, scope$drop, scale = scale, trace = trace, k = k, ...) 9: #1: drop1.default(fit, scope$drop, scale = scale, trace = trace, k = k, ...) 10: #1: update(object, as.formula(paste(~ . -, tt)), evaluate = FALSE) 11: #1: update.loglm(object, as.formula(paste(~ . -, tt)), evaluate = FALSE) 12: #1: eval.parent(call) 13: #1: eval(expr, p) 14: #1: eval(expr, envir, enclos) 15: #1: loglm(formula = ~Class + Sex + Age + Survived + Class:Sex + Class:Age + Sex:Age + Class:Survived + Sex:Survived + Age:Survived + Class:Sex:Age + Class: 16: #1: loglm1(formula, data, ..., .call = .call, .formula = .formula) 17: #1: loglm1.default(formula, data, ..., .call = .call, .formula = .formula) 18: #1: loglin(data, margins, start = start, fit = fitted, param = param, eps = eps, iter = iter, print = print) Selection: 0 __ R-help@r-project.org 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. -- Brian D. Ripley, rip...@stats.ox.ac.uk 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@r-project.org 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] Complex sort problem
Dear List, Is there a way I can sort a sample based on a sort index constructed from the data from which the sample is taken? Basically, I need to take 'many' samples from the same source data and sort them. This can be very time consuming for long vectors. Is there any way I can sort the data only once initially, and use that sort order for the samples? I believe that idea is what is implemented in tree-based classifiers, so the data is sorted only once initially and that sort order is used for the child nodes. set.seed(12345) x - sample(0:100, 10) x.order - order(x) x.sorted - x[x.order] sample.ind - sample(1:length(x), 5, replace = TRUE) #sample 1/2 size with replacement x.sample - x[sample.ind] x.sample.sorted - #??? (without sorting again) Thanks for any help on this. Regards, Axel. [[alternative HTML version deleted]] __ R-help@r-project.org 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] how disable the Error massage in read.table() no lines available in input
Hello, Apparently this is a follow-up from an earlier post. I had answered but a misplaced comma in the subject line started another thread, that you haven't read. My original answer is in http://r.789695.n4.nabble.com/Re-Problem-to-resolve-a-step-for-reading-a-large-TXT-and-split-in-several-file-td4630242.html As for your question, see the error trapping functions help pages. ?try ?tryCatch And, in readLines the correct option would be ok = TRUE, warn = TRUE is about an end of text marker. ?readLines Hope this helps, Rui Barradas Em 17-05-2012 11:00, gianni lavaredo escreveu: Date: Wed, 16 May 2012 19:06:14 +0200 From: gianni lavaredogianni.lavar...@gmail.com To:r-help@r-project.org Subject: [R] how disable the Error massage in read.table() no lines available in input Message-ID: CAJ6JbR-H6p9A+hZk-exGYDcPdC__SLBLrM_oRw-=j+du3yg...@mail.gmail.com Content-Type: text/plain Dear Researchers, I am looking a way to disable the Error massage in read.table() as warn = TRUE in readLines(), when the lines are empty Error in read.table(con, header = F, sep = , nrow = n) : no lines available in input thanks for all suggestions Gianni [[alternative HTML version deleted]] __ R-help@r-project.org 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] Is there R 2.4 version_
Dear all, I am trying to install the rJava package. I am getting the following message libjvm.so: cannot open shared object file: No such file or directory at this web site I have found that (bottom part) http://rwiki.sciviews.org/doku.php?id=packages:cran:rjava that Unix: if you encounter a message similar to this one: Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/lib/R/site-library/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory the R was configured without Java support. Update to R 2.4.0, make sure that the java command is available and and run R CMD javareconf as root. I have already installed any java package in my system + now I was a bout to see what is my current running R version platform x86_64-suse-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 15.0 year 2012 month 03 day 30 svn rev 58871 language R version.string R version 2.15.0 (2012-03-30) so I decided to install the R2.4 as the package developer ask for... Could you please inform me if such version even exists_ Alex [[alternative HTML version deleted]] __ R-help@r-project.org 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] hmd.mx
I have trouble using function hmd.mx I have all packages required. I call function: slovenia - hmd.mx(SVN, username, password, Slovenia) : and I get this error: NAs introduced by coercion And if I then call slovenia, I get: slovenia Mortality data for Slovenia Series: female male total Years: 1983 - 2009 Ages: 0 - 110 But I do not get any value (mortality, ...): slovenia$ages NULL slovenia$years NULL I tried also for two different countries and I got the same result. Can please anybody help me with this problem? Thank you very much. Martina -- View this message in context: http://r.789695.n4.nabble.com/hmd-mx-tp4630350.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] MANOVA with random factor
Dear All I would need to perform a MANOVA with both fixed (group, sex, group*sex) and random (brood) effects. I wonder if this is at all possible and if R does that. At the moment, I only know that I can run a classic MANOVA with R. Thank you David __ David Costantini, PhD http://www.davidcostantini.it NERC Postdoctoral research associate Institute of Biodiversity, Animal Health and Comparative Medicine School of Life Sciences College of Medical, Veterinary and Life Sciences University of Glasgow Graham Kerr Building, room 511 Glasgow G12 8QQ, UK See also my association Ornis italica http://www.ornisitalica.com http://www.birdcam.it [[alternative HTML version deleted]] __ R-help@r-project.org 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] survival survfit with newdata
On May 17, 2012, at 2:20 AM, Damjan Krstajic wrote: Thanks David for prompt reply. I agree with you. However, I still fail to get the survfit function to work with newdata. In my previous example I changed the column names of testX matrix and I still fail. colnames(testX)-names(coxph.model$coefficients) sfit- survfit(coxph.model,newdata=data.frame(testX)) Error in model.frame.default(formula = Surv(trainTime, trainStatus) ~ : variable lengths differ (found for 'trainX') I don't get that error when I run this. I do get better results using a data argument to the coxph call. You should be getting predicted survival curves for 10 cases that will be estimated at the same time points as were available in the input data in the original data. coxph.model-coxph(Surv(trainTime,trainStatus)~ . , data=data.frame(trainX)) colnames(testX)-names(coxph.model$coefficients) sfit- survfit(coxph.model,newdata=data.frame(testX)) plot(sfit) # 10 curves I do not see matrix input to coxph as a described data input, so perhaps you should follow the help page more closely? -- David. What would be solution in my simple example to get the survival curves for testX? Thanks in advance. DK CC: r-help@r-project.org From: dwinsem...@comcast.net To: dkrsta...@hotmail.com Subject: Re: [R] survival survfit with newdata Date: Thu, 17 May 2012 00:52:55 -0400 On May 16, 2012, at 5:08 PM, Damjan Krstajic wrote: Dear all, I am confused with the behaviour of survfit with newdata option. Yes. It has the same behavior as any other newdata/predict from regression. You need to supply a dataframe with the same names as in the original formula. Doesn't look as though that strategy is being followed. The name of the column needs to be 'trainX' since that was what was its name on the RHS of hte formula, and you may want to specify times. If you fail to follow those rules, the function falls back on offering estimates from the original data. I am using the latest version R-2-15-0. In the simple example below I am building a coxph model on 90 patients and trying to predict 10 patients. Unfortunately the survival curve at the end is for 90 patients. As is proper with a malformed newdata argument. Could somebody please from the survival package confirm that this behaviour is as expected or not - because I cannot find a way of using 'newdata' with really new data. Thanks in advance. DK x-matrix(rnorm(100*20),100,20) time-runif(100,min=0,max=7) status-sample(c(0,1), 100, replace = TRUE) trainX-x[11:100,] trainTime-time[11:100] trainStatus-status[11:100] testX-x[1:10,] coxph.model- coxph(Surv(trainTime,trainStatus)~ trainX) sfit- survfit(coxph.model,newdata=data.frame(testX)) dim(sfit$surv) [1] 90 90 [[alternative HTML version deleted]] __ R-help@r-project.org 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. David Winsemius, MD West Hartford, CT David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] oldlogspline probabilities
On May 17, 2012, at 3:16 AM, Beutel, Terry S wrote: I using oldlogspline (from logspline package) to model data distributions, and having a problem. My data are search area sizes. They are based on circular search radii from random points to the nearest edge of the nearest grass tussock. Search area sizes are distributed from 0 (the random point intercepts a tussock) and upwards (as points are further from any tussocks). The density of all my distributions (using doldlogspline) are highest at size=0, and decline as search area increases. I am most interested in the probability of a value in the distribution being equal to 0 (ie probability of a direct hit on a tussock). I know I can just use the proportion of actual hits, but am curious to compare this to an estimate from a density estimation. Unfortunately when using poldlogspline, this probability is always=0 (simulated data example is below). How can this be, given that the density is highest at area=0? simdat-c(rep(0,8),rexp(92)) myspline-oldlogspline(simdat,lbound=0) poldlogspline(fit=myspline, q=0) [1] 0 Any help to work out the probability of an area value in my distribution = 0 would be appreciated Probabilities often are zero over a zero-length interval , even if their densities are positive. Surely this tussock has a finite width? logspline::poldlogspline(fit=myspline, q=0.01) [1] 0.04138533 -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] Error on easy way for JoSAE Package
On May 17, 2012, at 2:26 AM, ana24maria wrote: I have attached to this message the first 20 lines of the output for dput(amigo). If ypu attempted to send something, the mail-server scrubbed it. Unfortunately, i can't send it the overall output. Thank you. I did not use the word attach. When you get around to reading the Posting Guide, pay particular attention to the section Technical details of posting. Sometimes person posting from Nabble will have success putting things up on that website. -- David. On Wed, May 16, 2012 at 6:10 PM, David Winsemius [via R] ml-node+s789695n4630253...@n4.nabble.com wrote: On May 16, 2012, at 1:33 AM, ana24maria wrote: Thank you very much. After using dput and the easy way ( result - eblup.mse.f.wrap(domain.data = amigo, lme.obj = fit.lme)), i have got the following error: Error in `[.data.frame`(sample.data, , variabs) : undefined columns selected What John was asking you to do was at your console just type: dput(amigo) ... and then copy the output to an email and send that to the list. Your first posting had data that was ambiguous as to content as well as mangled by the various email clients and servers that processed on the path to our eyes. What should I do? You should also read the Posting Guide. David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] Complex sort problem
On May 17, 2012, at 6:45 AM, Axel Urbiz wrote: Dear List, Is there a way I can sort a sample based on a sort index constructed from the data from which the sample is taken? Basically, I need to take 'many' samples from the same source data and sort them. This can be very time consuming for long vectors. Is there any way I can sort the data only once initially, and use that sort order for the samples? I believe that idea is what is implemented in tree-based classifiers, so the data is sorted only once initially and that sort order is used for the child nodes. set.seed(12345) x - sample(0:100, 10) x.order - order(x) x.sorted - x[x.order] sample.ind - sample(1:length(x), 5, replace = TRUE) #sample 1/2 size with replacement x.sample - x[sample.ind] x.sample.sorted - #??? (without sorting again) Thanks for any help on this. If you had created a named vector or used a dataframe with rownames you would have a record of the original sort order. Regards, Axel. [[alternative HTML version deleted]] __ R-help@r-project.org 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. David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] Add column from other columns data.
Something along the lines of dat2 - ifelse( dat1==1 , yes, no) Another option is in this case dat2 - c(no, yes)[dat1+1] Regards Petr should do it. John Kane Kingston ON Canada -Original Message- From: s1010...@student.hsleiden.nl Sent: Mon, 14 May 2012 05:45:38 -0700 (PDT) To: r-help@r-project.org Subject: [R] Add column from other columns data. Hi everyone, I am having some problems with making a new colomn wit data in it. I have this one column named: Fulfilled Fulfilled 1 1 0 1 1 1 1 0 0 1 And now I would like to add another colum to my .csv file (Finished) In this Finished column I would like to have Yes or No. Where in colomn Fullfilled is a 1, Finished should have a Yes. Like this: Fullfilled Finished 1 Yes 1 Yes 0 No etc Now I know how to grab the data out of a column, and also know how to save data inside a .csv file. That is no problem. But how do I get the right Yes or No on the right place in the other column? # Get al values: 1 Fullfilled_1 = Fullfilled[Fullfilled = 1] I was thinkng about subset. But I don' t realy know if that would be realy it Maybe somebody here can push me a little in the right direction? -- View this message in context: http://r.789695.n4.nabble.com/Add-column-from-other-columns-data-tp4629921.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. Publish your photos in seconds for FREE TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4 __ R-help@r-project.org 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@r-project.org 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] hu6800cdf
Hi Srod -- On 05/16/2012 11:04 PM, srod wrote: Hi, I'm using a command in bioconductor that seems to require a package called hu6800cdf. I've installed this properly but I still get the same error: Could not find array definition file ' hu6800cdf.qcdef '. Simpleaffy does not know the QC parameters for this array type. See the package vignette for details about how to specify QC parameters manually. Please ask questions about Bioconductor packages on the Bioconductor mailing list, http://bioconductor.org/help/mailing-list/ cc'ing the maintainer packageDescription(simpleaffy)$Maintainer including the output of sessionInfo() and the precise command that generates the error. The package vignette vignette(package=simpleaffy, simpleAffy) especially section 5.4, Specifying alternate QC configurations, may be helpful. Martin I've tried specifying the cdfname file by using data-ReadAffy(cdfname=hu6800cdf) but it still returns the same error. The version of R that I'm using is 2.15 and the bioconductor version is 2.10. Does anyone know how to solve this? Thanks, srod -- View this message in context: http://r.789695.n4.nabble.com/hu6800cdf-tp4630337.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793 __ R-help@r-project.org 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] Is there R 2.4 version_
Hi Alaios, The web page you're quoting was written in 2006. There *was* an R 2.4, but it's no longer cutting edge, to say the least. Earlier in the document it says R 2.4 or higher, which is what you've got. I'd first look for newer documentation, then try the instructions given with the current version of R you already have installed. Sarah On Thu, May 17, 2012 at 7:29 AM, Alaios ala...@yahoo.com wrote: Dear all, I am trying to install the rJava package. I am getting the following message libjvm.so: cannot open shared object file: No such file or directory at this web site I have found that (bottom part) http://rwiki.sciviews.org/doku.php?id=packages:cran:rjava that Unix: if you encounter a message similar to this one: Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/lib/R/site-library/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory the R was configured without Java support. Update to R 2.4.0, make sure that the java command is available and and run R CMD javareconf as root. I have already installed any java package in my system + now I was a bout to see what is my current running R version platform x86_64-suse-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 15.0 year 2012 month 03 day 30 svn rev 58871 language R version.string R version 2.15.0 (2012-03-30) so I decided to install the R2.4 as the package developer ask for... Could you please inform me if such version even exists_ Alex -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org 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] Unable to install package
On 17.05.2012 00:49, Rismyname wrote: Hi, I get the following error while installing a package. Can someone please help? install.packages(memisc) Warning in install.packages : argument 'lib' is missing: using 'C:/Users/ravi/Documents/R/R-2.15.0' Warning in install.packages : downloaded length 8255 != reported length 200 Error in install.packages : Line starting '!DOCTYPE html PUBLI ...' is malformed! OS? Version of R? Selected CRAN mirror? Anyway: R tried to download the package but got an html page, obviously, hence either the mirror you are using is corrupted or somone in between (like some proxy?) delivers html pages rather than packages... Uwe Ligges thanks -- View this message in context: http://r.789695.n4.nabble.com/Unable-to-install-package-tp4630320.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] (bug?) in survfit in R-2-15.0
The predict methods are designed to work with a dataframe. In the case of survfit(cox model) the code has, for backwards compatability purposes, the ability to use a vector as the newdata argument. This feature is not documented in the help file, on purpose, and is expected to go away one day. This backwards compatatibilty works in all my test cases, but not in the one you present. This may accelerate my plans for removal. The best solution for you is to use a dataframe for both the coxph fit and the predict call. Avoid using objects that are in the global data or are attached. Below I reprise your example in safer code. The coxph/survfit calls both work from a temporary data frame called dummy. Your use of the coxph/survfit pair to get a survival curve for glmnet is clever, by the way. I like it. library(glmnet) library(survival) load(system.file(doc,VignetteExample.rdata,package=glmnet)) fit - with(patient.data, glmnet(x[-1,], Surv(time[-1], status[-1]), family=cox, alpha=.05, maxit=1)) max.dev.index - which.max(fit$dev.ratio) optimal.beta - fit$beta[, max.dev.index] nonzero.coef - (optimal.beta != 0) dummy - with(patient.data, data.frame(time=time, status=status, x=x[,nonzero.coef])) coxfit - coxph(Surv(time, status) ~ ., data=dummy, subset= -1, iter=0, init=optimal.beta[nonzero.coef]) sfit - survfit(coxfit, newdata=dummy[1,]) Terry Therneau begin included message --- Dear all, I am using glmnet + survival and due to the latest release of glmnet 1.7.4 I was forced to use the latest version of R 2.15.0. My previous version of R was 2.10.1. I changed glmnet version and R version and when I started to get weird results I was not sure where the bug was. After putting glmnet back to previous version, I have found that the bug or weird behaviour happens in survival survfit. My script is below in email and it is uses glmnet 1.7.3. I get two completely different answers in different versions of R and in my opinion the older version of survival package returns correct value. in R 2-10-1 I get ? cat(dim(sfit$surv)) ? ? cat(length(sfit$surv)) 32 ? ? in R-2-15-0 I get cat(dim(sfit$surv)) 62 99 ? cat(length(sfit$surv)) 6138 ? ?Kind regardsDK library(survival) library(glmnet) load(system.file(doc,VignetteExample.rdata,package=glmnet)) attach(patient.data) trainX? -x[-1,] trainTime?? -time[-1] trainStatus - status[-1] fit - glmnet(trainX,Surv(trainTime,trainStatus),family=cox,alpha=0.5,maxit=1) max.dev.index - which.max(fit$dev.ratio) optimal.lambda - fit$lambda[max.dev.index] optimal.beta? - fit$beta[,max.dev.index] nonzero.coef - abs(optimal.beta)0 selectedBeta - optimal.beta[nonzero.coef] selectedTrainX?? - trainX[,nonzero.coef] coxph.model- coxph(Surv(trainTime,trainStatus)~ selectedTrainX,init=selectedBeta,iter=0) selectedTestX - x[1,nonzero.coef] sfit- survfit(coxph.model,newdata=selectedTestX) cat(\ndim(sfit$surv)) cat(dim(sfit$surv)) cat(\nlength(sfit$surv)) cat(length(sfit$surv)) __ R-help@r-project.org 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] max value
Hi On 2012-05-15 08:36, Melissa Rosenkranz wrote: Here is an R problem I am struggling with: My dataset is organized like this... subject sessionvariable_x variable_y 01 11interger values 01 12 01 13 01 21 01 22 01 23 02 11 02 12 02 13 02 21 02 22 02 23 03 11 03 12 03 13 03 21 03 22 03 23 ... I need to find the level of variable x at which variable y has the maximum value for each individual for each session. Then, I need to create another variable, say variable z that labels that row in the dataset as the max for that individual at that time. I have searched the archives and the web for ideas, but am having trouble finding appropriate search terms for what I need to do. Any advice? Thank you!! This is one way: Here is another d$z-ave(d$y, d$subject, d$session, FUN=function(x) x==max(x)) Regards Petr set.seed(123) d - data.frame( subject = gl(3,6,labels=c(01,02,03)), session = gl(2,3,18), x = gl(3,1,18), y = sample(11:15, 18, replace=TRUE)) library(plyr) ddply(d, .(subject, session), transform, z = ifelse(y == max(y), 1, 0)) Peter Ehlers __ R-help@r-project.org 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@r-project.org 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] replacing with NA
x[is.na(z)] - NA This might send you a nasty bug if x and z are different lengths though -- just a head's up. Another option x*!is.na(z)*z Regards Petr Michael On Wed, May 16, 2012 at 12:55 PM, Mintewab Bezabih mintewab.beza...@economics.gu.se wrote: Dear R users, I was wondering how I can replace the values of a vector with the values from in another vector in the same row For example, how can I replace the value of x below with NA when the value of Z in the same row is NA? x -1:20 z- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27, 12, 28, 16,17, NA, 12, 10) Many thanks Mintewab Från: Mintewab Bezabih Skickat: den 15 maj 2012 15:53 Till: r-help@r-project.org Kopia: r-help@r-project.org Ämne: missing observations Dear R users, I have missing observations in my data that I remove in my analysis. I am able to run my codes alright but I want the non missing values to be correctly identified and therefore want to tag my id vector along in my results. Since the vector of ids has no role in the analysis, I dont know how to include it. Here is my reprducable example:and my id is the vector I want to add to the analysis somehow so that my missing values are identified. I cannot use na.action function and that is why I have to drop my missing obesevations beforehand. library(fields) x -1:20 y- runif(20) z- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27, 12, 28, 16, 17, NA, 12, 10) id -1:20 mydataset-data.frame(x, y, z) temperature[complete.cases(mydataset),] x- temperature[, c(1)] y- temperature[, c(2)] z- temperature[, c(3)] tpsfit - Tps(cbind(x, y), z, scale.type=unscaled) Many thanks as always. Regards, Mintewab __ R-help@r-project.org 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@r-project.org 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@r-project.org 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] ctree for suvival analysis problem
Hi All, I'm using the party package to grow conditional inference trees for survival analysis. When I used party version party_0.9-9991 everything worked well, but when I update to party_1.0-2 (due to using 64bit R), I get an error. For simplicity I will show the error I get for the example in the party documentation: ### survival analysis if (require(ipred)) { data(GBSG2, package = ipred) GBSG2ct - ctree(Surv(time, cens) ~ .,data = GBSG2) plot(GBSG2ct) treeresponse(GBSG2ct, newdata = GBSG2[1:2,]) } for the plot(GBSG2ct) line I get the following error: Error in Summary.Surv(c(1814, 2018, 712, 1807, 772, 448, 2172, 2161, 471, : Invalid operation on a survival time and for treeresponse(GBSG2ct, newdata = GBSG2[1:2,]) I get this error: Error: extends(class(y), Surv) is not TRUE (I care more about treeresponse but assume it is related). Any help would be highly appreciated! Thanks, Ofra -- View this message in context: http://r.789695.n4.nabble.com/ctree-for-suvival-analysis-problem-tp4630362.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] [R-pkgs] new version of fda fixes bug in pca.fd and supports library(Matrix)
Hello, All: fda_2.2.8 (functional data analysis) is now available on CRAN. This revision includes the following improvements: 1. A bug in pca.fd has been fixed. 2. Many functions have a new argument returnMatrix, which if TRUE allows the function to use the sparse matrix representations in library(Matrix). This should allow users to solve some larger problems and provides a speed advantage in a few cases. 3. A few other minor bugs have been fixed including problems with some of the script files in system.files('scripts', package='fda'). A package using the returnMatrix argument will also need Matrix in the dependencies in DESCRIPTION and something like import(Matrix) in NAMESPACE. Each use will require adding returnMatrix = TRUE to an appropriate fda function call. Best Wishes, Jim Ramsay, Giles Hooker, Spencer Graves ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@r-project.org 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] Importing ASCII flat
I am trying to import Indian National Sample Survey Data. It is ASCII flat and an example is below 00146030602500111710107111201*01*00211 270104070204093 00246030602500111710107111201*02*00806104910519572 022 2600 11503055 170 4005 00346030602500111710107111201*03* 111039204112 222 Previous post don't seem to provide much help. I have an document outlining the layout of the data, but don't know how to start. An example of the layout is that the values in bold indicate separate levels.Example of layout is below: Sl.No. Item Blk Item Col Len Byte Position Remarks 1 Common Items 33 1 - 33 Auto-duplicated 2 Level 2 34 - 35 02 Generated 3 Filler 5 36 - 40 0 Generated 4 HHS Size 3 1 2 41 - 42 5 NIC Code(5-digit) 3 2 5 43 - 47 6 NCO Code(3-digit) 3 3 3 48 - 50 7 HHS type 3 4 1 51 - 51 8 Religion 3 5 1 52 - 52 As is obvious, I am relatively new to R. Any constructive advice would be welcome. Richard Iles -- Economics Ph.D. student Delhi School of Economics (visiting) e: richard.i...@griffithuni.edu.au website: https://sites.google.com/a/griffithuni.edu.au/richard-iles/homehttps://sites.google.com/site/richardileshome/home [[alternative HTML version deleted]] __ R-help@r-project.org 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] error code trying to extract second column from coeftest output
Hi I want to use the standard error values in the summary that is produced using coeftest, but I am getting an error code- any ideas? See what is structure of coeftest object by str(coeftest(lmodT_WBHO)) and from this you shall deduct how to select second column. Regards Petr library(lmtest) coeftest(lmodT_WBHO) t test of coefficients: Estimate Std. Error t value Pr(|t|) t1W 5.948190.17072 34.8410 2.2e-16 *** t2W 6.562160.17438 37.6322 2.2e-16 *** t3W 6.082520.16525 36.8082 2.2e-16 *** t4W 6.180410.17028 36.2949 2.2e-16 *** t1B 5.50.50566 10.8768 2.2e-16 *** t2B 5.650000.53034 10.6535 2.2e-16 *** t3B 4.523810.51756 8.7406 2.2e-16 *** t4B 4.380950.51756 8.4646 2.2e-16 *** t1H 5.050000.53034 9.5221 2.2e-16 *** t2H 4.80.55903 8.5465 2.2e-16 *** t3H 5.526320.54412 10.1564 2.2e-16 *** t4H 4.714290.63388 7.4372 2.236e-13 *** t1O 5.176470.57524 8.9988 2.2e-16 *** t2O 5.818180.50566 11.5060 2.2e-16 *** t3O 6.50.63388 10.2543 2.2e-16 *** t4O 5.714290.63388 9.0147 2.2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 se1 - coeftest(lmodT_WBHO)$coef[,2] Error in coeftest(lmodT_WBHO)$coef : $ operator is invalid for atomic vectors -- View this message in context: http://r.789695.n4.nabble.com/error-code- trying-to-extract-second-column-from-coeftest-output-tp4630298.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] how to download source code, pdf manual for any package from internet?
i can get list of available packages by r-available.packages() No of available packages length(r[,1]) [1] 3739 single package name r[1,1] [1] ACCLMA i want download all packages starting with A / a alphabets, with their source code, pdf manual/vignettes from internet -- View this message in context: http://r.789695.n4.nabble.com/how-to-download-source-code-pdf-manual-for-any-package-from-internet-tp4630354.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] as.function parameters
Hi.. Ok here is an example on how I wanted the tree to be implemented in R: - the tree is, as you wrote, saved as a list of different tree levels - each tree level is also saved as a list of different nodes in that specific level - and for the last part, each node is then saved as a list of functions example: tree - list(root, lvl1, lvl2) root - list(node00) lvl1 - list(node10, node11) lvl2 - list(node20, node21, node22) node00 - list(f1,f2,f3) node10 - list(f1,f2,f3) node11 - list(f1,f2,f3) .. note: I wrote f1, f2 and f3 in each node because it is the same function, just with the different parameter, the stock price at that node. I tried implementing a tree manually and I found out that the independences between one node and each childnode cause a heavy computation power.. (the function f3 contains f3 of the two childnodes and so on..) example: node11$f3 - max(node11$f2, node21$f3, node22$f3) Im facing this problem even with a tree with 'only' 4-5 layers.. best thanks for any answers -- View this message in context: http://r.789695.n4.nabble.com/as-function-parameters-tp4620390p4630353.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] how to find outliers from the list of values
Hi I had not see any answer yet but maybe there is nobody who wants to touch the elusive object of outlier. Neither me, but here are some ideas how one can proceed. First of all its always up to you what is considered an outlier and how will you deal with them. I usually call an outlier any item which does not fit to the pattern and the pattern is usually best observed by some plotting function. You can identify outlier points, inspect the data source, correct typing mistakes and only if the value is really measured and you can not find any reason why it has such value it is real outlier. Then ***you*** need to decide what to do with it - discard, can come from some long tailed distribution, ... So here are my 0.02$ regarding an outlier theme. Regards Petr Hi, I am new to R and I would like to get your help in finding 'outliers'. I have mvoutlier package installed in my system and added the package . But I not able find a function from 'mvoutlier' package which will identify 'outliers'. This is the sample list of data I have got which has one out-lier. 11489 11008 11873 8000 9558 8645 8024 8371 It will be of great help if somebody have got an example script for the same. Thanks Regards, Thomas [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] neighbour list in lm.LMtests
Dear everyone! I am a new user in R. Recently, I have been struggling to work out lagrange multiplier test in R, after read the description in R. I am still confusing with method of assigning a neighbour list to listw. Many thanks if anyone can give me a hint -- View this message in context: http://r.789695.n4.nabble.com/neighbour-list-in-lm-LMtests-tp4630366.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] ctree for suvival analysis problem
On Thu, 17 May 2012, ofraam wrote: Hi All, I'm using the party package to grow conditional inference trees for survival analysis. When I used party version party_0.9-9991 everything worked well, but when I update to party_1.0-2 (due to using 64bit R), I get an error. For simplicity I will show the error I get for the example in the party documentation: ### survival analysis if (require(ipred)) { data(GBSG2, package = ipred) GBSG2ct - ctree(Surv(time, cens) ~ .,data = GBSG2) plot(GBSG2ct) treeresponse(GBSG2ct, newdata = GBSG2[1:2,]) } Works for me without a problem. for the plot(GBSG2ct) line I get the following error: Error in Summary.Surv(c(1814, 2018, 712, 1807, 772, 448, 2172, 2161, 471, : Invalid operation on a survival time and for treeresponse(GBSG2ct, newdata = GBSG2[1:2,]) I get this error: Error: extends(class(y), Surv) is not TRUE (I care more about treeresponse but assume it is related). My guess is that you have loaded package rms but haven't told us so. This overwrites Surv() in a way that is incompatible with the usage in ctree(). Best, Z Any help would be highly appreciated! Thanks, Ofra -- View this message in context: http://r.789695.n4.nabble.com/ctree-for-suvival-analysis-problem-tp4630362.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] Importing ASCII flat
On 17.05.2012 14:17, Richard Iles wrote: I am trying to import Indian National Sample Survey Data. It is ASCII flat and an example is below 00146030602500111710107111201*01*00211 270104070204093 00246030602500111710107111201*02*00806104910519572 022 2600 11503055 170 4005 00346030602500111710107111201*03* 111039204112 222 Do you have a file format specification? This is probably some fixed width formatted file, hence read.fwf may help to import the data. See ?read.fwf and the R Data Import/Export manual. Best, Uwe Ligges Previous post don't seem to provide much help. I have an document outlining the layout of the data, but don't know how to start. An example of the layout is that the values in bold indicate separate levels.Example of layout is below: Sl.No. Item Blk Item Col Len Byte Position Remarks 1 Common Items 33 1 - 33 Auto-duplicated 2 Level 2 34 - 35 02 Generated 3 Filler 5 36 - 40 0 Generated 4 HHS Size 3 1 2 41 - 42 5 NIC Code(5-digit) 3 2 5 43 - 47 6 NCO Code(3-digit) 3 3 3 48 - 50 7 HHS type 3 4 1 51 - 51 8 Religion 3 5 1 52 - 52 As is obvious, I am relatively new to R. Any constructive advice would be welcome. Richard Iles __ R-help@r-project.org 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] Is there R 2.4 version_
Thanks Solution found Fixed: a. run as root the sudo R CMD javareconf (not as simple user) b. then install rJava from tar.gz From: Sarah Goslee sarah.gos...@gmail.com Cc: R help R-help@r-project.org Sent: Thursday, May 17, 2012 2:44 PM Subject: Re: [R] Is there R 2.4 version_ Hi Alaios, The web page you're quoting was written in 2006. There *was* an R 2.4, but it's no longer cutting edge, to say the least. Earlier in the document it says R 2.4 or higher, which is what you've got. I'd first look for newer documentation, then try the instructions given with the current version of R you already have installed. Sarah Dear all, I am trying to install the rJava package. I am getting the following message libjvm.so: cannot open shared object file: No such file or directory at this web site I have found that (bottom part) http://rwiki.sciviews.org/doku.php?id=packages:cran:rjava that Unix: if you encounter a message similar to this one: Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/lib/R/site-library/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory the R was configured without Java support. Update to R 2.4.0, make sure that the java command is available and and run R CMD javareconf as root. I have already installed any java package in my system + now I was a bout to see what is my current running R version platform x86_64-suse-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 15.0 year 2012 month 03 day 30 svn rev 58871 language R version.string R version 2.15.0 (2012-03-30) so I decided to install the R2.4 as the package developer ask for... Could you please inform me if such version even exists_ Alex -- Sarah Goslee http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org 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] Help needed for efficient way to loop through rows and columns
This will accomplish what you want and should be relatively easy to modify. # Create data.fram names - c(S1, S2, S3, S4) X - c(BB, AA, AB, AA) Y - c(BB, BB, AB, AA) Z - c(BB, BB, AA, NA) AorB - c(A, A, B, B) sample - data.frame(names, X, Y, Z, AorB, stringsAsFactors=FALSE) # Create recoded data.frame samplemod - sample samplemod[,2:4] - NA # Recoded values into samplemod for (i in 1:nrow(sample)) { for (j in 2:4) { if (!is.na(sample[i,j])){ if (sample[i, 5] == A) { samplemod[i,j] - switch(sample[i,j], AA = 2, AB = 1, BA = 1, BB = 0) } else { if (sample[i, 5] == B) { samplemod[i,j] - switch(sample[i,j], AA = 0, AB = 1, BA = 1, BB = 2) } } } } } -- David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX 77843-4352 From: Priya Bhatt [mailto:bhatt...@gmail.com] Sent: Wednesday, May 16, 2012 1:55 PM To: dcarl...@tamu.edu; r-help@r-project.org Subject: Re: [R] Help needed for efficient way to loop through rows and columns Yes here it is. I actually convert them all as strings, initially using options(stringsAsFactors=F) at the top of my code. This what the initial dataframe looks like. Please note this is a toy dataset: names X Y Z AorB S1 BB BB BB A S2 AA BB BB A S3 AB AB AA B S4 AA AA NA B And the code to create this initial dataframe is: names - c(S1, S2, S3, S4) X - c(BB, AA, AB, AA) Y - c(BB, BB, AB, AA) Z - c(BB, BB, AA, NA) AorB - c(A, A, B, B) sample - data.frame(names, X, Y, Z, AorB) The final data.frame should look like: names X Y Z AorB S1 0 0 0 A S2 2 0 0 A S3 1 1 0 B S4 0 0 NA B You're right! - I'll should be able to globally change all ABs and BAs to 1s. Thanks:) I'm not exactly sure how to change AA and BB depending on AorB for each row though. Thoughts? Thanks for your help thus far, David. Best, Priya On Wed, May 16, 2012 at 6:53 AM, David L Carlson dcarl...@tamu.edu wrote: Can you show us what you want the final data.frame to look like? You've created five variables stored as factors and you seem to be trying to change those to numeric values? Is that correct? Since AB and BA are always set to 1, you could just replace those values globally rather than mess with the ifelse commands for those values. Only AA and BB are affected by the value of AorB. Your apply() function processes the data.frame by row so i is a vector consisting of all the values in the row. You seem to be coding as if i was a single integer (as in a for loop). -- David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Priya Bhatt Sent: Wednesday, May 16, 2012 3:08 AM To: r-help@r-project.org Subject: [R] Help needed for efficient way to loop through rows and columns Dear R-helpers: I am trying to write a script that iterates through a dataframe that looks like this: Example dataset called sample: names - c(S1, S2, S3, S4) X - c(BB, AB, AB, AA) Y - c(BB, BB, AB, AA) Z - c(BB, BB, AB, NA) AorB - c(A, A, A, B) sample - data.frame(names, X, Y, Z, AorB) for a given row, if AorB == A, then AA == 2, AB = 1, BA = 1, BB = 0 if AorB == B, then AA == 0, AB = 1, BA = 1, BB = 2 I've been trying to write this using apply and ifelse statements in hopes that my code runs quickly, but I'm afraid I've make a big mess. See below: apply(sample, 1, function(i) { ifelse(sample$AorB[i] == A, (ifelse(sample[i,] == AA, sample[i,] - 2 , ifelse(sample[i,] == AB || sample[i,] == BA , sample[i,] - 1, ifelse(sample[i,] == BB, sample[i,] - 0, sample[i,] - NA )) ) ) , ifelse(sample$AorB[i,] == B), (ifelse(sample[i,] == AA, sample[i,] - 0 , ifelse(sample[i,] == AB || sample[i,] == BA , sample[i,] - 1, ifelse(sample[i,] == BB, sample[i,] - 2, sample[i,] - NA) }) Any Advice? [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] Importing ASCII flat
On May 17, 2012, at 8:17 AM, Richard Iles wrote: I am trying to import Indian National Sample Survey Data. It is ASCII flat and an example is below 00146030602500111710107111201*01*00211 270104070204093 00246030602500111710107111201*02*00806104910519572 022 2600 11503055 170 4005 00346030602500111710107111201*03* 111039204112 222 Previous post don't seem to provide much help. I have an document outlining the layout of the data, but don't know how to start. An example of the layout is that the values in bold indicate separate levels.Example of layout is below: Your data layout was mangled by passage of html formating through various mailers. Looking at: http://mospi.nic.in/Mospi_New/site/inner.aspx?status=4menu_id=67 ... I'm guessing you are showing only a tiny slice of the data specification. Sl.No. Item Blk Item Col Len Byte Position Remarks 1 Common Items 33 1 - 33 Auto-duplicated 2 Level 234 - 35 02 Generated 3 Filler 536 - 40 0 Generated 4 HHS Size 3 1 2 41 - 42 5 NIC Code(5-digit) 3 2 5 43 - 47 6 NCO Code(3-digit) 3 3 3 48 - 50 7 HHS type 3 4 1 51 -51 8 Religion 3 5 1 52 - 52 That was my best guess at what might have originally been the fixed format layout. You should look at: ?utils::read.fwf If you can create a data.frame, dfrm, from that data layout, then the most useful fields would be the names and the lengths. Perhaps this could work read.fwf(file, widths=dfrm$Len, col.names= dfrm$Item) As is obvious, I am relatively new to R. Any constructive advice would be welcome. PLEASE, please, please : Learn to post in plain text. Richard Iles -- Economics Ph.D. student Delhi School of Economics (visiting) e: richard.i...@griffithuni.edu.au website: https://sites.google.com/a/griffithuni.edu.au/richard-iles/home https://sites.google.com/site/richardileshome/home [[alternative HTML version deleted]] __ R-help@r-project.org 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. David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] nls and if statements
Hi All, I have a situation where I want an 'if' variable to be parameterized. It's entirely possible that the way I'm trying to do this is wrong, especially given the error message I get that indicates I can't do this using an 'if' statement. Essentially, I have data where I think a relationship enters when a variable (here Pwd) is below some value (z). I don't know that value, so I want to fit it. The data is Pw, Tsoil, and Cfl. nlstest=nls(if(Pwz){Cfl~K*exp(-b*Pw)+c }else{ Cfl~K*(exp(-a*Tsoil))*exp(-b*Pw)+c },start=c(K=5.5, a=0.1, b=0.1, c=2, z=5)) Which returns the error: Error in inherits(object, formula) : object 'z' not found Is there a better way to try and allow a conditional variable to, well, vary? -- View this message in context: http://r.789695.n4.nabble.com/nls-and-if-statements-tp4630391.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] kolmogorov-Smirnov critical values
Thank you all for your help!! ! Alex -- View this message in context: http://r.789695.n4.nabble.com/kolmogorov-Smirnov-critical-values-tp4630245p4630393.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Correlation Matrix
Hi, unless you're dealing with heteroskedastic datas, the command *cor(x)* will be enough, where *x* is your data matrix; in this function you can easily select the method which has to be used: Pearson's, Kendall's or Spearman's correlation. -- View this message in context: http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389p4630392.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] how to download source code, pdf manual for any package from internet?
sagarnikam123 sagarnikam123 at gmail.com writes: i can get list of available packages by r-available.packages() No of available packages length(r[,1]) [1] 3739 single package name r[1,1] [1] ACCLMA i want download all packages starting with A / a alphabets, with their source code, pdf manual/vignettes from internet -- View this message in context: http://r.789695.n4.nabble.com/how-to-download-source-code-pdf-manual-for-any-package-from-internet-tp4630354.html Sent from the R help mailing list archive at Nabble.com. grep(^[Aa],rownames(r),value=TRUE) gets you the names of the 143 packages starting with A or a. If you google ACCLMA you will find http://cran.r-project.org/web/packages/ACCLMA/ with further links http://cran.r-project.org/src/contrib/ACCLMA_1.0.tar.gz http://cran.r-project.org/web/packages/ACCLMA/ACCLMA.pdf You can use paste() and download.file() in a loop to get all of the packages. ACCLMA happens not to have any vignettes. It's a little hard for me to see how you can figure out the URLs of package-associated vignettes, without web-scraping (which shouldn't actually be too hard, but I won't illustrate here how to do it) You probably want to use the URL of your local mirror rather than the main CRAN site when doing this. Ben Bolker __ R-help@r-project.org 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] ctree for suvival analysis problem
Thanks very much Achim! I was indeed using pec which requires rms... I see now that the old version of pec that I used didn't require rms and therefore I had no problem.. I'm guessing I don't need the rms methods for my use of pec, but am not sure how I can remove the dependency or alternatively mask back the Surv object to survival package. Any ideas for that? Thanks again! Ofra -- View this message in context: http://r.789695.n4.nabble.com/ctree-for-suvival-analysis-problem-tp4630362p4630403.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] nls and if statements
On May 17, 2012, at 10:06 AM, DWatts wrote: Hi All, I have a situation where I want an 'if' variable to be parameterized. It's entirely possible that the way I'm trying to do this is wrong, especially given the error message I get that indicates I can't do this using an 'if' statement. Essentially, I have data where I think a relationship enters when a variable (here Pwd) is below some value (z). I don't know that value, so I want to fit it. The data is Pw, Tsoil, and Cfl. nlstest=nls(if(Pwz){Cfl~K*exp(-b*Pw)+c }else{ Cfl~K*(exp(-a*Tsoil))*exp(-b*Pw)+c },start=c(K=5.5, a=0.1, b=0.1, c=2, z=5)) Perhaps recasting as Boolean equivalent: nlstest== - nls({Cfl~ (Pwz)*K*exp(-b*Pw)+c) + !(Pwz)*(K*(exp(-a*Tsoil))*exp(-b*Pw)+c)}, start=c(K=5.5, a=0.1, b=0.1, c=2, z=5)) and provide commented, minimal, self-contained, reproducible code. Untested in absence of data. -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] nls and if statements
On May 17, 2012, at 11:08 AM, David Winsemius wrote: On May 17, 2012, at 10:06 AM, DWatts wrote: Hi All, I have a situation where I want an 'if' variable to be parameterized. It's entirely possible that the way I'm trying to do this is wrong, especially given the error message I get that indicates I can't do this using an 'if' statement. Essentially, I have data where I think a relationship enters when a variable (here Pwd) is below some value (z). I don't know that value, so I want to fit it. The data is Pw, Tsoil, and Cfl. nlstest=nls(if(Pwz){Cfl~K*exp(-b*Pw)+c }else{ Cfl~K*(exp(-a*Tsoil))*exp(-b*Pw)+c },start=c(K=5.5, a=0.1, b=0.1, c=2, z=5)) Perhaps recasting as Boolean equivalent: nlstest== - nls({Cfl~ (Pwz)*K*exp(-b*Pw)+c) + #needs another open-paren ^ !(Pwz)*(K*(exp(-a*Tsoil))*exp(-b*Pw)+c)}, start=c(K=5.5, a=0.1, b=0.1, c=2, z=5)) nlstest== - nls({Cfl~ (Pwz)*( K*exp(-b*Pw)+c) + !(Pwz)*(K*(exp(-a*Tsoil))*exp(-b*Pw)+c)}, start=c(K=5.5, a=0.1, b=0.1, c=2, z=5)) and provide commented, minimal, self-contained, reproducible code. Still untested in absence of data. -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] ctree for suvival analysis problem
On May 17, 2012, at 11:04 AM, ofraam wrote: Thanks very much Achim! I was indeed using pec which requires rms... I see now that the old version of pec that I used didn't require rms and therefore I had no problem.. I'm guessing I don't need the rms methods for my use of pec, but am not sure how I can remove the dependency or alternatively mask back the Surv object to survival package. Any ideas for that? Perhaps: GBSG2ct - ctree(survival::Surv(time, cens) ~ .,data = GBSG2) -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org 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] ctree for suvival analysis problem
Thanks David!!! Sorry for the stupid question... Seems like I still have issues with pec, but I will work on it some more... -- View this message in context: http://r.789695.n4.nabble.com/ctree-for-suvival-analysis-problem-tp4630362p4630408.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] how to find outliers from the list of values
Petr et. al: FWIW (probably not much). As you know, tens of thousands of pages about outliers have been written by statisticians. IMHO, it is another of the really terrible ideas of our discipline and has led to much scientific abuse, as indicated by this posting. For this reason, I have eliminated it from my vocabulary, using instead unusual or unexpected values, whose meaning and purpose is pretty much as you described -- to bring the user's attention to data issues that may require investigation and intervention. By eliminating the term, I feel it excises the notion that there can somehow be statistical tests (alone) that can, irrespective of scientific context, statistically identify illegitimate data. A really dangerous and pernicious idea imho. Best, Bert On Thu, May 17, 2012 at 6:44 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi I had not see any answer yet but maybe there is nobody who wants to touch the elusive object of outlier. Neither me, but here are some ideas how one can proceed. First of all its always up to you what is considered an outlier and how will you deal with them. I usually call an outlier any item which does not fit to the pattern and the pattern is usually best observed by some plotting function. You can identify outlier points, inspect the data source, correct typing mistakes and only if the value is really measured and you can not find any reason why it has such value it is real outlier. Then ***you*** need to decide what to do with it - discard, can come from some long tailed distribution, ... So here are my 0.02$ regarding an outlier theme. Regards Petr Hi, I am new to R and I would like to get your help in finding 'outliers'. I have mvoutlier package installed in my system and added the package . But I not able find a function from 'mvoutlier' package which will identify 'outliers'. This is the sample list of data I have got which has one out-lier. 11489 11008 11873 8000 9558 8645 8024 8371 It will be of great help if somebody have got an example script for the same. Thanks Regards, Thomas [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ R-help@r-project.org 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] Covariance structure for lme
Greetings again R users, Some of you will likely recognize me but I hope you can help me once more. I have tried the mixed model mailing list for this question but have yet to find a solution. As such I hope someone will have another idea. I have previously attempted to replicate the UN, CS, and AR(1) covariance structures used in SAS PROC MIXED. However, my efforts have fallen short on replicating the Variance Components (VC) structure. I have read that it is also known as a diagonal structure. Below I have copied over all the models I have tried and their output with no success. Perhaps someone here will see my error or something I have overlooked. I have attached the data for this particular model. Thanks to all, I certainly cannot thank this help list enough. I you need any further information/clarification, please ask. Cheers, Charles dat=read.table(C:/subset.csv,sep=,,header=TRUE, na.strings=.) attach(dat) dat34=dat[Group %in% c(3, 4),] attach(dat34) liver34=within(dat34, { Group=factor(Group) Event_name=factor(Event_name) Died=factor(Died) ID=factor(ID) }) attach(liver34) contrasts(liver34$Old_Event_name)=contr.sum(n=6) contrasts(liver34$Pig_group)=contr.sum(n=2) contrasts(liver34$Died)=contr.sum(n=2) ##What is should be from SAS #CV var #Type 3 Tests of Fixed Effects #Effect NumDF DenDF F Value Pr F #Group 1 22 0.250.6244 #Died1 22 6.550.0179 #Group*Died 1 22 4.430.0470 fit.1=lme(var~Group*Died, random=~1|ID, data=dat34) anova(fit.1, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 227.58700 .0001 #Group 122 0.18320 0.6728 #Died 122 3.63388 0.0698 #Group:Died 122 3.04103 0.0951 fit.2=lme(var~Group*Died, data=dat34, random=~1|ID/Died) anova(fit.2, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 77.99004 .0001 #Group 122 1.46275 0.2393 #Died 122 5.84535 0.0243 #Group:Died 122 3.04103 0.0951 fit.3=lme(var~Group*Died, random=list(ID=pdSymm(~Event_name)), data=dat34) anova(fit.3, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 273.10918 .0001 #Group 122 0.69692 0.4128 #Died 122 1.43316 0.2440 #Group:Died 122 5.74399 0.0255 fit.4=lme(var~Group*Died, random=list(ID=pdSymm(~Group)), data=dat34) anova(fit.4, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 235.13889 .0001 #Group 122 0.15878 0.6941 #Died 122 3.83253 0.0631 #Group:Died 122 3.01222 0.0966 fit.5=lme(var~Group*Died, random=list(ID=pdSymm(~Group)), data=dat34, weights=varIdent(form=~1|Event_name)) anova(fit.5, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 277.16705 .0001 #Group 122 0.23901 0.6298 #Died 122 3.99283 0.0582 #Group:Died 122 3.23135 0.0860 fit.6=lme(var~Group*Died, random=list(ID=pdSymm(~Group)), data=dat34, weights=varIdent(form=~1|Event_name)) anova(fit.6, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 277.16705 .0001 #Group 122 0.23901 0.6298 #Died 122 3.99283 0.0582 #Group:Died 122 3.23135 0.0860 fit.7=lme(var~(Group*Died), random=list(ID=pdCompSymm(~Died)), data=dat34) anova(fit.7, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 85.83799 .0001 #Group 122 1.60624 0.2183 #Died 122 4.71795 0.0409 #Group:Died 122 2.65379 0.1175 fit.8=lme(var~(Group*Died), data=dat34, random=~1|ID, corr=corSymm()) anova(fit.8, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 119.54403 .0001 #Group 122 4.58972 0.0435 #Died 122 8.01715 0.0097 #Group:Died 122 5.27470 0.0315 fit.9=lme(var~(Group*Died), data=dat34, random=list(ID=pdDiag(~Group*Died)), corr=corSymm(, ~1|ID)) # Error in lme.formula(var ~ (Group * Died), data = dat34, random = list(ID = pdDiag(~Group * : # nlminb problem, convergence error code = 1 # message = iteration limit reached without convergence (9) fit.10=lme(var~(Group*Died), data=dat34, random=list(ID=pdDiag(~Group*Died)), corr=NULL) anova(fit.10, type=marginal, adjustSigma=F) # numDF denDF F-value p-value #(Intercept)1 101 93.90211 .0001 #Group 122 1.75311 0.1991 #Died 122 6.84379 0.0158
Re: [R] how to find outliers from the list of values
Petr and Bert offer sound advice. At the risk of getting completely ostracized, here's how you could find outliers using the definition of 'outlier' used by R's boxplot function and at the same time see your data. dat = c(11489, 11008, 11873, 8000, 9558, 8645, 8024, 8371) a = boxplot(dat) a$out [1] 8e+07 -Original Message- From: Prakash Thomas Sent: Tuesday, May 15, 2012 7:00 AM To: r-help@r-project.org Subject: [R] how to find outliers from the list of values Hi, I am new to R and I would like to get your help in finding 'outliers'. I have mvoutlier package installed in my system and added the package . But I not able find a function from 'mvoutlier' package which will identify 'outliers'. This is the sample list of data I have got which has one out-lier. 11489 11008 11873 8000 9558 8645 8024 8371 It will be of great help if somebody have got an example script for the same. Thanks Regards, Thomas [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- Robert W. Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A. T. Still University of Health Sciences 800 W. Jefferson St. Kirksville, MO 63501 660-626-2322 FAX 660-626-2965 __ R-help@r-project.org 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] nls and if statements
David Winsemius wrote and provide commented, minimal, self-contained, reproducible code. Still untested in absence of data. Thank you, and my apologies for not giving some sample numbers. Below is a short subset of the data set I'm working with. Cfl=c(2.61,4.21,2,2.75,7.47,1.2,3.24,12.49,2.37,3.28,4.3,2.61,2.75,2.92,3.78,2.25,2.84,3.33,2.39) Tsoil=c(30.01,27.72,34.91,21.96,22.83,29.65,20.56,23.72,33.96,31.57,19.15,28.49,30.02,20.14,30.23,33.99,32.58,17.87,19.78) Pw=c(30,29,24,22,22,41.2,-33.1,-49.21,29.6,24.5,-6.1544,42.8,63,55.5,43.3,38.5,87.2,-0.32,79.5) Rui's code seems to elegantly do what I was attempting (and will try the Boolian version next), but I'm having initial parameterization problems. I've tried doing what I've done before, which is use the excel solver to give me some simple early estimates of params, but it doesn't appear to be helping in this case. nlstest=nls(Cfl~K*ifelse(Pw z, 1, exp(-a*Tsoil))*exp(-b*Pw)+c, start=c(K=0.14, a=0.01, b=0.04, c=3.5, z=5), trace=T) I'll keep chugging away at this. Thank you for your help! -- View this message in context: http://r.789695.n4.nabble.com/nls-and-if-statements-tp4630391p4630410.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Correlation Matrix
Could anyone can help me telling the way how I can build correlation matrix in R? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Correlation Matrix
Thanks a lot. Suppose I want to use Pearson's method, then what I have to do? -- View this message in context: http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389p4630396.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] nls and if statements
Hello, I don't know if this is what you want, but your formula is equivalent to nlstest=nls(Cfl~K*ifelse(Pw z, 1, exp(-a*Tsoil))*exp(-b*Pw)+c ,start=c(K=5.5, a=0.1, b=0.1, c=2, z=5)) Hope this helps, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/nls-and-if-statements-tp4630391p4630398.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Correlation Matrix
Hi Mahdi, Look at the documentation for cor(), by typing ?cor or help(cor). Pearson is the default and it is trivial to select the others. I suggest you try searching google or reading R's documentation before posting to the list. You may not understand it all, but it shows you tried to work on your own and let's you ask more specific questions. For example: I am using function foo(), and read the documentation, but was confused by this paragraph some paragraph from docs for foo. Then we can come along and so oh, what that means is _. Cheers, Josh On Thu, May 17, 2012 at 7:22 AM, mahdi mahd...@gmail.com wrote: Thanks a lot. Suppose I want to use Pearson's method, then what I have to do? -- View this message in context: http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389p4630396.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org 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] Correlation Matrix
Josh: A very nice, clear, polite, concise, and reasoned alternative to RTFM ! Probably should be templated somehow, given the volume of queries of this sort that this list receives. (The posting guide is too involved to serve in its stead.) Cheers, Bert On Thu, May 17, 2012 at 9:31 AM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi Mahdi, Look at the documentation for cor(), by typing ?cor or help(cor). Pearson is the default and it is trivial to select the others. I suggest you try searching google or reading R's documentation before posting to the list. You may not understand it all, but it shows you tried to work on your own and let's you ask more specific questions. For example: I am using function foo(), and read the documentation, but was confused by this paragraph some paragraph from docs for foo. Then we can come along and so oh, what that means is _. Cheers, Josh On Thu, May 17, 2012 at 7:22 AM, mahdi mahd...@gmail.com wrote: Thanks a lot. Suppose I want to use Pearson's method, then what I have to do? -- View this message in context: http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389p4630396.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org 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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ R-help@r-project.org 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] Windows Task Scheduler and R updates. Need basic tips
This is a basic Windows system administrator problem, asked by a Linux guy who is helping out in a Windows lab. I want to keep R packages up to date on MS Windows 7 with a job in the Task Scheduler. I have an R program that I can run (as administrator) that updates the existing packages and then installs all the new ones. I do not understand how to run that in a dependable way in the scheduler. If I put the update script R-update.R in, for example, in C:\Program Files\R\R-update.R Then what? Do I need a CMD batch script to run the R script? I can't tell where Windows wants to write the standard output and error for my R job. And while I'm asking, does Windows care if I run R CMD BATCH C:\Program Files\R\R-update.R or R --vanilla -f C:\Program Files\R\R-update.R pj -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu __ R-help@r-project.org 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] nls and if statements
On 2012-05-17 08:40, DWatts wrote: David Winsemius wrote and provide commented, minimal, self-contained, reproducible code. Still untested in absence of data. Thank you, and my apologies for not giving some sample numbers. Below is a short subset of the data set I'm working with. Cfl=c(2.61,4.21,2,2.75,7.47,1.2,3.24,12.49,2.37,3.28,4.3,2.61,2.75,2.92,3.78,2.25,2.84,3.33,2.39) Tsoil=c(30.01,27.72,34.91,21.96,22.83,29.65,20.56,23.72,33.96,31.57,19.15,28.49,30.02,20.14,30.23,33.99,32.58,17.87,19.78) Pw=c(30,29,24,22,22,41.2,-33.1,-49.21,29.6,24.5,-6.1544,42.8,63,55.5,43.3,38.5,87.2,-0.32,79.5) Rui's code seems to elegantly do what I was attempting (and will try the Boolian version next), but I'm having initial parameterization problems. I've tried doing what I've done before, which is use the excel solver to give me some simple early estimates of params, but it doesn't appear to be helping in this case. nlstest=nls(Cfl~K*ifelse(Pw z, 1, exp(-a*Tsoil))*exp(-b*Pw)+c, start=c(K=0.14, a=0.01, b=0.04, c=3.5, z=5), trace=T) I'll keep chugging away at this. Thank you for your help! If the above data is all you have, I wouldn't chugg too long. Looking at plots of Cfl~Pw and Cfl~Tsoil says to me that you have far too much variability to fit your model. You might find this plot instructive: library(rgl) plot3d(Pw, Tsoil, Cfl, col=1+(Pw5), size=5) Peter Ehlers __ R-help@r-project.org 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] Complex sort problem
On Thu, May 17, 2012 at 06:45:52AM -0400, Axel Urbiz wrote: Dear List, Is there a way I can sort a sample based on a sort index constructed from the data from which the sample is taken? Basically, I need to take 'many' samples from the same source data and sort them. This can be very time consuming for long vectors. Is there any way I can sort the data only once initially, and use that sort order for the samples? I believe that idea is what is implemented in tree-based classifiers, so the data is sorted only once initially and that sort order is used for the child nodes. set.seed(12345) x - sample(0:100, 10) x.order - order(x) x.sorted - x[x.order] sample.ind - sample(1:length(x), 5, replace = TRUE) #sample 1/2 size with replacement x.sample - x[sample.ind] x.sample.sorted - #??? (without sorting again) Hi. Formally, it is possible to avoid sorting using tabulate() and rep(). However, i am not sure, whether this approach is more efficient. set.seed(12345) x - sample(0:100, 10) x.order - order(x) x.sorted - x[x.order] sample.ind - sample(1:length(x), 5, replace = TRUE) #sample 1/2 size with replacement x.sample - x.sorted[sample.ind] freq - tabulate(sample.ind, nbins=length(x)) x.sample.sorted - rep(x.sorted, times=freq) identical(sort(x.sample), x.sample.sorted) # [1] TRUE Note that x.sample is created from x.sorted in order to make x.sample and x.sample.sorted consistent. Since sample.ind has random order, the distributions of x[sample.ind] and x.sorted[sample.ind] are the same. Computing the frequencies of indices, whose range is known in advance, can be done in linear time, so theoretically more efficiently than sorting. However, only a test may determine, what is more efficient in your situation. Hope this helps. Petr Savicky. __ R-help@r-project.org 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] hmd.mx
Type str(slovenia) or perhaps names(slovenia) to find out more about how the slovenia object is structured, and the correct names of its elements. Also ?hmd.mx (also see,for example, http://help.pop.psu.edu/help-by-software-package/r-project/demography-in-r/ demography-package-for-r) Also, since hmd.mx is not part of base R, please identify what package it is from. The error message typically comes from converting character to numeric when some of the values are not numeric. Try, for example, as.numeric( c('1','2','A','4') ) -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 5/17/12 2:41 AM, krmartina martina.kruec...@gmail.com wrote: I have trouble using function hmd.mx I have all packages required. I call function: slovenia - hmd.mx(SVN, username, password, Slovenia) : and I get this error: NAs introduced by coercion And if I then call slovenia, I get: slovenia Mortality data for Slovenia Series: female male total Years: 1983 - 2009 Ages: 0 - 110 But I do not get any value (mortality, ...): slovenia$ages NULL slovenia$years NULL I tried also for two different countries and I got the same result. Can please anybody help me with this problem? Thank you very much. Martina -- View this message in context: http://r.789695.n4.nabble.com/hmd-mx-tp4630350.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] caret: Error when using rpart and CV != LOOCV
Dominik, There are a number of formulations of this statistic (see the Kvålseth[*] reference below). I tend to think of R^2 as the proportion of variance explained by the model[**]. With the traditional formula, it is possible to get negative proportions (if there are extreme outliers in the predictions, the negative proportion can be very large). I used this formulation because it is always on (0, 1). It is called R^2 after all! Here is an example: set.seed(1) simObserved - rnorm(100) simPredicted - simObserved + rnorm(100)*.1 cor(simObserved, simPredicted)^2 [1] 0.9887525 customSummary(data.frame(obs = simObserved, + pred = simPredicted)) RMSE Rsquared 0.09538273 0.98860908 simPredicted[1] [1] -0.6884905 simPredicted[1] - 10 cor(simObserved, simPredicted)^2 [1] 0.3669257 customSummary(data.frame(obs = simObserved, + pred = simPredicted)) RMSE Rsquared 1.066900 -0.425169 It is somewhat extreme, but it does happen. Max * Kvålseth, T. (1985). Cautionary note about $R^2$. American statistician, 39(4), 279–285. * This is a very controversial statement when non-linear models are used. I'd rather use RMSE, but many scientists I work with still think in terms of R^2 regardless of the model. The randomForest function also computes this statistic, but calls it % Var explained instead of explicitly labeling it as R^2. This statistic has generated heated debates and I hope that I will not have to wear a scarlet R in Nashville in a few weeks. On Thu, May 17, 2012 at 1:35 PM, Dominik Bruhn domi...@dbruhn.de wrote: Hy Max, thanks again for the answer. I checked the caret implementation and you were right. If the predictions for the model constant (or sd(pred)==0) then the implementation returns a NA for the rSquare (in postResample). This is mainly because the caret implementation uses `cor` (from the stats-package) which would throw a error for values with sd(pred)==0. Do you know why this is implemented in this way? I wrote my own summaryFunction which calculates rSquare by hand and it works fine. It nevertheless does NOT(!) generate the same values as the original implementation. It seems that the calcuation of Rsquare does not seem to be consistent. I took mine from Wikipedia [1]. Here is my code: --- customSummary - function (data, lev = NULL, model = NULL) { #Calulate rSquare ssTot - sum((data$obs-mean(data$obs))^2) ssErr - sum((data$obs-data$pred)^2) rSquare - 1-(ssErr/ssTot) #Calculate MSE mse - mean((data$pred - data$obs)^2) #Aggregate out - c(sqrt(mse), 1-(ssErr/ssTot)) names(out) - c(RMSE, Rsquared) return(out) } --- [1]: http://en.wikipedia.org/wiki/Coefficient_of_determination#Definitions Thanks! Dominik On 17/05/12 04:10, Max Kuhn wrote: Dominik, See this line: Min. 1st Qu. Median Mean 3rd Qu. Max. 30.37 30.37 30.37 30.37 30.37 30.37 The variance of the predictions is zero. caret uses the formula for R^2 by calculating the correlation between the observed data and the predictions which uses sd(pred) which is zero. I believe that the same would occur with other formulas for R^2. Max On Wed, May 16, 2012 at 11:54 AM, Dominik Bruhn domi...@dbruhn.de wrote: Thanks Max for your answer. First, I do not understand your post. Why is it a problem if two of predictions match? From the formula for calculating R^2 I can see that there will be a DivByZero iff the total sum of squares is 0. This is only true if the predictions of all the predicted points from the test-set are equal to the mean of the test-set. Why should this happen? Anyway, I wrote the following code to check what you tried to tell: -- library(caret) data(trees) formula=Volume~Girth+Height customSummary - function (data, lev = NULL, model = NULL) { print(summary(data$pred)) return(defaultSummary(data, lev, model)) } tc=trainControl(method='cv', summaryFunction=customSummary) train(formula, data=trees, method='rpart', trControl=tc) -- This outputs: --- Min. 1st Qu. Median Mean 3rd Qu. Max. 18.45 18.45 18.45 30.12 35.95 53.44 Min. 1st Qu. Median Mean 3rd Qu. Max. 22.69 22.69 22.69 32.94 38.06 53.44 Min. 1st Qu. Median Mean 3rd Qu. Max. 30.37 30.37 30.37 30.37 30.37 30.37 [cut many values like this] Warning: In nominalTrainWorkflow(dat = trainData, info = trainInfo, method = method, : There were missing values in resampled performance measures. - As I didn't understand your post, I don't know if this confirms your assumption. Thanks anyway, Dominik On 16/05/12 17:30, Max Kuhn wrote: More information is needed to be sure, but it is most likely that some of the resampled rpart models produce the same prediction for the hold-out samples (likely the result of no viable split being found). Almost
Re: [R] Optimization problem
Hi Greg, The problem is that I also have restrictions for each variable (they must be higher than -.07 and smaller than .2) and I'm dealing with a lot of them. I've already tried the second approach but, as far as it seems, the function doesn't satisfy my objective. That's what I'm doing: . faum = function(aum) { (...) ifelse(colMeans(prob) .65, totm - (sum(marg)), totm - -1e10) #prob is a transformation of 'aum' and sum(marg) (always positive) is what I want to maximize (...) return(-totm) } optim(rep(0,nrow), faum, method=L-BFGS-B, control=list(trace=12), lower=rep(-.07,nrow), upper=rep(.2,nrow) ) . The function gives me 1e10 if my initial values for the parameters doesn't satisfy mean.65 and doesn't improve my initial conditions if they satisfy mean=.65. I know that a solution with mean.65 exists, I can find it by hand. -- View this message in context: http://r.789695.n4.nabble.com/Optimization-problem-tp4630278p4630419.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] caret: Error when using rpart and CV != LOOCV
Hy Max, thanks again for the answer. I checked the caret implementation and you were right. If the predictions for the model constant (or sd(pred)==0) then the implementation returns a NA for the rSquare (in postResample). This is mainly because the caret implementation uses `cor` (from the stats-package) which would throw a error for values with sd(pred)==0. Do you know why this is implemented in this way? I wrote my own summaryFunction which calculates rSquare by hand and it works fine. It nevertheless does NOT(!) generate the same values as the original implementation. It seems that the calcuation of Rsquare does not seem to be consistent. I took mine from Wikipedia [1]. Here is my code: --- customSummary - function (data, lev = NULL, model = NULL) { #Calulate rSquare ssTot - sum((data$obs-mean(data$obs))^2) ssErr - sum((data$obs-data$pred)^2) rSquare - 1-(ssErr/ssTot) #Calculate MSE mse - mean((data$pred - data$obs)^2) #Aggregate out - c(sqrt(mse), 1-(ssErr/ssTot)) names(out) - c(RMSE, Rsquared) return(out) } --- [1]: http://en.wikipedia.org/wiki/Coefficient_of_determination#Definitions Thanks! Dominik On 17/05/12 04:10, Max Kuhn wrote: Dominik, See this line: Min. 1st Qu. MedianMean 3rd Qu.Max. 30.37 30.37 30.37 30.37 30.37 30.37 The variance of the predictions is zero. caret uses the formula for R^2 by calculating the correlation between the observed data and the predictions which uses sd(pred) which is zero. I believe that the same would occur with other formulas for R^2. Max On Wed, May 16, 2012 at 11:54 AM, Dominik Bruhn domi...@dbruhn.de wrote: Thanks Max for your answer. First, I do not understand your post. Why is it a problem if two of predictions match? From the formula for calculating R^2 I can see that there will be a DivByZero iff the total sum of squares is 0. This is only true if the predictions of all the predicted points from the test-set are equal to the mean of the test-set. Why should this happen? Anyway, I wrote the following code to check what you tried to tell: -- library(caret) data(trees) formula=Volume~Girth+Height customSummary - function (data, lev = NULL, model = NULL) { print(summary(data$pred)) return(defaultSummary(data, lev, model)) } tc=trainControl(method='cv', summaryFunction=customSummary) train(formula, data=trees, method='rpart', trControl=tc) -- This outputs: --- Min. 1st Qu. MedianMean 3rd Qu.Max. 18.45 18.45 18.45 30.12 35.95 53.44 Min. 1st Qu. MedianMean 3rd Qu.Max. 22.69 22.69 22.69 32.94 38.06 53.44 Min. 1st Qu. MedianMean 3rd Qu.Max. 30.37 30.37 30.37 30.37 30.37 30.37 [cut many values like this] Warning: In nominalTrainWorkflow(dat = trainData, info = trainInfo, method = method, : There were missing values in resampled performance measures. - As I didn't understand your post, I don't know if this confirms your assumption. Thanks anyway, Dominik On 16/05/12 17:30, Max Kuhn wrote: More information is needed to be sure, but it is most likely that some of the resampled rpart models produce the same prediction for the hold-out samples (likely the result of no viable split being found). Almost every incarnation of R^2 requires the variance of the prediction. This particular failure mode would result in a divide by zero. Try using you own summary function (see ?trainControl) and put a print(summary(data$pred)) in there to verify my claim. Max On Wed, May 16, 2012 at 11:30 AM, Max Kuhn mxk...@gmail.com wrote: More information is needed to be sure, but it is most likely that some of the resampled rpart models produce the same prediction for the hold-out samples (likely the result of no viable split being found). Almost every incarnation of R^2 requires the variance of the prediction. This particular failure mode would result in a divide by zero. Try using you own summary function (see ?trainControl) and put a print(summary(data$pred)) in there to verify my claim. Max On Tue, May 15, 2012 at 5:55 AM, Dominik Bruhn domi...@dbruhn.de wrote: Hy, I got the following problem when trying to build a rpart model and using everything but LOOCV. Originally, I wanted to used k-fold partitioning, but every partitioning except LOOCV throws the following warning: Warning message: In nominalTrainWorkflow(dat = trainData, info = trainInfo, method = method, : There were missing values in resampled performance measures. - Below are some simplified testcases which repoduce the warning on my system. Question: What does this error mean? How can I avoid it? System-Information: - sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8
Re: [R] step function stops with subscript out of bounds
Thanks. I guess I still don't understand what's going on. It's not at all intuitive that the table used should be in the search path. Why is it searching for the table? Isn't the table already stored in the model? If the documentation says this, I haven't found it. Needing to know what names I can't use is a bit disconcerting. I can think of names with high probability of uniqueness but how could I ever be sure? Table X is built on the fly in a script. What I supplied here was a portion of the remaining script. I suppose the solution is to store it in an environment in the search path. DAV -Original Message- From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Sent: Thursday, May 17, 2012 6:46 AM To: David A Vavra Cc: r-help@r-project.org Subject: Re: [R] step function stops with subscript out of bounds On 17/05/2012 09:25, David A Vavra wrote: I've been having a problem using the step function to evaluate models. I've simplified the code and get the same problem using the dataset Titanic. The relevant code and output is below. The problem disappears (i.e., 'step' runs correctly) if I rerun the code but change the 'loglm' call to explicitly reference Titanic instead of X (as in: loglm(as.formula(Y),data=Titanic)). What is causing this? A lack of understanding of 'non-standard evaluation'. X (or at least, the X you want) is not visible from the standard search path. TIA, DAV -- catn-function(...) cat(...,\n) local({ X-Titanic; print(class(X)); Y-paste('~',paste(names(dimnames(X)),collapse=*)); print(Y); sm-loglm(as.formula(Y),data=X); catn(SM); print(sm); catn('running'); step(sm,direction='backward') }) Which will tell you Error in eval(expr, envir, enclos) : could not find function loglm If you correct that and use a vanilla session you will get Error in loglm(formula = ~Class + Sex + Age + Survived + Class:Sex + Class:Age + : object 'X' not found which is more informative. So the solution is to - use less easily masked names than 'X'. - ensure the data object is visible on the search path. Output: [1] table [1] ~ Class*Sex*Age*Survived SM Call: loglm(formula = as.formula(Y), data = X) Statistics: X^2 df P( X^2) Likelihood Ratio 0 01 Pearson NaN 01 running Start: AIC=64 ~Class * Sex * Age * Survived Error in loglin(data, margins, start = start, fit = fitted, param = param, : subscript out of bounds Enter a frame number, or 0 to exit 1: local({ X- Titanic print(class(X)) Y- paste(~, paste(names(dimnames(X)), collapse = *)) print(Y) sm- loglm(as.formula(Y), data = X 2: eval.parent(substitute(eval(quote(expr), envir))) 3: eval(expr, p) 4: eval(expr, envir, enclos) 5: eval(quote({ X- Titanic print(class(X)) Y- paste(~, paste(names(dimnames(X)), collapse = *)) print(Y) sm- loglm(as.formula(Y), dat 6: eval(expr, envir, enclos) 7: #1: step(sm, direction = backward) 8: #1: drop1(fit, scope$drop, scale = scale, trace = trace, k = k, ...) 9: #1: drop1.default(fit, scope$drop, scale = scale, trace = trace, k = k, ...) 10: #1: update(object, as.formula(paste(~ . -, tt)), evaluate = FALSE) 11: #1: update.loglm(object, as.formula(paste(~ . -, tt)), evaluate = FALSE) 12: #1: eval.parent(call) 13: #1: eval(expr, p) 14: #1: eval(expr, envir, enclos) 15: #1: loglm(formula = ~Class + Sex + Age + Survived + Class:Sex + Class:Age + Sex:Age + Class:Survived + Sex:Survived + Age:Survived + Class:Sex:Age + Class: 16: #1: loglm1(formula, data, ..., .call = .call, .formula = .formula) 17: #1: loglm1.default(formula, data, ..., .call = .call, .formula = .formula) 18: #1: loglin(data, margins, start = start, fit = fitted, param = param, eps = eps, iter = iter, print = print) Selection: 0 __ R-help@r-project.org 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. -- Brian D. Ripley, rip...@stats.ox.ac.uk 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@r-project.org 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] as.function parameters
On 05/17/2012 06:30 AM, jackl wrote: Hi.. Ok here is an example on how I wanted the tree to be implemented in R: - the tree is, as you wrote, saved as a list of different tree levels - each tree level is also saved as a list of different nodes in that specific level - and for the last part, each node is then saved as a list of functions example: tree- list(root, lvl1, lvl2) root- list(node00) lvl1- list(node10, node11) lvl2- list(node20, node21, node22) node00- list(f1,f2,f3) node10- list(f1,f2,f3) node11- list(f1,f2,f3) .. note: I wrote f1, f2 and f3 in each node because it is the same function, just with the different parameter, the stock price at that node. I tried implementing a tree manually and I found out that the independences between one node and each childnode cause a heavy computation power.. (the function f3 contains f3 of the two childnodes and so on..) example: node11$f3- max(node11$f2, node21$f3, node22$f3) Im facing this problem even with a tree with 'only' 4-5 layers.. best thanks for any answers Hi, First, what problem are you trying to solve? A tree structure is not a problem... it's a tool, to solve a problem. Second, a tree data structure is simply a simplified graph structure. There are many packages in R that deal with and store graph structures. Two that come to mind are igraph http://cran.r-project.org/web/packages/igraph/index.html and sna http://cran.r-project.org/web/packages/sna/ Since those packages can handle graphs, they can handle trees as well. As an added bonus, the code is already available and well-tested. If memory usage is a concern, then look into using a sparse matrix implementation. Jason __ R-help@r-project.org 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] glm convergence warning
Hi, When I run the following code : Y - c(rep(0,35),1,2,0,6,8,16,43) cst - log(choose(42, 42:1)) beta - 42:1 tau - (beta^2)/2 fit - glm(formula = Y ~ offset(cst) + beta + tau, family = poisson) fit fit$converged glm prints a warning saying that the algorithm did not converge. However, fit$converged takes the value TRUE. I don't understand why fit$converged is not always FALSE when the warning algorithm did not converge is produced. Could someone help me understand why I get this result? Thanks a lot, Sophie __ R-help@r-project.org 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] solve the equation in R
Hi all, I need to solve this following equation which the unknown value (here is a) is on the exponent place, could anybody please help me to figure it out? I tried to use lm.sol() or solve() function but it doesn't work.. Thanks for help, Peiling (x, y) = (2.21, 1.01) y = 1 + x - ( 1 + (x)^a)^(1/a) __ R-help@r-project.org 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] hmd.mx
I used str(slovenia) and saw I was using wrong names - instead of year I tried years and the same with age. For hmd.mx you need package RCurl. Thank you very much for your help! Martina -- View this message in context: http://r.789695.n4.nabble.com/hmd-mx-tp4630350p4630439.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] solve the equation in R
You could probably find a way to do this using nls(), optim() or uniroot() but this seems to be very much a homework problem so I won't say more. solve() solves matrix linear equations... not what you want here. Read the docs. Michael On Thu, May 17, 2012 at 2:53 PM, Pei-Ling Lin barthea...@gmail.com wrote: Hi all, I need to solve this following equation which the unknown value (here is a) is on the exponent place, could anybody please help me to figure it out? I tried to use lm.sol() or solve() function but it doesn't work.. Thanks for help, Peiling (x, y) = (2.21, 1.01) y = 1 + x - ( 1 + (x)^a)^(1/a) __ R-help@r-project.org 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@r-project.org 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] Windows Task Scheduler and R updates. Need basic tips
Hi Paul, This is a bit OT, but here's what I would do. 1) write the R script (or if updating packages is all you want Rscript -e update.packages(repos = 'yourrepo', ask = FALSE) would do it without need for a script) 2) write a silly batch file (e.g., Rupdate.bat) wrapper (maybe there are better ways, but this is easy) that contains the command to have R execute the R script (becomes slightly less silly if for example you have multiple versions of R and would like to update all of them, then the batch file could go through systemattically). If you care, you can redirect stderror and stdout from the batch file to any file you choose. 3) With appropriate privileges run (untested): schtasks /Create /SC DAILY /TN Rupdate /TR c:/path/to/Rupdate.bat /ST 19:00 which would create a task Rupdate that would run daily at 19:00 and execute Rupdate.bat. Cheers, Josh On Thu, May 17, 2012 at 10:28 AM, Paul Johnson pauljoh...@gmail.com wrote: This is a basic Windows system administrator problem, asked by a Linux guy who is helping out in a Windows lab. I want to keep R packages up to date on MS Windows 7 with a job in the Task Scheduler. I have an R program that I can run (as administrator) that updates the existing packages and then installs all the new ones. I do not understand how to run that in a dependable way in the scheduler. If I put the update script R-update.R in, for example, in C:\Program Files\R\R-update.R Then what? Do I need a CMD batch script to run the R script? I can't tell where Windows wants to write the standard output and error for my R job. And while I'm asking, does Windows care if I run R CMD BATCH C:\Program Files\R\R-update.R or R --vanilla -f C:\Program Files\R\R-update.R pj -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu __ R-help@r-project.org 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. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org 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] solve the equation in R
On Thu, May 17, 2012 at 01:53:39PM -0500, Pei-Ling Lin wrote: Hi all, I need to solve this following equation which the unknown value (here is a) is on the exponent place, could anybody please help me to figure it out? I tried to use lm.sol() or solve() function but it doesn't work.. Thanks for help, Peiling (x, y) = (2.21, 1.01) y = 1 + x - ( 1 + (x)^a)^(1/a) Hi. First, plot the function f - function(a) { 1 + x - ( 1 + (x)^a)^(1/a) - y } x - 2.21 y - 1.01 a - seq(0.1, 20, length=1000) plot(a, f(a), ylim=c(-0.2, 0.2), type=l) abline(h=0) This suggests, that there is no root. This may also be obtained analytically. Hope this helps. Petr Savicky. __ R-help@r-project.org 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] solve the equation in R
On 17-May-2012 21:50:17 Petr Savicky wrote: On Thu, May 17, 2012 at 01:53:39PM -0500, Pei-Ling Lin wrote: Hi all, I need to solve this following equation which the unknown value (here is a) is on the exponent place, could anybody please help me to figure it out? I tried to use lm.sol() or solve() function but it doesn't work.. Thanks for help, Peiling (x, y) = (2.21, 1.01) y = 1 + x - ( 1 + (x)^a)^(1/a) Hi. First, plot the function f - function(a) { 1 + x - ( 1 + (x)^a)^(1/a) - y } x - 2.21 y - 1.01 a - seq(0.1, 20, length=1000) plot(a, f(a), ylim=c(-0.2, 0.2), type=l) abline(h=0) This suggests, that there is no root. This may also be obtained analytically. Hope this helps. Petr Savicky. Well, certainly no solution for Y 1. But if y 1 then there is a solution. Was the problem stated correctly? Ted. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 17-May-2012 Time: 23:27:09 This message was sent by XFMail __ R-help@r-project.org 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] nls and if statements
Peter Ehlers wrote If the above data is all you have, I wouldn't chugg too long. Looking at plots of Cfl~Pw and Cfl~Tsoil says to me that you have far too much variability to fit your model. You might find this plot instructive: library(rgl) plot3d(Pw, Tsoil, Cfl, col=1+(Pw5), size=5) Peter Ehlers I hadn't realized there was such a package, and wow, do I ever wish I'd learned of that plot3d sooner! I did have a substantially larger data set to work with, but after a much more careful look I realized it would never fit the extra param to the low Pw numbers-- the predictability just isn't there. The 3d plot confirms this, of course. I did, however, get the help I was looking for, so thank you all! Danielle -- View this message in context: http://r.789695.n4.nabble.com/nls-and-if-statements-tp4630391p4630451.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Optimization inconsistencies
I have a very simple maximization problem where I'm solving for the vector x: objective function: w'x = value to maximize box constraints (for all elements of w): low x high equality constraint: sum(x) = 1 But I get inconsistent results depending on what starting values I. I've tried various packages but none seem to bee the very solver in Excel. Any recommendations on what packages or functions I should try? --Nathan [[alternative HTML version deleted]] __ R-help@r-project.org 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] Optimization inconsistencies
On May 18, 2012, at 00:14 , Nathan Stephens wrote: I have a very simple maximization problem where I'm solving for the vector x: objective function: w'x = value to maximize box constraints (for all elements of w): low x high equality constraint: sum(x) = 1 But I get inconsistent results depending on what starting values I. I've tried various packages but none seem to bee the very solver in Excel. Any recommendations on what packages or functions I should try? Sounds like a linear programming problem, so perhaps one of the packages that are specialized for that? lpSolve looks like it should do it. (As a general matter: There's nothing simple about constrained maximization problems, and generic optimizers aren't really geared towards dealing with large sets of constraints.) --Nathan [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org 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] New Eyes Needed to See Syntax Error
One of many scripts to produce 4 lattice plots on one page keeps throwing an error. I've tried manipulating the file to eliminate the error, but have not been able to do so. The error is: source('bicarb.R') Error in source(bicarb.R) : bicarb.R:15:1: unexpected symbol 14: 15: hco33 ^ The 'h' is in column 0 so the caret would be column -1, but it's presented as column 1. The file, bicarb.R is: hco31 - qqmath(~ HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Raw)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) hco32 - qqmath(~ log10(HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Log10)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) hco33 - qqmath(~ sqrt(HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Square Root)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) hco34 - qqmath(~ HCO3^1/3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Cubic Root)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) pdf('hco3.pdf') plot(hco31, split = c(1,1,2,2), more = TRUE) plot(hco32, split = c(1,1,2,2), more = TRUE) plot(hco33, split = c(1,2,2,2), more = TRUE) plot(hco34, split = c(2,2,2,2), more = FALSE) dev.off() If the error is not apparent to you, please suggest what I could try to isolate the cause. Rich -- Richard B. Shepard, Ph.D. | Integrity - Credibility - Innovation Applied Ecosystem Services, Inc. |Helping Ensure Our Clients' Futures http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 __ R-help@r-project.org 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] New Eyes Needed to See Syntax Error
On Thu, 17 May 2012, Rich Shepard wrote: Error in source(bicarb.R) : bicarb.R:15:1: unexpected symbol 14: 15: hco33 ^ These two lines were concatenated in the message on the mail list. Rich -- Richard B. Shepard, Ph.D. | Integrity - Credibility - Innovation Applied Ecosystem Services, Inc. |Helping Ensure Our Clients' Futures http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 __ R-help@r-project.org 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] New Eyes Needed to See Syntax Error
On 12-05-17 04:34 PM, Rich Shepard wrote: hco32 - qqmath(~ log10(HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Log10)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) Missing a closing parenthesis after log10. It should be : log10(HCO3 | factor(basin)) Eloi -- Eloi Mercier Bioinformatics PhD Student, UBC Paul Pavlidis Lab 2185 East Mall University of British Columbia Vancouver BC V6T1Z4 __ R-help@r-project.org 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] New Eyes Needed to See Syntax Error
Your log10(HCO3 and sqrt(HCO3 seem to be missing closing brackets. HTH, baptiste On 18 May 2012 11:34, Rich Shepard rshep...@appl-ecosys.com wrote: One of many scripts to produce 4 lattice plots on one page keeps throwing an error. I've tried manipulating the file to eliminate the error, but have not been able to do so. The error is: source('bicarb.R') Error in source(bicarb.R) : bicarb.R:15:1: unexpected symbol 14: 15: hco33 ^ The 'h' is in column 0 so the caret would be column -1, but it's presented as column 1. The file, bicarb.R is: hco31 - qqmath(~ HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Raw)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) hco32 - qqmath(~ log10(HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Log10)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) hco33 - qqmath(~ sqrt(HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Square Root)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) hco34 - qqmath(~ HCO3^1/3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Cubic Root)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) pdf('hco3.pdf') plot(hco31, split = c(1,1,2,2), more = TRUE) plot(hco32, split = c(1,1,2,2), more = TRUE) plot(hco33, split = c(1,2,2,2), more = TRUE) plot(hco34, split = c(2,2,2,2), more = FALSE) dev.off() If the error is not apparent to you, please suggest what I could try to isolate the cause. Rich -- Richard B. Shepard, Ph.D. | Integrity - Credibility - Innovation Applied Ecosystem Services, Inc. | Helping Ensure Our Clients' Futures http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 __ R-help@r-project.org 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@r-project.org 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] New Eyes Needed to See Syntax Error
On Thu, 17 May 2012, Mercier Eloi wrote: Missing a closing parenthesis after log10. Eloi, A-ha! I knew new eyes would see what I kept missing. Many thanks! Rich -- Richard B. Shepard, Ph.D. | Integrity - Credibility - Innovation Applied Ecosystem Services, Inc. |Helping Ensure Our Clients' Futures http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 __ R-help@r-project.org 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 convergence warning
Hi Sophie It helps if you do some detective work Try fit1 - glm(formula = Y ~ offset(cst) + beta + tau, family = poisson,trace = T, maxit = 200) and compare Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au At 05:35 18/05/2012, you wrote: Hi, When I run the following code : Y - c(rep(0,35),1,2,0,6,8,16,43) cst - log(choose(42, 42:1)) beta - 42:1 tau - (beta^2)/2 fit - glm(formula = Y ~ offset(cst) + beta + tau, family = poisson) fit fit$converged glm prints a warning saying that the algorithm did not converge. However, fit$converged takes the value TRUE. I don't understand why fit$converged is not always FALSE when the warning algorithm did not converge is produced. Could someone help me understand why I get this result? Thanks a lot, Sophie __ R-help@r-project.org 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@r-project.org 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] Integration of two dimension function
Dear all, I have a function f - function(x,y,c){as.numeric(x*y c) } I need to solve the value of c so that when I take the integral of the function f from 0.2 to 0.8 with respect to x and from 0 to 1 with respect to y, the integral equal some prefixed value, say 0.025. It involves two dimension integration. Can anyone give some help on this? Thank you so much in advance. Hannah [[alternative HTML version deleted]] __ R-help@r-project.org 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] Failure building any package
Hello, I'm attempting to build a package using R 2.15.0 on OS X I am getting a generic failure when performing a cran type check on the package. Even with a very simple test package, it still fails int he same place. Example: In R: rm(list=ls()) foo - function(x){print(x)} package.skeleton(name=foo) Then, at the command line: R CMD build foo R CMD check --as-cran foo_1.0.tar.gz Some output not included here * checking whether package ‘foo’ can be installed … ERROR Installation failed. See ‘foo.Rcheck/00install.out’ for details. Looking at the 00install.out file, I see: * installing *source* package ‘foo’ ... ** R Error in parse(outFile) : 5949:10: unexpected symbol 5948: c(01, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 5949: e0, 3f ^ ERROR: unable to collate and parse R files for package ‘foo’ Can anyone help explain what is happening here? This is the most generic and empty package I can think of, so not sure why a build is failing. Thanks! -- Noah Silverman UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 __ R-help@r-project.org 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] Failure building any package
Did you edit the description file and the namespace file and the Rd files? Although my tutorial is for windows if you follow steps 8 thru 10 on mac it should work http://stevemosher.wordpress.com/step-8-the-sample-package/ On Thu, May 17, 2012 at 7:44 PM, Noah Silverman noahsilver...@ucla.eduwrote: Hello, I'm attempting to build a package using R 2.15.0 on OS X I am getting a generic failure when performing a cran type check on the package. Even with a very simple test package, it still fails int he same place. Example: In R: rm(list=ls()) foo - function(x){print(x)} package.skeleton(name=foo) Then, at the command line: R CMD build foo R CMD check --as-cran foo_1.0.tar.gz Some output not included here * checking whether package foo can be installed ERROR Installation failed. See foo.Rcheck/00install.out for details. Looking at the 00install.out file, I see: * installing *source* package foo ... ** R Error in parse(outFile) : 5949:10: unexpected symbol 5948: c(01, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 5949: e0, 3f ^ ERROR: unable to collate and parse R files for package foo Can anyone help explain what is happening here? This is the most generic and empty package I can think of, so not sure why a build is failing. Thanks! -- Noah Silverman UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 __ R-help@r-project.org 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@r-project.org 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] Failure building any package
Hi Noah, Can you put your package on github or at least upload the tar ball? Although I agree with Steven that as is, the package will not pass cran checks, that is not the error I would expect. Some of the experts may have seen this before or know instantly, but for everyone else, being able to try what you are trying may help. Its also not a bad idea to have your code hosted somewhere anyway, so you can slice two beets with one stroke as it were. Cheers, Josh On Thu, May 17, 2012 at 7:44 PM, Noah Silverman noahsilver...@ucla.edu wrote: Hello, I'm attempting to build a package using R 2.15.0 on OS X I am getting a generic failure when performing a cran type check on the package. Even with a very simple test package, it still fails int he same place. Example: In R: rm(list=ls()) foo - function(x){print(x)} package.skeleton(name=foo) Then, at the command line: R CMD build foo R CMD check --as-cran foo_1.0.tar.gz Some output not included here * checking whether package ‘foo’ can be installed … ERROR Installation failed. See ‘foo.Rcheck/00install.out’ for details. Looking at the 00install.out file, I see: * installing *source* package ‘foo’ ... ** R Error in parse(outFile) : 5949:10: unexpected symbol 5948: c(01, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 5949: e0, 3f ^ ERROR: unable to collate and parse R files for package ‘foo’ Can anyone help explain what is happening here? This is the most generic and empty package I can think of, so not sure why a build is failing. Thanks! -- Noah Silverman UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 __ R-help@r-project.org 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. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org 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] Financial Statements Date Subsetting
Dear All, I'm new at R, but I really just need a couple of things. The first thing I need is to figure out how to get each individual financial statement (CF,BS,IS). I need each individual one because getting them all at once allows for formatting issues once it is a CSV. The date subsetting is what I need because I will be running a statistical model in excel. I know I could probably build a cleaner model in R, but I have already built it in excel. The first place I am stuck at is actually viewing the financials. I have gotten it to work a few times, but i am trying to script the installation sequence ( I still assume I have to load the packages as well - which I have done). I have tried this sequence downloading straight from the - i think - the CRAN mirror and I have also tried downloading this sequence straight from R-Project.com... install.packages(TTR) install.packages(zoo) install.packages(Defaults) install.packages(xts) install.packages(quantmod) this still (from both downloading sources) produces viewFin(GE.f, BS, Q) Error in viewFin(GE.f, BS, Q) : x must be of type financials Any help would be greatly appreciated - thank everyone so much! -- **Collateral Control Analyst II Banking Officer - BBT 200 East 2nd Street Winston Salem, NC brianedmunds...@gmail.com [[alternative HTML version deleted]] __ R-help@r-project.org 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] Correlation in Rattle
Hi, I recently installed Rattle for R 2.15.0 and all the functions work properly except for the Correlation button. After I choose the Correlation radio button in Explore tab, I click Execute, but nothing happens. No results at all. What is it that I am missing? Thank you, Avideh [[alternative HTML version deleted]] __ R-help@r-project.org 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] Correlation Matrix
thanks a lot dear. I will keep your advice in my mind. -- View this message in context: http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389p4630448.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Covariance matrix in R with non-numeric variables
Dear R help forum members, I am modeling a gaussian distribution for a computational biology application and I am working in the statistical package R. In this regard, my problem is that I have to construct a covariance matrix with variables (non-numeric) and the covariance matrix is to be used in an maximizers of the likelihood function to predict the variables in the matrix. I am unable to do that because I do not have an idea of how to construct a covariance matrix with non-numeric variable in the matrix. Any help in this regard will be highly appreciated. Thanks in advance. Regards, B.Nataraj [[alternative HTML version deleted]] __ R-help@r-project.org 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] Proc AutoReg (SAS like Output in R)
Hi, I want to find out, how can i get a SAS like output for Proc Autoreg with AR(1) and AR(2) terms. Thanks... -- View this message in context: http://r.789695.n4.nabble.com/Proc-AutoReg-SAS-like-Output-in-R-tp4630468.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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.