[R] Splines with more restrictions
I would like to generate a natural spline where the slope beyond the last knot (the right outer knot) is constrained to be 0. Is that available in some package around? _ Bendix Carstensen Senior Statistician Steno Diabetes Center Clinical Epidemiology Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark phone: +45 30 75 87 38 b...@steno.dk http://BendixCarstensen.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Computing plot size in Sweave
Sometimes you want to compute the physical size of a plot based on data. In R itself this is no problem. But is there a way to compute the values of height and width in S-weave, say: <>= where xx and yy are computed and not physically written in the document? Bendix __ Bendix Carstensen Senior Statistician Epidemiology Steno Diabetes Center A/S Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) b...@steno.dkhttp://BendixCarstensen.com www.steno.dk This e-mail (including any attachments) is intended for ...{{dropped:8}} __ 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] Code for a plot of a DNA double helix?
Does anyone have a piece of R-code that draws a nice picture of a (piece of a) DNA double helix? B.r. Bendix _ Bendix Carstensen Senior Statistician Epidemiology Steno Diabetes Center A/S Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) b...@steno.dkhttp://BendixCarstensen.com www.steno.dk __ 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] Sweave in 2.13.1
I run Windows XP. and in a command window I get: > c:\stat\r\R-2.13.1\bin\i386\Rcmd Sweave Lexis.rnw Error in length(arg) : 'arg' is missing Calls: Execution halted AND: > c:\stat\r\R-2.13.1\bin\i386\Rcmd Sweave --help Error in length(arg) : 'arg' is missing Calls: Execution halted BUT: > c:\stat\r\R-2.13.0\bin\i386\Rcmd Sweave --help Usage: R CMD Sweave file A simple front-end for Sweave Options: -h, --help print this help message and exit -v, --version print version info and exit Report bugs to . Same probelem for help on Stangle, but not for any other command. Is this a bug or some new facility I overlooked? Best regards, Bendix _ Bendix Carstensen Senior Statistician Steno Diabetes Center A/S Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) b...@steno.dkwww.biostat.ku.dk/~bxc www.steno.dk This e-mail (including any attachments) is intended for ...{{dropped:8}} __ 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.Date
We spotted that there were problems, and have realized that the as.Date.numeric was a left-over form earlier; it will be removed in the next version of the Epi package. Thanks for the help. br. Bendix > -Original Message- > From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] > Sent: 9. februar 2011 11:48 > To: Philipp Pagel > Cc: BXC (Bendix Carstensen); r-help@r-project.org > Subject: Re: [R] as.Date > > And I am hereby reporting this bug to the package maintainer. > > On Wed, 9 Feb 2011, Philipp Pagel wrote: > > > On Wed, Feb 09, 2011 at 08:44:30AM +0100, Valeri Fabio wrote: > >> Hello, > >> > >> I find out which package disturbs as.Date(). It is the package Epi: > >> > >>> as.Date(36525, origin="1900-01-01") > >> [1] "2000-01-02" > >>> library(Epi) > >>> as.Date(36525, origin="1900-01-01") > >> [1] "2070-01-01" > >>> detach("package:Epi") > >>> as.Date(36525, origin="1900-01-01") > >> [1] "2000-01-02" > > > > OK - that makes sense. Epi has its own as.Date.numeric function and > > upon loading the package you get a warning: > > > > > >> library(Epi) > > Attaching package: 'Epi' > > The following object(s) are masked from 'package:base': > >as.Date.numeric, merge.data.frame > > > > > > A quick look at the manual page confirms that Epi's version > does not > > have an origin option. > > > > cu > > Philipp > > > > -- > > Dr. Philipp Pagel > > Lehrstuhl für Genomorientierte Bioinformatik Technische Universität > > München Wissenschaftszentrum Weihenstephan Maximus-von-Imhof-Forum 3 > > 85354 Freising, Germany > > http://webclu.bio.wzw.tum.de/~pagel/ > > > > __ > > 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] Fishy error with NAMESPACE when checking package
I am updating the Epi package. I added functions named pc.points and pc.matpoints. Erroneously I wrote pc.plot and pc.matplot in the NAMESPACE file and of course got an error from Rcmd check. So I corrected the NAMESPACE file, but I still get from r-check: * install options are ' --no-html' Loading required package: utils Error in namespaceExport(ns, exports) : undefined exports: pc.plot, pc.matplot Error: package/namespace load failed for 'Epi' I cannot seem to find any occurrence of the strings "pc.plot" and "pc.matplot" anywhere in the entire package tree. Any idea of what goes on (and where to find the perpetrators)??? I use: _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 10.1 year 2009 month 12 day14 svn rev50720 language R version.string R version 2.10.1 (2009-12-14) Best regards, Bendix ___ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) b...@steno.dk http://www.biostat.ku.dk/~bxc www.steno.dk This e-mail (including any attachments) is intended for ...{{dropped:8}} __ 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] The TeX-source for the package manual.
I have noted that the later versions of Rcmd check cleans out the directory pkg.Rcheck so that only package-manual.log and package-manual.pdf are left. Formerly the package-manual.tex was around too --- very handy for various purposes. Is there a way to generate the .tex - version of the manual for a package? br. Bendix __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) b...@steno.dk http://www.biostat.ku.dk/~bxc www.steno.dk __ 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] The .tex version of the manual in foo.Rcheck
In version 2.8.1, running Rcmd check on the package foo would leave the file foo-manual.tex in the folder foo.Rcheck. But as of 2.9.0 only foo-manual.pdf and foo-manual.log are there. Is this intentional? Anyway it is inconvenient, because I would occasionally like to include the manual at the end of a set of exercises, and this was a convenient file to \input with a few select %'s added. br. Bendix ___ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) b...@steno.dk http://www.biostat.ku.dk/~bxc www.steno.dk This e-mail (including any attachments) is intended for ...{{dropped:8}} __ 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] WinBUGS with R
Artimon, It seems that you have got the data wrong: The data structure is a list of 4 characters: > list("y","X","n","m") [[1]] [1] "y" [[2]] [1] "X" [[3]] [1] "n" [[4]] [1] "m" And that is hardly what you want, presumably you meant list("y"=y,"X"=X,"n"=n,"m"=m) ?? __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc Uwe Ligges ligges at statistik.tu-dortmund.de Fri Aug 22 19:15:17 CEST 2008 artimon wrote: > Dear Users, > I am new to both of things, so do not blame me too much... > > I am busy with semiparametric regression and use WinBUGS to sample > posteriors. > The code to call Winbugs is as follows: > > data <- list("y","X","n","m") #My variables > inits.beta<- rep(0,K) > inits.beta0 <- 0 > inits <- > function(){list(beta=inits.beta,beta0=inits.beta0,taueps=1.0E-3)} > parameters<- list("sigma","beta","beta0","y.star") > fitm <- bugs(data,inits,parameters,model.file="model.bug", > n.chains=3, n.iter=n.iter, n.burnin=n.burnin, n.thin = > n.thin, > debug=FALSE,DIC=FALSE,digit=5,codaPkg=FALSE, > bugs.directory="C:/Program Files/WinBUGS14/") > > but I always get the following error: > Error in FUN(X[[1L]], ...) : > .C(..): 'type' must be "real" for this format > > > I tried the web, but failed. Could anyone give me a clue? > Best! > - Your example is not reproducible for us (without the data). - Is WinBUGS runnign correctly (see its output with debug=TRUE)? - What does traceback() tell us? Which versions of R, WinBUGS and R2WinBUGS are in use? Uwe Ligges __ 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] FW: Installing BRugs
A funny thing happened when I wanted a student of mine to install Brugs. Using the InstallPackages in the windows version, firts gives an erro, but trying again works flawlessly. R version is 2.7.0 on WinXP. Any explanation? Bendix Carstensen __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc -Original Message- From: ACJS (Anders Christian Jensen) Sent: 29. juli 2008 11:06 To: BXC (Bendix Carstensen) Subject: > utils:::menuInstallPkgs() trying URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.7/BRugs_0.4-2.zip' Content type 'application/zip' length 3399130 bytes (3.2 Mb) opened URL downloaded 3.1 Mb Error in gzfile(file, "r") : cannot open the connection In addition: Warning messages: 1: In download.file(url, destfile, method, mode = "wb", ...) : downloaded length 3293996 != reported length 3399130 2: In zip.unpack(pkg, tmpDir) : error 1 in extracting from zip file 3: In gzfile(file, "r") : cannot open compressed file 'BRugs/DESCRIPTION', probable reason 'No such file or directory' > utils:::menuInstallPkgs() trying URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.7/BRugs_0.4-2.zip' Content type 'application/zip' length 3399130 bytes (3.2 Mb) opened URL downloaded 3.2 Mb package 'BRugs' successfully unpacked and MD5 sums checked The downloaded packages are in c:\temp\RtmpKoBifa\downloaded_packages updating HTML package descriptions > ___ Anders Christian Jensen Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 444 22475 (direct) [EMAIL PROTECTED] This e-mail (including any attachments) is intended for ...{{dropped:8}} __ 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] competing risk model with time dependent covariates under R or Splus
This message was also sent to the MEDSTATS mailing list, so here is the reply I posted to that: Philippe, The machinery to use is to split follow-up time so finely that you can safely assume that rates are constant in each interval, and then just stuff it all into a Poisson model. This allows you to use any kind of time-dependent variables as well as accommodating competing risks. In the Epi package (http://staff.pubhealth.ku.dk/~bxc/Epi/) on CRAN there is a machinery for representation and manipulation of multistate data (of which competing risks are a special case), see the function Lexis(). It also has a time-splitting function there, splitLexis(). If you take a look at practical 14 from this year's SPE course: http://staff.pubhealth.ku.dk/~bxc/SPE/2008/pracs.pdf there is an example that addresses the problem you are having, practical no. 14. If go to the folder http://staff.pubhealth.ku.dk/~bxc/SPE/2008/R you will find the R-code that runs the solution to the practical. The data used is a part of the Epi-package, so you just have to load the Epi package first. It is however not using the Fine/Gray approach, but is directly modelling the cause-specific rates taking time dependent covariates into account. Best regards, Bendix __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of pguardio > Sent: 26. juli 2008 22:47 > To: MedStats > Subject: {MEDSTATS} competing risk model with time dependent > covariates under R or Splus > > > > Dear members, > > is there a way to perform a competing risk model which can > handle time dependent covariates under either R ou SPlus ? > > my main covariate (additional treatment to patients) violates > the proportional hazards assumption, its effect being > observed after one year of the main treatment, not before > (this is expected / makes sense on a clinical point of view). > So I was planning to use a time dependent Cox model with 2 > time intervals for patients: < > 1 year etc... > > However, I need to use a competing risk model because a large > number of patients dies from early toxicity from main > treatment (not related to the additional treatment I m > evaluating the effect) or from events unrelated to the > disease or the treatments (elderly patients). > Therefore, to analyze the effect of my covariate of interest > on disease free survival and relapse incidence, I d like to > use a competing risk model such as the Gray CMPRSK. > > However, I cannot have multiple "lines" for the same patient > (cluster function is not allowed in CMPRSK) with this package > (for time dep covariates I need 1 or 2 lines with same Id /UPN). > > Does anyone knows how can I manage this in CMPRSK ? > > Any help will be greatly appreciated > Thanks > Yours sincerely > > Philippe Guardiola > __ 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] Figure environment and includegraphics options from Sweave
Thanks a lot yuor advice works, here is an actually working example of an .rnw file, where the graphs are stuffed in a subfolder: \documentclass{article} \begin{document} \SweaveOpts{include=FALSE} This is an experiment with two plots. Here is the first: <>= x<-seq(-2*pi, 2*pi, .1) plot(x, sin(x), type="l", lwd=4) @ And here is the second: <>= x<-seq(-2*pi, 2*pi, .1) plot(x, cos(x), type="l", lwd=4) @ The result should be two graphs side by side: \begin{figure}[h] \centering \includegraphics[width=0.27\textwidth]{./graph/xx-CHUNK1} \hfill \includegraphics[width=0.63\textwidth]{./graph/xx-TJUNK2} \caption{\it Here is the caption.} \label{fig:Tschunks1und2} \end{figure} \end{document} > -Original Message- > From: Charilaos Skiadas [mailto:[EMAIL PROTECTED] > Sent: 18. maj 2008 17:08 > To: BXC (Bendix Carstensen) > Cc: r-help@r-project.org > Subject: Re: [R] Figure environment and includegraphics > options from Sweave > > > On May 18, 2008, at 10:41 AM, BXC (Bendix Carstensen) wrote: > > > Tha handy thinb about the fig=TRUE option in Sweave is that > you do not > > have to bother about filenames and starting and stpping the device. > > > > I want the the resulting LaTeX to look as: > > > > \begin{Schunk} > > \begin{Sinput} > >> x <- seq(-2 * pi, 2 * pi, 0.1) > >> plot(x, cos(x), type = "l", lwd = 4) > > \end{Sinput} > > \end{Schunk} > > > > > \begin{figure} > > \includegraphics[width=0.6\textwidth]{xx-001} > > \end{figure} > > > > > i.e. with options to the \includegraphics and all embedded > in a figure > > environment. > > > > 1) > > Is there a way to do this without writing the figure environment > > manually? > > The Sweave manual (section 4.1.2 in my version) suggests > using something like this before the figure call: > > \setkeys{Gin}{width=0.6\textwidth} > > This sets the size globally. Not perfect, but it's what I've > been doing. > I would myself like the ability to add optional arguments to > the produced \includegraphics call, but perhaps there is a > good reason why this hasn't been implemented (other than that > the developer might not have thought it useful/necessary, > which is in itself a perfectly good reason why this feature > is not there). > > > 2) > > If not, is there a way to get the generated filename of the > plot, or > > to explicitly give it in the .rnw file? The point of course > being to > > avoid to start and stop the graphics driver explicitly? > > I haven't tried it, but perhaps if you have a named figure > code chunk, this name is used for the file name? > > > Best, > > Bendix Carstensen > > __ > > > > Bendix Carstensen > > Senior Statistician > > Steno Diabetes Center > > Niels Steensens Vej 2-4 > > DK-2820 Gentofte > > Denmark > > +45 44 43 87 38 (direct) > > +45 30 75 87 38 (mobile) > > [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc > > Haris Skiadas > Department of Mathematics and Computer Science Hanover College > > > > > __ 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] Figure environment and includegraphics options from Sweave
Tha handy thinb about the fig=TRUE option in Sweave is that you do not have to bother about filenames and starting and stpping the device. I want the the resulting LaTeX to look as: \begin{Schunk} \begin{Sinput} > x <- seq(-2 * pi, 2 * pi, 0.1) > plot(x, cos(x), type = "l", lwd = 4) \end{Sinput} \end{Schunk} \begin{figure} \includegraphics[width=0.6\textwidth]{xx-001} \end{figure} i.e. with options to the \includegraphics and all embedded in a figure environment. 1) Is there a way to do this without writing the figure environment manually? 2) If not, is there a way to get the generated filename of the plot, or to explicitly give it in the .rnw file? The point of course being to avoid to start and stop the graphics driver explicitly? Best, Bendix Carstensen __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc This e-mail (including any attachments) is intended for ...{{dropped:8}} __ 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] Course: STATISTICAL PRACTICE IN EPIDEMIOLOGY USING R
Course in STATISTICAL PRACTICE IN EPIDEMIOLOGY USING R Tartu, Estonia, Wednesday 28 May to Monday 2 June 2008. Aimed at young statisticians and epidemiologists wishing to broaden their epidemiological skills, in particular with respect to practical statistical analysis. Participants will gain access to the versatile analysis tool R which has good analytical in particular graphical capabilities. The Epi-package for R will be extensively used. Participants are required to have a fairly good understanding of statistical principles and some familiarity with epidemiological concepts. The course will be mainly practically oriented with more than half the time at the computer. Price: Commercial: 1000 EUR, Academic: 750 EUR / 500 EUR. The 750 EUR are for particpants from the EU pre-2004, North America and the like. 500 for particants from other countries. Application deadline: 15 April 2004. Send an application by mail to the organizers, briefly stating your qualifications in epidemiology and statistics and a brief reason to participate: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Further information at the course homepage: www.biostat.ku.dk/~bxc/SPE -- Krista Fischer, University of Tartu, Estonia Esa Läärä, University of Oulu, Finland Bendix Carstensen, Steno Diabetes Center, Denmark (Organizers) __ 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 Epi package out (1.0.7)
A new major upgrade of the Epi package for Epidemiological data analysis has been put on CRAN, it is now at version 1.0.7. It contains an entirely new way of representing follow-up data on multiple timescales and multiple states. See the function Lexis(). Plus a lot of other useful stuff for epidemiological analysis. See more on the package homepage, www.biostat.ku.dk/~bxc/Epi Note also that there will be a course 28 May - 2 June in Estonia, see www.biostat.ku.dk/~bxc/SPE. Bendix Carstensen Epi package maintainer __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc ___ R-packages mailing list [EMAIL PROTECTED] 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.