[R] How can i add a color bar with base package
Hi, I'm trying to find this for 3 hours now so i come here to find any help. How can I add a color bar to show the color scales to what is generated by image(), similar to the one in figures generated by filled.contour() using only the base package although i know there is solution with contributed package. it's sounds very easy but i can't get it! :-( thanks by advance. --- Yves Magliulo RD Engineer CLIMPACT : www.climpact.com tel : 01 44 27 34 31 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Justifying R to anti open-source management
hi, * http://www.r-project.org/ R-home * http://www.itp.phys.ethz.ch/econophysics/R/index.html R-financial * http://wiki.r-project.org/rwiki/doku.php#r_wiki_-_overview R-overview * http://addictedtor.free.fr/graphiques/index.php R-graphics should give you a piece of advice with all the links related. Best, Yves Le mer 17/05/2006 à 16:39, Patrick Burns a écrit : Not precisely what you are looking for, but perhaps http://www.burns-stat.com/pages/Tutor/R_relative_statpack.pdf can help. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Peter Baker (CMIS, St Lucia) wrote: Hi I apologise for this question as it really must be a FAQ. Unfortunately, I can't find the answer and I'm tired of looking at endless google results A colleague of mine works for a state government department that has a policy against open source software or software tainted by open source. Other government departments in the same state use R but this particular department is driven by very non-numerate people and superficially at least it appears somewhat backward IT-wise. The department may purchase SPlus (which may be better for non programmer types anyway) or SPSS but it would nice to have the option to use R The Q: Are there any documents/reports/papers out there justifying R that comment on - quality of R - huge range of libraries available - support (via a huge and enthusiastic user base - any ideas on how many people use R) I suspect that providing existing documents would carry more weight rather than writing a case from scratch or providing people's email opinions Thanks in advance! Cheers Peter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Fitting model with varying number of predictors
try : my_formula = as.formula(paste(y~,xxx)) lm(my_formula) note that you can play with substr in paste to change your formula paste(y~,substr(xxx,1,5)) [1] y~ x1+x2 paste(y~,substr(xxx,4,8)) [1] y~ x2+x3 furthermore, with 10 predictors x1 x2 ...x10 for instence, you can create 2 array of indice where to start and end the substr and do it in a loop for multi fit... best, yves On 11/18/05, Juni Joshi [EMAIL PROTECTED] wrote: I need to fit a number of models with different number of predictors in each model. Say for example, I have three predictors: x1, x2, x3 and I want to fit three models: lm(y~x1+x2) lm(y~x2+x3) lm(y~x1+x2+x3) Instead of typing all models, what I want is to create a variable which can take the right hand side of the models. I tried this with paste function. xxx - paste(x1,x2,sep=+) for the first xxx - paste(x2,x3, sep = +) for the second xxx - paste(x1,x2,x2, sep = +) for the third and then fit a single model lm(y~xxx) It did not work. Please suggest how to do it. Thanks. Jun __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] adding sequence for each value in a vector
hi, i have a vector like : x-c(1,15,30,45,60,90,115) i know that step by step i have always more than 10 min(diff(x)) =11 i want to add for each value a sequence of value:value+9 result should be : 1 2 3 4 5 6 7 8 9 10 15 16 17 18 19 20 21 22 23 24 30 31 (...) 39 45 46 (...) 54 60 61 etc.. how can i do this without a loop (i'm sure there is a elegant way like always with R but i can't find it this time!) best, yves [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problème d'import de fichier
hello!! si tu veux plus de réponse, you should speak in english here. mais ok je vais essayer de te répondre vu ton erreur, tu devrais regarder la ligne 15 qui doit ne pas avoir le même nombre de séparateur que tes autres lignes. de façon générale, quand tu utilises read.table, assure toi que, dans ton poussins.txt, tu as le même nombre de séparateur à chaque ligne et préfères un séparateur plus visible comme ou ; see ?read.table et lie attentivement la page d'aide read.table permet d'importer un data.frame possédant n ligne et m colonnes : il ne peut y avoir de ligne ou de colonne de taille différente! donc attention à ne pas laisser des retours chariots à la fin de ton fichier , et assure toi du format initiale n x m sinon, préfère ?scan best, cordialement Yves Le jeu 20/10/2005 à 15:00, Maïa Berman a écrit : hello! je veux importer un fichier de donnees excel que j'ai au prealable converti en fichier txt avec separateurs tab, fichier de la forme entree simple (suite de colonnes contenant des variables). Voila ma ligne de commande : poussins - read.table(poussins.txt, header=T, sep=\t) et sa reponse Erreur dans scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : la ligne 15 n'avait pas 14 éléments De plus : Message d'avis : readTableHeader a trouvé une ligne finale incomplète dans 'poussins.txt' A l'aide merci [[alternative HTML version deleted]] __ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] x axis
hi, first shut down automatic axis in plot with plot( ...,axes=F) then customize your axis with ?axis axis(side, at = NULL, labels = TRUE, tick = TRUE, line = NA, pos = NA, outer = FALSE, font = NA, vfont = NULL, lty = solid, lwd = 1, col = NULL, padj = NA, ...) you can specify what ever you want in your case : side=1 for x axis at=c(0,6,12,18,24) labels=c(0,6,12,18,24) other way to do this with ?par : see parameters xaxp, xaxs, xaxt best, yves. Le lun 17/10/2005 à 16:17, Michela Ballardini a écrit : Hello, I write to know how can I modify the x axis : when I plot a survival object, R plots a graph with x values = 0, 10, 20, 30 while I want a graph with values 0, 6, 12, 18, 24 in the x axis. How can I do this? In R 2.1.1 version there was time.inc in survplot, but in version R 2.2.0 there isn't it! I am sorry for my english and I hope that you understand my problem. Thank you Mic [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Le ven 14/10/2005 à 00:39, Benedict P. Barszcz a écrit : Dnia piÄ tek, 14 października 2005 00:13, Sundar Dorai-Raj napisaÅ: Don't you mean system(ls)? See ?system. Arguments: command: the system command to be invoked, as a string. This is the kind of obstacles a newbie has to overcome. Whoeve is writing the documentation for R, please do not attempt to save on bytes. Life would be so much more pleasureable if only it would say as a quoted string. Jee. obviously, you're a newbie in informatic. In most of informatic language, you use quoted string to distinguish it from variable of your environnement. if not quoted, string is interpreted like a variable and you must declared your variable previously, otherwise, you have a message error... like you had. best. Yves [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] p-level in packages mgcv and gam
hi, thanks for reply. 1) sorry for the mistake, (GCV and UBRE estimate df in both case in deed) i've made a confusion. 2) i use mgcv 1.1-8. (!) so in deed again, i need an update. my questions : 3) i can see in the last version of summary.gam an estimated rank: how do i interpret this? 4) I'm still confusing with this question : should i look at R-sq rather than Deviance explain, or both? 5) How can i estimate numericaly the contribution of each smooth against the others. In others words, is there a way to quantify significance like a percentage of how the model is improved by each of my smooth? 6) mgcv : gam and gam : gam can't be compared. that's 2 distinct approach of gam, isn't it? for Denis : 7) to validate the significance of a smooth where p-values is betwwen 0.01 and 0.05, there is no perfect rules... you have to decide according to your need. look at df, the se of your smooth, how your model is improved, if the parametrization look fine according of what you want/know of your predictor etc... but that's my point of view, maybe someone have Criterion more precise. Yves Le jeu 29/09/2005 à 09:55, Henric Nilsson a écrit : Yves Magliulo said the following on 2005-09-28 17:05: hi, i'll try to help you, i send a mail about this subject last week... and i did not have any response... I'm using gam from package mgcv. 1) How to interpret the significance of smooth terms is hard for me to understand perfectly : using UBRE, you fix df. p-value are estimated by chi-sq distribution using GCV, the best df are estimated by GAM. (that's what i want) and p-values This is not correct. The df are (i.e. UBRE and GCV), but the scale parameter is fixed in the UBRE case. Hence, by default UBRE is used fsignificance of smooth termsor family = binomial or poisson since the scale parameter is assumed to be 1. Similarly, GCV is the default for family = gaussian since we most often want the scale (usually denoted sigma^2) to be estimated. are estimated by an F distribution But in that case they said use at your own risk in ?summary.gam The warning applies in both cases. The p-values are conditional on the smoothing parameters, and the uncertainty of the smooths is not taken into account when computing the p-values. so you can also look at the chi.sq : but i don't know how to choose a No... criterion like for p-values... for me, chi.sq show the best predictor in a model, but it's hard to reject one with it. Which version of mgcv do you use? The confusion probably stems from earlier versions of mgcv ( 1.3-5): the summary and anova methods used to have a column denoted Chi.sq even when the displayed statistic was computed as F. Recent versions of mgcv has summary(b) Family: gaussian Link function: identity Formula: y ~ s(x0) + s(x1) + s(x2) + s(x3) Parametric coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 7.9150 0.1049 75.44 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Approximate significance of smooth terms: edf Est.rank F p-value s(x0) 5.1739.000 3.785 0.000137 *** s(x1) 2.3579.000 34.631 2e-16 *** s(x2) 8.5179.000 84.694 2e-16 *** s(x3) 1.0001.000 0.444 0.505797 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 R-sq.(adj) = 0.726 Deviance explained = 73.7% GCV score = 4.611 Scale est. = 4.4029n = 400 If we assume that the scale is known and fixed at 4.4029, we get summary(b, dispersion = 4.4029) Family: gaussian Link function: identity Formula: y ~ s(x0) + s(x1) + s(x2) + s(x3) Parametric coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 7.9150 0.1049 75.44 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Approximate significance of smooth terms: edf Est.rank Chi.sq p-value s(x0) 5.1739.000 34.067 8.7e-05 *** s(x1) 2.3579.000 311.679 2e-16 *** s(x2) 8.5179.000 762.255 2e-16 *** s(x3) 1.0001.000 0.444 0.505 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 R-sq.(adj) = 0.726 Deviance explained = 73.7% GCV score = 4.611 Scale est. = 4.4029n = 400 Note that t/F changed into z/Chi.sq. so as far as i m concerned, i use GCV methods, and fix a 5% on the null hypothesis (pvalue) to select significant predictor. after, i look at my smooth, and if the parametrization look fine to me, i validate. generaly, for p-values smaller than 0.001, you can be confident. over 0.001, you have to check. 2) for difference between package gam and mgcv, i sent a mail about this The underlying algorithms are very different. HTH, Henric one year ago, here's the response : - package gam is based very closely on the GAM approach presented in Hastie and Tibshirani's Generalized
[R] Smooth terms significance in GAM models
hi, i'm using gam() function from package mgcv with default option (edf estimated by GCV). G=gam(y ~ s(x0, k = 5) + s(x1) + s(x2, k = 3)) SG=summary(G) Formula: y ~ +s(x0, k = 5) + s(x1) + s(x2, k = 3) Parametric coefficients: Estimate std. err.t ratioPr(|t|) (Intercept) 3.462e+07 1.965e+05 176.2 2.22e-16 Approximate significance of smooth terms: edf chi.sq p-value s(x0) 2.858 70.629 1.3129e-07 s(x1) 8.922 390.39 2.6545e-13 s(x2) 1.571141.6 1.8150e-11 R-sq.(adj) = 0.955 Deviance explained = 97% GCV score = 2.4081e+12 Scale est. = 1.5441e+12 n = 40 -- I know i can estimate the significance of smooth terms with chi.sq p.value. With GCV, p-value are obtained by comparing the statistic to an F distribution,isn't it? help(summary.gam) says use at your own risk!.Does it mean i should only estimated signifiance of smooth terms by chi.sq?.Is there a way to link both information (p.value and chi.sq)? I have read an article where chi.sq was interpreted like residual deviance (reduction in deviance by each smooth). Can i do something like that in my case? How can i estimate numericaly the contribution of each smooth against the others. In others words, is there a way to quantify this significance like a percentage of how the model is improved by each of my smooth? Last question, using GAM with default, should i look at R-sq rather than Deviance explain, or both? I hope it's ~ clear thanks. Yves [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Estimate predictor contribution in GAM models
hi, i'm using gam() function from package mgcv. if G is my gam object, then SG=summary(G) Formula: y ~ +s(x0, k = 5) + s(x1) + s(x2, k = 3) Parametric coefficients: Estimate std. err.t ratioPr(|t|) (Intercept) 3.462e+07 1.965e+05 176.2 2.22e-16 Approximate significance of smooth terms: edf chi.sq p-value s(x0) 2.858 70.629 1.3129e-07 s(x1) 8.922 390.39 2.6545e-13 s(x2) 1.571141.6 1.8150e-11 R-sq.(adj) = 0.955 Deviance explained = 97% GCV score = 2.4081e+12 Scale est. = 1.5441e+12 n = 40 -- I know i can estimate the significance of smooth terms with chi.sq p.value. In this example, i now that s(x1) is the most significant follow by s(x2) and s(x0). also, i know the 3 give a good contribution in my model and i have a very good model (dev expl = 97%) = But how can i estimate numericaly the contribution of each smooth against the others. In others words, is there a way to quantify this significance like a percentage of how the model is improved by each of my predictors? I hope it's ~ clear (i'm french!) thanks. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to change x axes' range
matplot(.., axes=FALSE) then custozie by yourself ayour axes -axis(1,at=1:4,label=c(11 Vars,10 Vars,6Vars,4Vars)) ?axis and see label option for more details HTH, Yves MAGLIULO, PARIS Le mer 08/12/2004 à 11:36, Qin Liu a écrit : Hi, there: When plot ann predicted results I need to indicate numbers of inputs for each column. V1 V2 V3 V4 1 86.2700 49.9380 30.7630 0.1327 2 89.5127 55.9707 33.7683 0.1186 3 91.1833 58.4670 34.5610 0.1134 matplot(t, pch = 1:4, type = o, col = rainbow(ncol(t)),xlab = No. of inputs , ylab = Mean of 6 Datasets, main = xxx) Instead of have typical x axes' range as 1, 2, 3, and 4 for each column, I need to indicate 11 Vars, 10 Vars, 6Vars, and 4Vars or A, B, C, and D Does anybody know anything about it? I appreciate if you could help me out. Thank you very much indeed. Qin __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] install bug with specific JPEG library by exporting CPPFLAGS variable
Hi there, I think I have found a small problem in the /my/path/R-2.0.1/src/modules/X11/MakeFile generation. During the configure step, I have specified a specific JPEG library by exporting CPPFLAGS variable. All compilation works well for individual files in the src/modules/X11/ directory, but when linking, the -ljpeg option doesn't work. I obtain the following message (in french sorry): -- make[4]: Entre dans le repertoire `/mnt/softs/R/R-2.0.1/src/modules/X11' gcc -shared -L/usr/local/lib -o R_X11.so dataentry.lo devX11.lo rotated.lo rbitmap.lo -lSM -lICE -L/usr/X11R6/lib -lX11 -ljpeg -lpng -lz -lreadline -ldl -lncurses -lm /usr/bin/ld: ne peut trouver -ljpeg collect2: ld a retourne 1 code d'?tat d'ex?cution make[4]: *** [R_X11.so] Erreur 1 make[4]: Quitte le repertoire `/mnt/softs/R/R-2.0.1/src/modules/X11' make[3]: *** [R] Erreur 2 make[3]: Quitte le repertoire `/mnt/softs/R/R-2.0.1/src/modules/X11' make[2]: *** [R] Erreur 1 make[2]: Quitte le repertoire `/mnt/softs/R/R-2.0.1/src/modules' make[1]: *** [R] Erreur 1 make[1]: Quitte le repertoire `/mnt/softs/R/R-2.0.1/src' make: *** [R] Erreur 1 -- This means that the -L/my/jpeg/library/path option is not added for linking. I re-runned the linking command with my option : gcc -shared -L/usr/local/lib -o R_X11.so dataentry.lo devX11.lo rotated.lo rbitmap.lo -lSM -lICE -L/usr/X11R6/lib -lX11 -L/my/jpeg/library/path -ljpeg -lpng -lz -lreadline -ldl -lncurses -lm and the launched the make command again and it worked fine. Hope it helps. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Gam() function in R
hi all, this subject is very intersting for me. I'm using mgcv 0.8-9 with R version 1.7.1. i didn't know that there was an another gam version with package library(gam). Someone can tell me the basics differences between them? I look for an help page on google but i only find mgcv help pages. thanks! yves magliulo, Paris. Le lun 06/12/2004 à 09:09, Jari Oksanen a écrit : On 6 Dec 2004, at 7:36, Janice Tse wrote: Thanks for the email. I will check that out However when I was doing this :gam(y~s(x1)+s(x2,3), family=gaussian, data=mydata )it gives me the error : Error in terms.formula(formula, data = data) : invalid model formula in ExtractVars What does it mean ? When Any Liaw answered you (below), he asked you to specify which kind of 'gam' did you use: the one in standard package 'mgcv' or the one in package 'gam'. We should know this to know what does it mean to get your error message. If you used mgcv:::gam, it means that you didn't read it help pages which say that you should specify your model as: gam(y ~ s(x1) + s(x2, k=3)) Further, it may be useful to read the help pages to understand what it means to specify k=3 and how it may influence your model. Simon Wood -- the mgcv author -- also has a very useful article in the R Newsletter: see the CRAN archive. It may be really difficult to understand what you do when you do mgcv:::gam unless you read this paper (it is possible, but hard). Simon's article specifically answers to your first question of deciding the smoothness, and explains how elegantly this is done in mgcv:::gam (gam:::gam has another set of tools and philosophy). If you happened to use gam:::gam, then you have to look at another explanation. cheers, jari oksanen From: Liaw, Andy [mailto:[EMAIL PROTECTED] Sent: Sunday, December 05, 2004 11:34 PM To: 'Janice Tse'; [EMAIL PROTECTED] Subject: RE: [R] Gam() function in R Unfortunately that's not really an R question. I recommend that you read up on the statistical methods underneath. One that I'd wholeheartedly recommend is Prof. Harrell's `Regression Modeling Strategies'. [BTW, there are now two implementations of gam() in R: one in `mgcv', which is fairly different from that in `gam'. I'm guessing you're referring to the one in `gam', but please remember to state which contributed package you're using, along with version of R and OS.] Cheers, Andy From: Janice Tse Hi all, I'm a new user of R gam() function. I am wondering how do we decide on the smooth function to use? The general form is gam(y~s(x1,df=i)+s(x2,df=j)...) , how do we decide on the degree freedom to use for each smoother, and if we shold apply smoother to each attribute? Thanks!! __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html --- - -- Notice: This e-mail message, together with any attachments,...{{dropped}} __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jari Oksanen, Oulu, Finland __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Gam() function in R
so mgcv package is the one i need! indeed, i want integrated smoothness selection and smooth interactions rather than stepwise selection. i have a lot of predictor, and i use gam to select those who are efficient and exclude others. (using p-value) thanks a lot for those precious information. Le lun 06/12/2004 à 12:41, Simon Wood a écrit : this subject is very intersting for me. I'm using mgcv 0.8-9 with R version 1.7.1. i didn't know that there was an another gam version with package library(gam). Someone can tell me the basics differences between them? I look for an help page on google but i only find mgcv help pages. - I think you'd need to move to a newer version of R in order to use package gam, but that would also let you use a much more recent version of package mgcv. - package gam is based very closely on the GAM approach presented in Hastie and Tibshirani's Generalized Additive Models book. Estimation is by back-fitting and model selection is based on step-wise regression methods based on approximate distributional results. A particular strength of this approach is that local regression smoothers (`lo()' terms) can be included in GAM models. - gam in package mgcv represents GAMs using penalized regression splines. Estimation is by direct penalized likelihood maximization with integrated smoothness estimation via GCV or related criteria (there is also an alternative `gamm' function based on a mixed model approach). Strengths of the this approach are that s() terms can be functions of more than one variable and that tensor product smooths are available via te() terms - these are useful when different degrees of smoothness are appropriate relative to different arguments of a smooth. Here's an attempt at a summary of the differences: Estimation: gam::gam based on backfitting, mgcv::gam based on direct penalized likelihood maximization (with smoothness estimation integrated) Model selection: package(gam) based on stepwise regression methods. mgcv::gam based on integrated GCV estimation of degree of smoothness. Smooth terms: gam::gam can represent smooth terms using a very wide range of scatterplot smoothers incuding loess, which is built in. mgcv::gam is restricted to smoothers that can be represented using basis functions and an associated ``wiggliness'' penalty, but these include low rank thin plate spline smoothers and tensor product smoothers for smooths of more than one variable. Both packages provide interfaces for adding new classes of smoother. Uncertainty estimation: since mgcv GAMs explicitly estimate coefficients for each smooth term, it is fairly straightforward to obtain a covariance matrix for the model coefficients, which makes further variance calcualtions easy. For example predictions with standard errors are easily obtained for predictions made with new prediction data. The backfitting approach makes variance calculation more difficult (e.g. at present s.e.s are not available from gam::predict.gam with new data) Interface: both packages are based on Trevor Hastie's Chapter 7 of Chambers and Hastie. Since Trevor H. wrote package(gam) it's a closer implementation than package(mgcv). Basically, if you want integrated smoothness selection, an underlying parametric representation, or want smooth interactions in your models then mgcv is probably worth a try (but I would say that). If you want to use local regression smoothers and/or prefer the stepwise selection approach then package gam is for you. Simon _ Simon Wood [EMAIL PROTECTED]www.stats.gla.ac.uk/~simon/ Department of Statistics, University of Glasgow, Glasgow, G12 8QQ Direct telephone: (0)141 330 4530 Fax: (0)141 330 4814 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help! a urgent question
hi, you can download The R Reference Index contains all help files of the R standard and recommended packages in printable form at http://cran.r-project.org/doc/manuals/fullrefman.pdf you will find other Manuals at http://www.r-project.org/ have a nice week-end all. -- Yves Magliulo [EMAIL PROTECTED] RD Engineer, CLIMPACT Tel. : +33 (0) 1 44 27 34 31 Fax. : +33 (0) 1 44 27 49 96 Universite Pierre et Marie Curie Boite 101 - Tour 45 - 5eme etage - Couloir 45/46 4 place Jussieu, 75252 Paris CEDEX 05, France Le ven 19/11/2004 à 16:55, an ying a écrit : Dear Sir/Madam, I am doing a project related to R. However, it is always difficult find some R functions. The R user guide seems not complete. Is there any free document about all R functions ? Who knows ? please help me. My email is [EMAIL PROTECTED] Thank you very much - Meet the all-new My Yahoo! Try it today! [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Combining columns of different length
hi, something like : toto is your data.frame toto= V1 V2 3 2 4 2 5 8 and tata= 3 3 so to do what you want make cbind(toto,c(tata,rep(NA,len=(length(toto$V1)-length(tata) maybe there is a easier way but it's work! -- -- Yves Magliulo [EMAIL PROTECTED] RD Engineer, CLIMPACT Tel. : +33 (0) 1 44 27 34 31 Fax. : +33 (0) 1 44 27 49 96 Universite Pierre et Marie Curie Boite 101 - Tour 45 - 5eme etage - Couloir 45/46 4 place Jussieu, 75252 Paris CEDEX 05, France Le mar 26/10/2004 à 15:46, Federico Gherardini a écrit : Hi all, Simple and direct question Is it possible to add a shorter column to a data frame or matrix in such a way that the missing values are replaced with NAs? For example suppose I have 3 2 4 2 5 8 and I want to add a column 3 3 to get... 3 2 3 4 2 3 5 8 NA Thanks Federico __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A question in R
hi, check R-data import/export document at this link cran.r-project.org/doc/manuals/R-data.pdf let me give you an advice for further questions : it's easiest to find answer to your question searching directly with google -- -- Yves Magliulo [EMAIL PROTECTED] RD Engineer, CLIMPACT Tel. : +33 (0) 1 44 27 34 31 Fax. : +33 (0) 1 44 27 49 96 Universite Pierre et Marie Curie Boite 101 - Tour 45 - 5eme etage - Couloir 45/46 4 place Jussieu, 75252 Paris CEDEX 05, France Le mar 12/10/2004 à 17:56, Kevin Bartz a écrit : Yayira har wrote: I started to learn the R language, but I didn't suceed to use an external file. Let say that I have an excel file called test1.xls in the directory C:/program files/R/rw2000/external_files that looks like that: name mark yair 80 yosi 70 ... In the appropriate directory I wrote this: x-read.delim(test1.xls) or this: x-read.csv(test1.xls) but I got: [1] X.. 0 rows (or 0-length row.names) way cannot I read the file? what is the appropriate command for reading an excel file? I looked at the site of R-project but I didn't find a suitable comand. __ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Hi Yayiya, R looks less than fondly on Excel files. The easiest solution for you will be to export your Excel file to a tab-delimited text format (Save - (.txt) Tab-delimited Text), and then use read.delim as you did. Does that make sense? Kevin __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Warning: number of items to replace is not a multiple of replacement length
hi, that means you're doing operation whith matrix or dataframe with row or column with different length. this can be a real reason to care about and sometimes it could be an error and not only a warning. you'd better adjust the length of your vector (array) to be the same in order to avoid this warning and be sure you're doing excatly what you want. here's a sample of what i meant. toto=matrix(0,5,5) toto [,1] [,2] [,3] [,4] [,5] [1,]00000 [2,]00000 [3,]00000 [4,]00000 [5,]00000 tata=c(1,2,3) toto[,1]=tata Error in [-(*tmp*, , 1, value = tata) : number of items to replace is not a multiple of replacement length here's the correct syntax toto[1:length(tata)]=tata Le mer 29/09/2004 à 15:03, Mag. Ferri Leberl a écrit : What does this warning mean precisely? Is there any reason to care about it? Can I Avoid it by another way of programming? Thank you in advance. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Yves Magliulo [EMAIL PROTECTED] RD Engineer, CLIMPACT Tel. : +33 (0) 1 44 27 34 31 Fax. : +33 (0) 1 44 27 49 96 Universite Pierre et Marie Curie Boite 101 - Tour 45 - 5eme etage - Couloir 45/46 4 place Jussieu, 75252 Paris CEDEX 05, France __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problems with png()
hi, here some alternative solution. 1-use postscript function then convert it in png in shell with convert command (higher resolution) 2-use dev2bitmap(file, type = png256) many other type available ?dev2bitmap for more info -- -- Yves Magliulo [EMAIL PROTECTED] RD Engineer, CLIMPACT Tel. : +33 (0) 1 44 27 34 31 Fax. : +33 (0) 1 44 27 49 96 Universite Pierre et Marie Curie Boite 101 - Tour 45 - 5eme etage - Couloir 45/46 4 place Jussieu, 75252 Paris CEDEX 05, France Le lun 06/09/2004 à 14:58, Laura Quinn a écrit : A windows machine?? If you could suggest where I might get my hands on one... AFAIK I'm running the code interactively. Laura Quinn Institute of Atmospheric Science School of the Environment University of Leeds Leeds LS2 9JT tel: +44 113 343 1596 fax: +44 113 343 6716 mail: [EMAIL PROTECTED] On Mon, 6 Sep 2004, Adaikalavan Ramasamy wrote: Try running the codes on a windows machine just to rule out any code-related errors. Also are you running the codes interactively or in the background ? Regards, Adai On Mon, 2004-09-06 at 11:05, Laura Quinn wrote: On Mon, 6 Sep 2004, Barry Rowlingson wrote: Laura Quinn wrote: I am trying to save a series of plots as .png files by using png(file=myfile.png,bg=transparent) dev.off() for each image plot I produce. Unfortunately when I have tried this I am unable to open the files, and am told they are corrupted. I have tried to use the jpeg() function but have the same problem. The only way I have managed to export a graphic successfully is as dev.copy2eps. Aside from producing unwieldy files, this is also unhelpful as [EMAIL PROTECTED] hoping to create a movie of the images via ImageMagick. This sounds a bit obvious, but are you doing your plot commands _between_ the png() call and the dev.off() call? Try: png(file=foo.png) plot(1:10) dev.off() What version/platform are you using? Yes, I have been using the above call to no avail. I'd be suprised if my libpng wasn't up-to-date on SuSe 9.0, but I'm not sure how to check which version I have? Laura Barry __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] obtaining exact p-values in mixed effects model
hi, Is there a way we can obtain the exact p-values from lme without rounding? use summary instead. used commands: library(nlme) g-lme(value~factor(fac1)+factor(fac2)+factor(fac1):factor(fac2),data=mydataframe,random=~1|factor(fac3)) ag-anova(g) summary(g)$tTable[,5] will provide the exact p-value you can always get the exact value of summary or predict etc... remember it's not only printing, it's also a list see ?summary.lme for more info hope it's help kind regards, R. Alberts __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Yves Magliulo [EMAIL PROTECTED] RD Engineer, CLIMPACT Tel. : +33 (0) 1 44 27 34 31 Fax. : +33 (0) 1 44 27 49 96 Universite Pierre et Marie Curie Boite 101 - Tour 45 - 5eme etage - Couloir 45/46 4 place Jussieu, 75252 Paris CEDEX 05, France __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Sort a data frame
hi, i had this trouble a while ago and found this function in latest R-help. SortMat - function(Mat, sort) { m - do.call(order, as.data.frame(Mat[, Sort])) Mat[m, ] } where mat is a matrix and sort the column you want to be sorted. convert you dataframe into matrix or change this function to be used with dataframe. Best, Le mar 20/07/2004 à 10:51, Luis Rideau Cruz a écrit : Hi all I have the next data frame year STODSLAGNR TAL TALT TALVEKT 1 2002 2120006 57 1 NA 1 2 1997 9703003257 NA NA NA 3 1997 9703007127 1 NA NA 4 1997 9703000557 1 NA NA 5 1997 9702012760 NA 1 NA 6 2001 1160025 27 1 NA 1 7 1998 9802006960 1 NA NA 8 1996 9603000957 NA 1 NA How to sort it according to year column Sort does seem to work only on vectors Thank you Luis Ridao Cruz Fiskirannsóknarstovan Nóatún 1 P.O. Box 3051 FR-110 Tórshavn Faroe Islands Phone: +298 353900 Phone(direct): +298 353912 Mobile: +298 580800 Fax: +298 353901 E-mail: [EMAIL PROTECTED] Web:www.frs.fo __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Yves Magliulo [EMAIL PROTECTED] Climatology research department, CLIMPACT Tel. : +33 (0) 1 55 07 85 77 Fax. : +33 (0) 1 55 07 85 79 Universite Pierre et Marie Curie Boite 101 - Tour 45 - 5eme etage - Couloir 45/46 4 place Jussieu, 75252 Paris CEDEX 05, France __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] extract columns from a dataframe
hi, see colnames() simple use, good result. ex: if df is your data.frame and toto = the column name you want to extract do: df2-df[,colnames(df)==toto)] #extract all toto column Le lun 05/07/2004 à 14:53, Rado Bonk a écrit : Dear R users, I'm coming back to R after while. I have a data frame with 200 columns, each column has a name. How to extract all columns to a new dataset, but the specified (by names) ones? I was playing with that for a little bit using the vector syntax but got several syntax errors. Thanks, Rado __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Yves Magliulo [EMAIL PROTECTED] Climatology research department, CLIMPACT Tel. : +33 (0) 1 55 07 85 77 Fax. : +33 (0) 1 55 07 85 79 Universite Pierre et Marie Curie Boite 101 - Tour 45 - 5eme etage - Couloir 45/46 4 place Jussieu, 75252 Paris CEDEX 05, France __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] gam
hi, i'm working with mgcv packages and specially gam. My exemple is: test-gam(B~s(pred1)+s(pred2)) plot(test,pages=1) when ploting test, you can view pred1 vs s(pred1, edf[1] ) pred2 vs s(pred2, edf[2] ) I would like to know if there is a way to access to those terms (s(pred1) s(pred2)). Does someone know how? the purpose is to access to equation of smooths terms in order to have the equation of my additive model. best regards, -- Yves Magliulo, Climatology research departement [EMAIL PROTECTED] Climpact __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html