[R] bivariate weighted kernel density estimator
Is there code for bivariate kernel density estimation? For bivariate kernels there is kde2d in MASS kde2d.g in GRASS KernSur in GenKern (list probably incomplete) but none of them seems to accept a weight parameter (like density does since R 2.2.0) -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ 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] second try; writing user-defined GLM link function
Ok, I think I have things figured out. Predict.glm still doesn't work (with type=response); however, the problem with the strange behavior of the betas and the results of predict.glm with type=link was simply due to data issues. I had converted my Program MARK input file (which needs only three piece of information; age of nest at start, age of nest when last alive, and age of nest when observation ends) directly to a data matrix. Therefore, the successful nests were observed for only one interval (age of nest when last alive=age of nest when observation ended), and during that interval, their mean age was around 34 days (since the nest cycle lasts 68 days). Those nests that failed later were forced into a second interval that had a later mean nest age. So the glm's were performing as expected from the data supplied. So, I went back to the original nest site visitation data and broke those 68 day intervals (as well as all others) into the much shorter, original visitation intervals. And now the resulting daily survival rate estimates are more believable, corresponding well to the equivalent Program MARK output. I think (correct me if I'm wrong, Mark) that the only detail left to examine is the true effective sample size for use when calculating AICc values, as each observation interval does not comprise an independent observation. That is apparently easily done by hand, but would be convenient to include in a future avian package (subtle hint). Thanks to all for their advice in this matter. __ 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] Monitor() in R2WinBUGS
Doran, Harold wrote: I have an array from an mcmc simulation and I'd like to try and use the monitor function in R2WinBUGS. The R2WinBUGS package is in the search path and when I try help(monitor) the help page appears for the function. But, when I try and use it the following happens: Please read the title of that help page: ... - intended for internal use only hence it is hidden in the package's Namespace and has no examples. If you really want to use it, you can get it by: R2WinBUGS:::monitor(sims) Uwe Ligges monitor(sims) Error: couldn't find function monitor I've searched the archives but have not seen any issues with this posted. The following are also in the search path search() [1] .GlobalEnvpackage:R2WinBUGS package:BRugs package:MASS package:methods [6] package:stats package:graphics package:grDevices package:utils package:datasets [11] Autoloads package:base I've also tried the following just to see what would happen example(monitor) Warning message: 'monitor' has a help file but no examples file in: example(monitor) Any thoughts on how to reconcile this? Harold [[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-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! A quetion about the Elasticnet package in R
Can anybody help me to run the Elasticnet package of R to build some model, i am a freshman to R language , when i use the Elasticnet package to my data, it always reture a error, but i can't settle that problem. I consider if there is any constrant of the data to that package? Can anyone help me to run the elasticnet and check my data as you convenient? I put the data in attachment. Thank you very much! Best regards -- Richard, DENG Min Department of Nankai University Tianjin, 300071, P. R. China P: +86 22 2350 0091 M: +86 1375 235 2719 EMAIL: [EMAIL PROTECTED] -- Richard, DENG Min Department of Nankai University Tianjin, 300071, P. R. China P: +86 22 2350 0091 M: +86 1375 235 2719 EMAIL:[EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to draw a circle
You may want to have a look at the package pgirmess and the function polycirc() Kind regards, Patrick __ 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] (no subject)
Ilija Barukcic, Jever, Germany. GMT + 1h. [EMAIL PROTECTED] Hallo, you are receiving this message from me as someone who potentially has bought the first Edition of my book Causality. New statistical methods. ISBN 3 - 8 3 3 4 - 3 6 4 5 - X. Your email address was obtained either through my friends, your publication, a colleague or via correspondence with you. I am pleased to announce, that a web page is established at http://www.causation.de/ where you can get some more information (Erratum etc.) The mathematics of the first Edition of my book above is perfect and proved. In so far no changes are needed. But besides of all, their are to many misprints in the first Edition. If you should be dissatisfied with the misprints, please feel free to contact me without any obligation for you. I will make sure, that you can get a copy of the sec. Edition of my book above without any costs for you. You must not pay anything, I will pay the shipping costs too. I you have decided to by my book above, please wait until the sec. Edition. The second Edition should be on the market before the XXIIIrd International Biometric Conference in Montréal, Québec, Canada. July 16 - 21, 2006. I am invited to take part at this conference. I have accepted the invitation. You can contact me there personally. I hope I can take some books of the second Edition with me to this conference. You could profit from the sec. Edition too. The mathematics has of course not changed. The mathematics is proved and stable! But there are still view additions: As a addition, you have the possibility to undertake a two tailed test to discover causal relationships from observational data, a left sided test to discover causal relationships from observational data with power, p value etc. Further, it is derived, how you can use n-dimensional cdf to discover causal relationships from observational data. Further, in the coming Edition, I have proved, that the formula of the causal relationship is absolutely compatible with Einstein's Theory of Relativity and with Heisenberg's Uncertainty principle. Although this is something more for a philosopher or a physicists but not that much for a statistician, a biostatistician or an epidemiologist. The same with the derived formula of the unity of gravity and electromagnetism. Best wishes, Ilija [EMAIL PROTECTED] 0. Rep. __ 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] Comparing GLMMs and GLMs with quasi-binomial errors?
Dear All, I am analysing a dataset on levels of herbivory in seedlings in an experimental setup in a rainforest. I have seven classes/categories of seedling damage/herbivory that I want to analyse, modelling each separately. There are twenty maternal trees, with eight groups of seedlings around each. Each tree has a TreeID, which I use as the random effect (blocking factor). There are two fixed effects: DISTANCE - distance to maternal tree; two levels 'CLOSE' or 'AWAY' (four groups of seedlings each per tree), and PLATEAU - whether the maternal tree grows on the 'UPPER' plateau (bad soil) or 'LOWER' plateau (good soil). In each group of seedlings, we randomly selected one seedling where we scored herbivory. Levels of herbivory for each of the seven herbivory categories was scored as proportion of leaves attacked. Obviously, I don't want to use a more complicated model than necessary - but I equally obviously want to take the random effect 'TreeID' into account. Hence, for each herbivory category, I initially fitted a GLMM using the 'glmmPQL' command from the MASS library(after using the 'cbind()' command on the two columns with total number of leaves per seedling and number of leaves attacked by that herbivory category) - and then compared these models to GLMs without the random effect. ## model example1: leaf mines GLMM proportion.leafmines - cbind(leaves.affected, total.leaves - leaves.affected) leafminesGLMM - glmmPQL(proportion.leafmines ~ PLATEAU * DISTANCE, random=~1| TreeID, family=binomial(link=logit)) ##AIC(leafminesGLMM) = 474.773 ## model example2: leaf mines GLM leafminesGLM - glm(proportion.leafmines ~ PLATEAU * DISTANCE, family=binomial(link=logit)) ##AIC(leafminesGLM) = 207.9465 ...and so on, for all seven herbivory categories. In four of the cases, the AIC is much lower (as in the example bove) for the GLMs than for the GLMMs - whereas in three other cases, clearly TreeID is an important random factor, as the AIC values of the GLMs are much higher than the ones for the GLMMs. There is not a big difference in significance levels - some marginally significant ones now become significant, while some significant ones now become marginal. However, there is one complication to simply using the AIC scores to evaluate which model is the best; for almost all the cases where the GLM has the lower AIC, the data are overdispersed, and I need to fit the model with a quasibinomial, rather than with a binomial error structure. BUT - using a GLM with quasibinomial error structure, I of course no longer get an AIC score... -so, my main question is: can I simply use the GLM with quasibinomial error structure instead of the GLMM if the GLM with binomial error structure has a lower AIC score than the GLMM? Any input on how I can compare such models would be greatly appreciated! Dennis --- Dennis Marinus Hansen Institute of Environmental Sciences University of Zurich Winterthurerstrasse 190 8057 Zurich Switzerland tel: +41 (0) 44635 6122 fax: +41 (0) 44635 5711 www.uwinst.unizh.ch __ 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] bivariate weighted kernel density estimator [Broadcast]
locfit() in the locfit package can do that. Andy _ From: [EMAIL PROTECTED] on behalf of Erich Neuwirth Sent: Sun 4/23/2006 3:13 AM To: r-help Subject: [R] bivariate weighted kernel density estimator [Broadcast] Is there code for bivariate kernel density estimation? For bivariate kernels there is kde2d in MASS kde2d.g in GRASS KernSur in GenKern (list probably incomplete) but none of them seems to accept a weight parameter (like density does since R 2.2.0) -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at http://sunsite.univie.ac.at/ Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Extract AIC, BIC
Which Garch function are you using? help.search(garch) identified garch functions in fOptions, fSeries, and tseries. If you try RSiteSearch(garch, functions), you might find others. I just tried 'library(tseries)' and tried an example in help(garch). I modified this slightly to produce the following: n - 1100 a - c(0.1, 0.5, 0.2) # ARCH(2) coefficients e - rnorm(n) x - double(n) x[1:2] - rnorm(2, sd = sqrt(a[1]/(1.0-a[2]-a[3]))) for(i in 3:n) # Generate ARCH(2) process { x[i] - e[i]*sqrt(a[1]+a[2]*x[i-1]^2+a[3]*x[i-2]^2) } x - ts(x[101:1100]) x.arch - garch(x, order = c(0,2)) # Fit ARCH(2) summary(x.arch) # Diagnostic tests logLik(x.arch) AIC(x.arch) Getting the BIC would be slightly more difficult, but the following would lead you to code that you should be able to modify to get what you want: class(x.arch) [1] garch methods(class=garch) [1] coef.garch* fitted.garch*logLik.garch*plot.garch* [5] predict.garch* print.garch* residuals.garch* summary.garch* Non-visible functions are asterisked methods(AIC) [1] AIC.default* AIC.logLik* Non-visible functions are asterisked getAnywhere(AIC.default) getAnywhere(AIC.logLik) hope this helps, spencer graves Sumanta Basak wrote: Hi All, How can extract AIC,BIC from a fitted Garch model? -- SUMANTA BASAK. [[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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Question about bicreg
Dear Adrian and Ian (and r-helpers), I encountered a curious result in developing an example using the bicreg function in the BMA package: I noticed that pairs of models with equal R^2 and equal numbers of predictors had nevertheless different BIC values. Looking at the bicreg function, the definition of BIC appears to be the usual one, or close to it [bic - n * log(1 - r2/100) + (size - 1) * log(n)], though in the quick look I took, I didn't quite see where size was coming from. In any event, I've appended some output. The data are the 1987 baseball-salary data (with which you might be familiar); I can send you the data set, if that proves useful, but at this point simply wanted to run the question by you. Any help would be appreciated, John snip --- br - bicreg(X, log.salary, maxCol=33) summary(br) Call: bicreg(x = X, y = log.salary, maxCol = 33) 65 models were selected Best 5 models (cumulative posterior probability = 0.2022 ): p!=0EV SD model 1 model 2 model 3 model 4 model 5 Intercept 100.0 -5.712e-01 0.6720850 -9.097e-01 -9.099e-01 -1.001e+00 1.610e-01 -1.146e+00 atbats1.2 -7.598e-05 0.0006955 . . . . . hits 7.9 4.280e-04 0.0023605 . . . . . homers2.3 -1.562e-04 0.0011977 . . . . . runs 0.0 0.000e+00 0.000 . . . . . rbis 0.0 0.000e+00 0.000 . . . . . walks93.4 6.686e-03 0.0025198 7.512e-03 7.753e-03 8.239e-03 6.739e-03 6.247e-03 years 0.0 0.000e+00 0.000 . . . . . career.atbats 100.0 8.316e-01 0.1272297 9.004e-01 9.014e-01 9.151e-01 6.858e-01 9.426e-01 career.hits 100.0 -1.098e-03 0.0004007 -1.284e-03 -1.269e-03 -1.651e-03 -6.317e-04 -1.557e-03 career.homers 2.4 4.541e-05 0.0003012 . . . . . career.runs 54.6 8.680e-04 0.0008855 1.704e-03 1.688e-03 1.529e-03 . 1.614e-03 career.rbis 36.2 3.764e-04 0.0005293 . . 9.876e-04 . 1.051e-03 career.walks 59.5 -6.551e-04 0.0006580 -8.521e-04 -8.894e-04 -9.950e-04 . -1.583e-03 putouts 0.0 0.000e+00 0.000 . . . . . assists 8.3 -4.809e-05 0.0001787 . . . . . errors0.0 0.000e+00 0.000 . . . . . middle.infield 44.2 7.835e-02 0.1082097 1.475e-01 . . . . center.field 1.1 -1.619e-03 0.0177267 . . . . . catcher 71.8 1.537e-01 0.1182395 2.406e-01 2.123e-01 2.009e-01 . 2.107e-01 dh3.4 -6.842e-03 0.0425172 . . . . . atbats.year 98.8 -7.200e-03 0.0014719 -7.737e-03 -7.159e-03 -7.116e-03 -6.448e-03 -7.556e-03 hits.year98.8 2.608e-02 0.0050614 2.572e-02 2.470e-02 2.808e-02 2.457e-02 2.732e-02 homers.year 11.1 1.966e-03 0.0058173 . . . . . runs.year 4.3 4.312e-04 0.0022034 . . . . . rbis.year50.7 4.702e-03 0.0049808 1.010e-02 8.065e-03 . 7.805e-03 . walks.year 20.5 2.386e-03 0.0052883 . . . . 8.710e-03 average 0.0 0.000e+00 0.000 . . . . . career.average0.0 0.000e+00 0.000 . . . . . onbase1.2 -9.736e-02 0.8998396 . . . . . career.onbase 1.2 7.627e-02 0.6997039 . . . . . arbitration 41.1 1.099e-01 0.1527324 . . . 2.982e-01 . freeagent 100.0 3.991e-01 0.2066829 2.520e-01 2.525e-01 2.693e-01 6.452e-01 2.560e-01 nVar 11 10 10 8 11 r2 0.844 0.841 0.841 0.833 0.844 BIC -4.261e+02 -4.259e+02 -4.255e+02 -4.251e+02 -4.250e+02 post prob 0.053 0.049 0.038 0.032 0.030 John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox __ R-help@stat.math.ethz.ch mailing list
Re: [R] help! A quetion about the Elasticnet package in R
邓敏 [EMAIL PROTECTED] writes: Can anybody help me to run the Elasticnet package of R to build some model, i am a freshman to R language , when i use the Elasticnet package to my data, it always reture a error, but i can't settle that problem. I consider if there is any constrant of the data to that package? Can anyone help me to run the elasticnet and check my data as you convenient? I put the data in attachment. Thank you very much! Best regards Please, correct your typos. -- Leon __ 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] RGL and scales of axes
Hi, Is there anyway i can set the aspect ratio options in an RGL graphic? Like in lattice. panel.cloud has an option called aspect=c(r1,r2) where r1 is the y/x ratio and r2 is z/x ratio. I'm not sure if this is the right place to ask this question. Thanks for any pointers. Rgds Saptarshi Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha A professor is one who talks in someone else's sleep. [[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] info : Manova - eigenvector analysis and canonical analysis
Have you considered the sem package (for structural equation modeling), which (to me at least) is a generalizion of MANOVA with canonical analysis. Alternatively, have you considered partial least squares (e.g., packages pls or plsgenomics)? I haven't used them, but they sound like generalizations of the problem you are trying to solve. If you try something and can't get it to work, please submit a simple, self-contained example showing what you tried and explaining why that didn't quite seem to work for you. (Before submitting another post, however, please also read the posting guide! www.R-project.org/posting-guide.html. I believe that people who follow more closely that guide tend to get more useful answers quicker than people who don't.) hope this helps, spencer graves Céline Hauzy wrote: Hello everybody ! I try to obtain in R eigenvectors and canonical analysis on MANOVA results, but I don't find how to process? In particular, I would be interesting to obtain standardized canonical coefficients of the canonical variates. There analysis give some information on the correlation between response variates. My data are organised in 2 terms (one is continu, one is a factor) and 3 response variates (continus). summary(manova(cbind(dureeL,dureeI,dureeR)~denst*etatav, data=durt)) Df Pillai approx F num Df den DfPr(F) denst 1 0.3047 10.6629 3 73 6.795e-06 *** etatav 1 0.1070 2.9146 3 73 0.03995 * denst:etatav 1 0.0324 0.8138 3 73 0.49035 Residuals 75 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 I hope you can help me. best regards Céline Hauzy Céline Hauzy Laboratoire Bioemco Ecole Normale Supérieure 46 rue d'Ulm 75230 Paris Cedex 05 Tel : 01 44 32 38 78 Fax : 01 44 32 38 85 info __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Cohen-Daubechies-Fauraue (CDF) 9/7 wavelet-transform
Hello, I have to make use of the Cohen-Daubechies-Fauraue (CDF) 9/7 wavelet-transform, but have not found these biorthogonal wavlet in the released packages waveslim, wavethresh or wavelets. Is there any package doing this transform? Or can anybody send me the function doing this? I would be very grateful of that. Thanks Annika __ 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] lme: null deviance, deviance due to the random effects, residual deviance
A maybe trivial and stupid question: In the case of a lm or glm fit, it is quite informative (to me) to have a look to the null deviance and the residual deviance of a model. This is generally provided in the print method or the summary, eg: Null Deviance: 658.8 Residual Deviance: 507.3 and (a bit simpled minded) I like to think that the proportion of deviance 'explained' by the model is (658.8-507.3)/658.8 = 23% In the case of lme models, is it possible and reasonable to try and get the: - null deviance - the total deviance due to the the random effect(s) - the residual deviance? With the idea that Null deviance = Fixed effects + Random Effects + Residuals If yes how to do it ? A lme object provides the following: names(glm6) [1] modelStruct dims contrastscoefficients [5] varFix sigmaapVarlogLik [9] numIter groups call method [13] fitted residualsfixDFfamily so no $null.deviance and $deviance elements as in glm objects... I tried to find out an answer on R-help Pineihro Bates (2000). Partial success only: - null deviance: Response: possibly yes: see http://tolstoy.newcastle.edu.au/R/help/05/12/17796.html (Spencer Graves). The (null?) deviance is -2*logLik(mylme), but a personnal trial with some glm objects did not led to the same numbers that the one given by the print.glm method... - the deviance due to the the random effect(s). I was supposing that the coefficients given by ranef(mylme) may be an entry... but beyond this, I guess those coefficients must be weighed in some way... which is a far beyond my capacities in this matter... - residual deviance. I was supposing that it may be sum(residuals(mylme)^2). With some doubts as far as I feel that I am thinking sum of squares estimation in the context of likelihood and deviance estimations... So most likely irrelevant. Moreover, in the case I was exploring, this quantity is much larger than the null deviance computed as above... Any hint appreciated, Patrick Giraudoux __ 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] help! A quetion about the Elasticnet package in R
Dear Leon: How good is your Manderin? I am pleased and humbled that Mr. Dengmin has made the effort to put his question in English. I don't know his background, but my Eastern-language enabled email provided a rendition of Richard Dengmin in the form or two Chinese characters, suggesting that it might have been difficult for him to learn enough English just to be able to prepare the question he posted to this list. Beyond this, it has not always obvious how to use a spell checker for email software. Even if you have a Spell button on your email software, it might only work in your primary tongue without some less-than-obvious effort to configure it to also check text in other languages. I know that my previous attempts to write something in a language other than my Mother tongue have tended to display much higher rates of spelling and grammar errors -- some even to the point of failing to communicate. Therefore, I try to avoid criticizing someone else's use of language, except to ask for clarification where the meaning is not clear (or when it seems that some friendly, copy editing suggestions might be favorably received). Best Wishes, Spencer Graves Leon wrote: 邓敏 [EMAIL PROTECTED] writes: Can anybody help me to run the Elasticnet package of R to build some model, i am a freshman to R language , when i use the Elasticnet package to my data, it always reture a error, but i can't settle that problem. I consider if there is any constrant of the data to that package? Can anyone help me to run the elasticnet and check my data as you convenient? I put the data in attachment. Thank you very much! Best regards Please, correct your typos. __ 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] help! A quetion about the Elasticnet package in R
Spencer Graves [EMAIL PROTECTED] writes: Dear Leon: How good is your Manderin? I am pleased and humbled that Mr. Dengmin has made the effort to put his question in English. I don't know his background, but my Eastern-language enabled email provided a rendition of Richard Dengmin in the form or two Chinese characters, suggesting that it might have been difficult for him to learn enough English just to be able to prepare the question he posted to this list. Manderin is my second language and English third. English is difficult for us. We learn it since the first year of high school. Beyond this, it has not always obvious how to use a spell checker for email software. Even if you have a Spell button on your email software, it might only work in your primary tongue without some less-than-obvious effort to configure it to also check text in other languages. I know that my previous attempts to write something in a language other than my Mother tongue have tended to display much higher rates of spelling and grammar errors -- some even to the point of failing to communicate. Therefore, I try to avoid criticizing someone else's use of language, except to ask for clarification where the meaning is not clear (or when it seems that some friendly, copy editing suggestions might be favorably received). Best Wishes, Spencer Graves I'm not criticizing the use of language either. I feel that if she well prepared her post she is more likely to get an answer. That's just my suggestion. Nothing offensive. Sorry if I have caused some uncomfortableness. I really don't mean it. Leon wrote: 邓敏 [EMAIL PROTECTED] writes: Can anybody help me to run the Elasticnet package of R to build some model, i am a freshman to R language , when i use the Elasticnet package to my data, it always reture a error, but i can't settle that problem. I consider if there is any constrant of the data to that package? Can anyone help me to run the elasticnet and check my data as you convenient? I put the data in attachment. Thank you very much! Best regards Please, correct your typos. -- Leon __ 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] Kullback Liebler
Dear R Users, Does anyone have an implementation of KL apart from what is in reldist ? Something with flexibility to take in empirical data for two sets, or their CDF or their density, flagged separately for each ? Thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help! A quetion about the Elasticnet package in R
Dear Leon: Please forgive me. As I said, I'm pleased and humbled that so many others learn English. I reacted as I did because I've heard too many people (fortunately NOT on this list) criticize or make fun of others whose use of language was obviously not native. Best Wishes, spencer graves Leon wrote: Spencer Graves [EMAIL PROTECTED] writes: Dear Leon: How good is your Manderin? I am pleased and humbled that Mr. Dengmin has made the effort to put his question in English. I don't know his background, but my Eastern-language enabled email provided a rendition of Richard Dengmin in the form or two Chinese characters, suggesting that it might have been difficult for him to learn enough English just to be able to prepare the question he posted to this list. Manderin is my second language and English third. English is difficult for us. We learn it since the first year of high school. Beyond this, it has not always obvious how to use a spell checker for email software. Even if you have a Spell button on your email software, it might only work in your primary tongue without some less-than-obvious effort to configure it to also check text in other languages. I know that my previous attempts to write something in a language other than my Mother tongue have tended to display much higher rates of spelling and grammar errors -- some even to the point of failing to communicate. Therefore, I try to avoid criticizing someone else's use of language, except to ask for clarification where the meaning is not clear (or when it seems that some friendly, copy editing suggestions might be favorably received). Best Wishes, Spencer Graves I'm not criticizing the use of language either. I feel that if she well prepared her post she is more likely to get an answer. That's just my suggestion. Nothing offensive. Sorry if I have caused some uncomfortableness. I really don't mean it. Leon wrote: 邓敏 [EMAIL PROTECTED] writes: Can anybody help me to run the Elasticnet package of R to build some model, i am a freshman to R language , when i use the Elasticnet package to my data, it always reture a error, but i can't settle that problem. I consider if there is any constrant of the data to that package? Can anyone help me to run the elasticnet and check my data as you convenient? I put the data in attachment. Thank you very much! Best regards Please, correct your typos. __ 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] help! A quetion about the Elasticnet package in R
Dear Spencer, No worries:-) -- Leon Spencer Graves [EMAIL PROTECTED] writes: Dear Leon: Please forgive me. As I said, I'm pleased and humbled that so many others learn English. I reacted as I did because I've heard too many people (fortunately NOT on this list) criticize or make fun of others whose use of language was obviously not native. Best Wishes, spencer graves Leon wrote: Spencer Graves [EMAIL PROTECTED] writes: Dear Leon: How good is your Manderin? I am pleased and humbled that Mr. Dengmin has made the effort to put his question in English. I don't know his background, but my Eastern-language enabled email provided a rendition of Richard Dengmin in the form or two Chinese characters, suggesting that it might have been difficult for him to learn enough English just to be able to prepare the question he posted to this list. Manderin is my second language and English third. English is difficult for us. We learn it since the first year of high school. Beyond this, it has not always obvious how to use a spell checker for email software. Even if you have a Spell button on your email software, it might only work in your primary tongue without some less-than-obvious effort to configure it to also check text in other languages. I know that my previous attempts to write something in a language other than my Mother tongue have tended to display much higher rates of spelling and grammar errors -- some even to the point of failing to communicate. Therefore, I try to avoid criticizing someone else's use of language, except to ask for clarification where the meaning is not clear (or when it seems that some friendly, copy editing suggestions might be favorably received). Best Wishes, Spencer Graves I'm not criticizing the use of language either. I feel that if she well prepared her post she is more likely to get an answer. That's just my suggestion. Nothing offensive. Sorry if I have caused some uncomfortableness. I really don't mean it. Leon wrote: 邓敏 [EMAIL PROTECTED] writes: Can anybody help me to run the Elasticnet package of R to build some model, i am a freshman to R language , when i use the Elasticnet package to my data, it always reture a error, but i can't settle that problem. I consider if there is any constrant of the data to that package? Can anyone help me to run the elasticnet and check my data as you convenient? I put the data in attachment. Thank you very much! Best regards Please, correct your typos. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] distribution of the product of two correlated normal
Hi, Does anyone know what the distribution for the product of two correlated normal? Say I have X~N(a, \sigma1^2) and Y~N(b, \sigma2^2), and the \rou(X,Y) is not equal to 0, I want to know the pdf or cdf of XY. Thanks a lot in advance. yu [[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] Reorganizing rows and columns
I'm sure this is a simple task, but how to do it has escaped me. I have imported data from two separate files (each file contains the results from an information retrieval algorithm) organized into a list. They are organized by File,Query, and Rank (in that order): [[1]] Doc Query Rank 5 1 1 9 1 2 7 1 3 5 2 1 7 2 2 9 2 3 [[2]] Doc Query Rank 4 1 1 5 1 2 9 1 3 8 2 1 5 2 2 7 2 3 I need to rearrange the data so that it is sorted by Query and Document, with columns for rank1 and rank2 (from files 1 and 2, respectively). For example: [[1]] Doc Query Rank1 Rank1 4 1 NA 1 5 1 1 2 7 1 3 NA 9 1 2 3 5 2 1 2 7 2 2 3 8 2 NA 1 9 2 3 NA My goal is to perform a Spearman/Kendall test to check the correlation between the rankings. Any help would be appreciated. Andrew Noyes __ 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] Reorganizing rows and columns
Use merge: # test data both - list(structure(list(Doc = c(5, 9, 7, 5, 7, 9), Query = c(1, 1, 1, 2, 2, 2), Rank = c(1, 2, 3, 1, 2, 3)), .Names = c(Doc, Query, Rank), class = data.frame, row.names = c(1, 2, 3, 4, 5, 6)), structure(list(Doc = c(4, 5, 9, 8, 5, 7), Query = c(1, 1, 1, 2, 2, 2), Rank = c(1, 2, 3, 1, 2, 3)), .Names = c(Doc, Query, Rank), class = data.frame, row.names = c(1, 2, 3, 4, 5, 6))) merge(both[[1]], both[[2]], all = TRUE, by = 1:2) On 4/23/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm sure this is a simple task, but how to do it has escaped me. I have imported data from two separate files (each file contains the results from an information retrieval algorithm) organized into a list. They are organized by File,Query, and Rank (in that order): [[1]] Doc Query Rank 5 1 1 9 1 2 7 1 3 5 2 1 7 2 2 9 2 3 [[2]] Doc Query Rank 4 1 1 5 1 2 9 1 3 8 2 1 5 2 2 7 2 3 I need to rearrange the data so that it is sorted by Query and Document, with columns for rank1 and rank2 (from files 1 and 2, respectively). For example: [[1]] Doc Query Rank1 Rank1 4 1 NA 1 5 1 1 2 7 1 3 NA 9 1 2 3 5 2 1 2 7 2 2 3 8 2 NA 1 9 2 3 NA My goal is to perform a Spearman/Kendall test to check the correlation between the rankings. Any help would be appreciated. Andrew Noyes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] question about cumulating random effects in lmer
Hello: I am studying the effect of schools on student achievement growth over time. School effect is random. The effects of schools in prior years are assumed to be persistent till the current year. Thus, the total school effect in the second year is like J=J2+J1. Does anyone know how to model this kind of cumulating random effects in lmer? Thanks in advance! Best Regards Zhongmiao Wang __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Question about bicreg
Dear Adrian and Ian (and r-helpers), To answer my own question: The difference is simply due to rounding; that is, there are actually small differences in the R^2 values that account for the differences in the BICs. Sorry for the false alarm, John -Original Message- From: John Fox [mailto:[EMAIL PROTECTED] Sent: Sunday, April 23, 2006 9:35 AM To: 'Adrian Raftery'; 'Ian Painter' Cc: 'r-help@stat.math.ethz.ch' Subject: Question about bicreg Dear Adrian and Ian (and r-helpers), I encountered a curious result in developing an example using the bicreg function in the BMA package: I noticed that pairs of models with equal R^2 and equal numbers of predictors had nevertheless different BIC values. Looking at the bicreg function, the definition of BIC appears to be the usual one, or close to it [bic - n * log(1 - r2/100) + (size - 1) * log(n)], though in the quick look I took, I didn't quite see where size was coming from. In any event, I've appended some output. The data are the 1987 baseball-salary data (with which you might be familiar); I can send you the data set, if that proves useful, but at this point simply wanted to run the question by you. Any help would be appreciated, John snip --- br - bicreg(X, log.salary, maxCol=33) summary(br) Call: bicreg(x = X, y = log.salary, maxCol = 33) 65 models were selected Best 5 models (cumulative posterior probability = 0.2022 ): p!=0EV SD model 1 model 2 model 3 model 4 model 5 Intercept 100.0 -5.712e-01 0.6720850 -9.097e-01 -9.099e-01 -1.001e+00 1.610e-01 -1.146e+00 atbats1.2 -7.598e-05 0.0006955 . . . . . hits 7.9 4.280e-04 0.0023605 . . . . . homers2.3 -1.562e-04 0.0011977 . . . . . runs 0.0 0.000e+00 0.000 . . . . . rbis 0.0 0.000e+00 0.000 . . . . . walks93.4 6.686e-03 0.0025198 7.512e-03 7.753e-03 8.239e-03 6.739e-03 6.247e-03 years 0.0 0.000e+00 0.000 . . . . . career.atbats 100.0 8.316e-01 0.1272297 9.004e-01 9.014e-01 9.151e-01 6.858e-01 9.426e-01 career.hits 100.0 -1.098e-03 0.0004007 -1.284e-03 -1.269e-03 -1.651e-03 -6.317e-04 -1.557e-03 career.homers 2.4 4.541e-05 0.0003012 . . . . . career.runs 54.6 8.680e-04 0.0008855 1.704e-03 1.688e-03 1.529e-03 . 1.614e-03 career.rbis 36.2 3.764e-04 0.0005293 . . 9.876e-04 . 1.051e-03 career.walks 59.5 -6.551e-04 0.0006580 -8.521e-04 -8.894e-04 -9.950e-04 . -1.583e-03 putouts 0.0 0.000e+00 0.000 . . . . . assists 8.3 -4.809e-05 0.0001787 . . . . . errors0.0 0.000e+00 0.000 . . . . . middle.infield 44.2 7.835e-02 0.1082097 1.475e-01 . . . . center.field 1.1 -1.619e-03 0.0177267 . . . . . catcher 71.8 1.537e-01 0.1182395 2.406e-01 2.123e-01 2.009e-01 . 2.107e-01 dh3.4 -6.842e-03 0.0425172 . . . . . atbats.year 98.8 -7.200e-03 0.0014719 -7.737e-03 -7.159e-03 -7.116e-03 -6.448e-03 -7.556e-03 hits.year98.8 2.608e-02 0.0050614 2.572e-02 2.470e-02 2.808e-02 2.457e-02 2.732e-02 homers.year 11.1 1.966e-03 0.0058173 . . . . . runs.year 4.3 4.312e-04 0.0022034 . . . . . rbis.year50.7 4.702e-03 0.0049808 1.010e-02 8.065e-03 . 7.805e-03 . walks.year 20.5 2.386e-03 0.0052883 . . . . 8.710e-03 average 0.0 0.000e+00 0.000 . . . . . career.average0.0 0.000e+00 0.000 . . . . . onbase1.2 -9.736e-02 0.8998396 . . . . . career.onbase 1.2 7.627e-02 0.6997039 . . . . . arbitration 41.1 1.099e-01 0.1527324 . . . 2.982e-01 . freeagent 100.0 3.991e-01 0.2066829 2.520e-01 2.525e-01 2.693e-01 6.452e-01 2.560e-01 nVar
[R] bivariate weighted kernel density estimator
Erich Neuwirth writes: Is there code for bivariate kernel density estimation? ... but none of them seems to accept a weight parameter In package 'spatstat' the function density.ppp performs weighted kernel smoothing, including bivariate kernel density estimation. At the moment it only offers the Gaussian kernel but we plan to include other kernels. Adrian Baddeley __ 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] garch warning
Dear r users, Few days ago I posted the same topic but unable to receive any suggestion. So I am asking this same question. I was trying to fit a garch(1,1) model to my dataset. But while executing I got a warning message NaNs produced in: sqrt(pred$e). And got the estimated sd's along with five NA, but as per my best knowledge I should get only one NA i.e. corresponding to the first observation only. If anyone tell me why I got this message it will be a great advantage for me. With regards, thanks in advance - [[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] Reorganizing rows and columns
Suppose your data frames are A and B: AB - merge(A, B, c(Doc, Query), all=TRUE) AB[order(AB$Query, AB$Doc),] gets the answer you are asking for. (Not sure why you want to sort it to use a correlation test, as those are indifferent to ordering.) On Sun, 23 Apr 2006, [EMAIL PROTECTED] wrote: I'm sure this is a simple task, but how to do it has escaped me. I have imported data from two separate files (each file contains the results from an information retrieval algorithm) organized into a list. They are organized by File,Query, and Rank (in that order): [[1]] Doc Query Rank 5 1 1 9 1 2 7 1 3 5 2 1 7 2 2 9 2 3 [[2]] Doc Query Rank 4 1 1 5 1 2 9 1 3 8 2 1 5 2 2 7 2 3 I need to rearrange the data so that it is sorted by Query and Document, with columns for rank1 and rank2 (from files 1 and 2, respectively). For example: [[1]] Doc Query Rank1 Rank1 4 1 NA 1 5 1 1 2 7 1 3 NA 9 1 2 3 5 2 1 2 7 2 2 3 8 2 NA 1 9 2 3 NA My goal is to perform a Spearman/Kendall test to check the correlation between the rankings. Any help would be appreciated. Andrew Noyes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Comparing GLMMs and GLMs with quasi-binomial errors?
AIC is only valid for maximum likelihood fitting, so not for PQL and also not for quasi-binomial. In particular, who said AIC() was valid when applied to a glmmPQL fit? (Certainly not the book it supports!) You say TreeID is a `blocking factor', but you have a treatment (PLATEAU) that is confounded with your blocks. That complicates things, but with a maximum of four blocks in each level of plateau, you have very little information on the difference in soil type if you believe TreeID has appeciable variability. You can choose between the glm and glmmPQL fits by testing if the TreeID variance component is non-zero, although the distribution theory is only very approximate. A much simpler analysis would be to analyse the two soil types separately with TreeID as a classic blocking factor (a fixed effect). That would tell you the effect of DISTANCE within each level of PLATEAU and provide enough info to do a t-test to compare the estimated effects. As for the effect of PLATEAU, just use the mean proportions for each tree and a two-sample t-test. On Sun, 23 Apr 2006, Dennis Hansen wrote: Dear All, I am analysing a dataset on levels of herbivory in seedlings in an experimental setup in a rainforest. I have seven classes/categories of seedling damage/herbivory that I want to analyse, modelling each separately. There are twenty maternal trees, with eight groups of seedlings around each. Each tree has a TreeID, which I use as the random effect (blocking factor). There are two fixed effects: DISTANCE - distance to maternal tree; two levels 'CLOSE' or 'AWAY' (four groups of seedlings each per tree), and PLATEAU - whether the maternal tree grows on the 'UPPER' plateau (bad soil) or 'LOWER' plateau (good soil). In each group of seedlings, we randomly selected one seedling where we scored herbivory. Levels of herbivory for each of the seven herbivory categories was scored as proportion of leaves attacked. Obviously, I don't want to use a more complicated model than necessary - but I equally obviously want to take the random effect 'TreeID' into account. Hence, for each herbivory category, I initially fitted a GLMM using the 'glmmPQL' command from the MASS library(after using the 'cbind()' command on the two columns with total number of leaves per seedling and number of leaves attacked by that herbivory category) - and then compared these models to GLMs without the random effect. ## model example1: leaf mines GLMM proportion.leafmines - cbind(leaves.affected, total.leaves - leaves.affected) leafminesGLMM - glmmPQL(proportion.leafmines ~ PLATEAU * DISTANCE, random=~1| TreeID, family=binomial(link=logit)) ##AIC(leafminesGLMM) = 474.773 ## model example2: leaf mines GLM leafminesGLM - glm(proportion.leafmines ~ PLATEAU * DISTANCE, family=binomial(link=logit)) ##AIC(leafminesGLM) = 207.9465 ...and so on, for all seven herbivory categories. In four of the cases, the AIC is much lower (as in the example bove) for the GLMs than for the GLMMs - whereas in three other cases, clearly TreeID is an important random factor, as the AIC values of the GLMs are much higher than the ones for the GLMMs. There is not a big difference in significance levels - some marginally significant ones now become significant, while some significant ones now become marginal. However, there is one complication to simply using the AIC scores to evaluate which model is the best; for almost all the cases where the GLM has the lower AIC, the data are overdispersed, and I need to fit the model with a quasibinomial, rather than with a binomial error structure. BUT - using a GLM with quasibinomial error structure, I of course no longer get an AIC score... -so, my main question is: can I simply use the GLM with quasibinomial error structure instead of the GLMM if the GLM with binomial error structure has a lower AIC score than the GLMM? Any input on how I can compare such models would be greatly appreciated! Dennis --- Dennis Marinus Hansen Institute of Environmental Sciences University of Zurich Winterthurerstrasse 190 8057 Zurich Switzerland tel: +41 (0) 44635 6122 fax: +41 (0) 44635 5711 www.uwinst.unizh.ch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!