Re: [R] The elegant way to test if a number is a whole number
Hello Alex, Have you tried the modulus operator? 2 %% 1 [1] 0 2.1 %% 1 [1] 0.1 ~Jason On 2011.09.08 20:27:14, Alexander Engelhardt wrote: Hi, x - 0.2*5 is.integer(x) gives me FALSE because R stores it as a float number, right? Is there an elegant way to work around that problem? Right now I'm using x - 0.2*5 round(x) == x which returns TRUE. But more strictly I should use all.equal(), right? I somehow just don't like the--pardon--ugliness of those pieces of code. Maybe there is a beautiful way to write that. If not, no big problem -- I just like beautiful code :-) Cheers, Alex __ 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. -- Jason W. Morgan Ph.D. Candidate Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] random interaction effect in lmer
Hello Federico, You should try sending this to the mixed models mailing list (link below). Also, it would probably help to know what the data looks like. With the information you provide, it's hard to say what the problem could be. r-sig-mixed-mod...@r-project.org Best, ~Jason On 2011.02.06, Federico Bonofiglio wrote: Hi dears while modeling an interaction random effect in lmer i receive the instantaneous error message ldlM4-lmer(ldl~rt*cd4+age+rf+pharmac+factor(hcv)+ + hivdur+(rt:cd4|id),na.action=na.omit,REML=F) *Warning message: In mer_finalize(ans) : false convergence (8) * I think the matter lies in syntax, 'cause i sistematically receive the same message even when changing response... PS: the above model runs quite well in lme and only rarely I recive : * Errore in lme.formula(fixed = ldl ~ rt + cd4 + age + rf + pharmac + factor(hcv) + : nlminb problem, convergence error code = 1 message = iteration limit reached without convergence (9) * ..reason for which I switch into lmer Thank u in advance foe any hints...;) -- *Little u can do against ignorance,it will always disarm u: is the 2nd principle of thermodinamics made manifest, ...entropy in expansion.**But setting order is the real quest 4 truth, ..and the mission of a (temporally) wise dude. * [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jason W. Morgan Ph.D. Candidate Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] Building correlation matrix
On 2010.05.25 11:52:07, Anyi Zhu wrote: Hi, I am a novice with R, so pardon me if the question is a piece of cake to some of you. Say if I have a stream of data consisting of 3 columns, 1st column is birth date, 2nd is death date and third is weight for each individual. My ultimate goal is to be able to compute the correlation of weight between any combination of two death dates, grouped by birth dates. In order to do this, my plan is to be able to use a loop of some sorts to split the data into n vectors, each vector consists of all birth dates and weight for people who are dead on the same death date. Then figure out the standard deviation and covariance of each of the combination of the vectors, figure out the correlation and finally bind them into a matrix (or at least a 3 column table: death date1, death date 2, correlation). The only problem is I know how to implement this in SQL/Excel but not in R. Could someone please offer me some guidance on this? Thanks a lot! Hello Anyi, I suggest you take a look at the plyr package. It allows you to easily subset a data.frame and apply any function to that data.frame. HTH, ~Jason -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] functions sample() and S.SI()
On 2010.05.11 18:30:57, Lourdes Molera wrote: Hello, I need to select a sample from a small population using simple random sampling without replacement. I've found two possibilities in R, the function sample() and the function S.SI() in the package TeachingSampling, but I don't know which one is better. Can someone help me? Thank you Hello Lourdes, sample() is quite capable and is what I use for bootstrapping, etc. I am not familiar with S.SI(), but my guess is that it probably uses sample() under the hood. Though, it does appear that it returns some additional information that may be handy, depending on your needs. HTH, ~Jason -- Lourdes Molera Peris Métodos Cuantitativos para la Economía y la Empresa Facultad de Economía y Empresa Universidad de Murcia Campus de Espinardo 30100 Murcia __ 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. -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] Sata and R users GLM methods translation
Hello Jean-Baptiste, On 2010.01.22 16:32:53, Jean-Baptiste Combes wrote: Hello, I am learning R and I am fluent in Stata and I try to translate part of my Stata code to R to check the reliability of the data under R. I have a proportion variable as a dependent variable pQSfteHT . Independent variables are dummies for two categorical variables called dQSvacrateHTQuali3 and cluster_3. I am fitting a model with the Stata command below: glm pQSfteHT dQSvacrateHTQuali3_2 dQSvacrateHTQuali3_3 dQSvacrateHTQuali3_4 dQSvacrateHTQuali3_5 cluster_32 cluster_33 cluster_34, link(probit) family(binomial) robust and the same (I expect) model with R with the command below: nurse.model-glm(pQSfteHT~dQSvacrateHTQuali3_2 + dQSvacrateHTQuali3_3 + dQSvacrateHTQuali3_4 + dQSvacrateHTQuali3_5 + cluster_32 + cluster_33 + cluster_34 ,family=binomial(link = logit)) I found some differences in the parameters, could it come from the robust option in the Stata command? It sounds strange that a variance option would lead to changes in parameters estimation but I am not an econometrician. I noticed this same thing about a year ago when comparing STATA and R results (though, I was comparing simple linear models). It seems that, for whatever reason, STATA was reporting slight differences in the coefficients when applying robust. In R, on the other hand, one typically gets robust standard errors by applying, e.g., a sandwich estimator on the variance-covariance matrix of a model previously estimated. I am not sure what STATA is doing, and I haven't cared enough to check, but my understanding was also that the estimated coefficients should not have been affected by rubust (at least in the context of a strictly linear model). Cheers, ~Jason Is anyone bilingual in R and Stata and could have a look at the syntaxes above? Thank you in advance Thank you also to the people answering my previous enquiry. Jean-Baptiste -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] lattice, add text to xyplot
On 2010.01.08 19:44:39, Ivan Gregoretti wrote: Hello listers, Does anybody know how to add text to an xyplot without whipping out the existing curve? That's all. For instance, Lets say you generate a graph like this A - data.frame(x = rnorm(100), y = rnorm(100)) xyplot(y ~ x, data = A) How would you add 'Hello world'? I tried 6.02E23 different partial solutions found on the web and failed. I just need one EXAMPLE that WORKS. Unfortunately, library(lattice) ?panel.text shows no examples. As you see, I bring you a formidable challenge. A - data.frame(x = rnorm(100), y = rnorm(100)) xyplot(y ~ x, data = A, panel = function(...) { panel.text(0, 0, Hello world!) panel.xyplot(...) }) A whole lot of examples lattice are available here: http://lmdvr.r-forge.r-project.org/figures/figures.html If you plan on using lattice often, I highly recommend Deepayan Sarkar's book. Hope that helps, ~Jason Thank you, Ivan Ivan Gregoretti, PhD National Institute of Diabetes and Digestive and Kidney Diseases National Institutes of Health 5 Memorial Dr, Building 5, Room 205. Bethesda, MD 20892. USA. -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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 question
Hello, On 2009.12.20 18:06:17, MAL wrote: All! This piece of code: zzz1 - as.POSIXct(1999-03-18, tz=CET) zzz2 - as.POSIXlt(1999-03-18, tz=CET) zzz1 == zzz2 as.Date(zzz1) as.Date(zzz2) yields TRUE for zzz1==zzz2, but the two dates returned by as.Date are different: as.Date(zzz1) [1] 1999-03-17 as.Date(zzz2) [1] 1999-03-18 I'm using R 2.10.0. Would be glad for any clarifications. Thanks! I don't know why as.Date() is giving different results, but if look at the value of the variables, they are equal: zzz1 - as.POSIXct(1999-03-18, tz=CET) zzz2 - as.POSIXlt(1999-03-18, tz=CET) zzz1 == zzz2 [1] TRUE as.Date(zzz1) [1] 1999-03-17 as.Date(zzz2) [1] 1999-03-18 zzz1 [1] 1999-03-18 CET zzz2 [1] 1999-03-18 CET Maybe someone here can explain the behavior of as.Date(). Cheers, ~Jason -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] plotting polynomial regression line
Hello Amit, On 2009.12.20 19:35:09, Amit wrote: Dear All, I am trying to plot polynomial regression line to a scatterplot. I did following so far: x=c(1:9335) y=read.table(gp.txt,header=T,sep=\t) length(y$PCC) # y$PCC has values between 1 to 0 in decreasing order [1] 9335 plot(x,y$PCC,col=red) #scatterplot between x and y$PCC reg=lm(y$PCC~poly(x,6)) # calculating polynomial fit with degree 6 abline(reg,col=blue) Warning message: In abline(reg, col = blue) : only using the first two of 7regression coefficients After the above warning a line is drawn in the graph parallel to the y-axis. But I was expecting a curve line through the scatterplot. Am I doing something wrong? Please help! Take a look at ?predict. Briefly, I think this will give you what you want: reg - lm(y$PCC ~ poly(x,6)) plot(x, y$PCC, col=red) lines(x, predict(reg), col=blue) Cheers, Jason -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] Incorporating the results of White's HCCM into a linear regression:
On 2009.12.03 23:52:15, Yoseph Zuback wrote: Hi Frank, I'm trying to repair heteroscedastic variables using the hccm. A statistician in my department gave an incomplete solution that included: OLS1$coefficients/(sqrt(hccm(OLS1))) Trying to solve my problem I get different results with the method you gave me and what I am trying with the code above. Lost. As Frank mentioned, I think you'll need to be more specific as to what you are needing to do (e.g., what type of heteroskedasticity you are trying to correct for). If you simply need the error corrected standard errors produced by hccm (from the car package), you should do something like sqrt(diag(hccm(OLS1))), which will produce a vector of corrected standard errors for the covariates included in your model. You can then calculate t-values from there. But realize that there are 5 different versions of the correction included in hccm, which may produce slightly different results, especially in small samples. If you need to correct for other sources of heteroskedasticity, see Frank's rms package or sandwich. (And, as Frank says, please include your professional affiliation in your emails to the list, as is suggested in the posting guide.) HTH, ~Jason 2009/12/2 Frank E Harrell Jr f.harr...@vanderbilt.edu Yoseph, What do you mean by 'incorporate into'? If you mean to update the fit object's variance-covariance matrix, one approach might be require(rms) ols1 - ols(uer92 ~ ..., x=TRUE, y=TRUE) ols1 - robcov(ols1) anova(ols1); summary(ols1); ... # uses 'robust' variancescovariances You can substitute bootcov for robcov to use bootstrap estimates rather than Huber-White sandwich estimates. Note that coefficients are unchanged. Please provide your affiliation in e-mail postings. Frank Yoseph Zuback wrote: Using hccm() I got a heteroscedasticity correction factor on the diagonal of the return matrix, but I don't know how to incorporate this into my linear model: METHOD 1: OLS1 - lm(formula=uer92~uer+low2+mlo+spec+degree+hit) Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -0.0623377 0.0323461 -1.927 0.057217 . uer 0.2274742 0.0758720 2.998 0.003541 ** low2 0.0276404 0.0375770 0.736 0.463973 mlo 0.1491490 0.0940637 1.586 0.116455 spec-0.1139978 0.0312223 -3.651 0.000445 *** degree 0.0014694 0.0005316 2.764 0.006970 ** hit -0.0164365 0.0186028 -0.884 0.379376 hccm(OLS1) (Intercept) uer low2 mlo spec (Intercept) 9.057187e-04 -1.330377e-03 -3.486945e-05 2.184561e-04 -4.061445e-04 uer -1.330377e-03 5.471543e-03 3.513046e-04 -4.294427e-04 1.629196e-03 low2-3.486945e-05 3.513046e-04 1.378587e-03 1.241245e-04 -5.026434e-05 mlo 2.184561e-04 -4.294427e-04 1.241245e-04 9.796132e-03 -1.059611e-03 spec-4.061445e-04 1.629196e-03 -5.026434e-05 -1.059611e-03 9.777099e-04 degree 9.638288e-07 -2.907824e-05 -1.093692e-05 -1.867397e-05 -8.212461e-06 hit -3.299600e-04 -2.242984e-04 1.036364e-04 -8.158489e-04 3.994951e-05 degree hit (Intercept) 9.638288e-07 -3.299600e-04 uer -2.907824e-05 -2.242984e-04 low2-1.093692e-05 1.036364e-04 mlo -1.867397e-05 -8.158489e-04 spec-8.212461e-06 3.994951e-05 degree 3.485174e-07 4.256330e-06 hit 4.256330e-06 4.154505e-04 I have reached my limit of R knowledge, any help is appreciated. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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. -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] Data Manipulation Question
Please refrain from posting HTML. The results can be incomprehensible: On 2009.12.03 13:52:09, John Filben wrote: Can R support data manipulation programming that is available in the SAS datastep??? Specifically, can R support the following: -?? Read multiple dataset one record at a time and compare values from each; then base on if-then logic write to multiple output files -?? Load a lookup table and then process a different file; based on if-then logic, access and lookup values in the table -?? Support modular ???gosub???programming -?? Sort files -?? Date math and conversions -?? Would it be able to support the following type of logic: o Start Read Record from File 1 Read Record from File 2 Match ?? If Key 1 Key 2 and Key 1 Key 2, Write to output file A ?? If Key 1 = Key 2, Write to output file B ?? If Key 1 Key 2 and Key 1 Key 2, Write to output file C Goto Start until File 1 Done ??John Filben Cell Phone - 773.401.2822 Email - johnfil...@yahoo.com [[alternative HTML version deleted]] -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] R on Large Data Sets (again)
On 2009.11.28 21:50:09, Daniel Nordlund wrote: - Is a Unix-like platform a better option than win-64? Again, would this solve my memory limitation problems? Possibly, but Win64 should provide plenty of memory (I believe Windows 7 Ultimate can use up to 192 GB of memory). You just have to find the system that can take that much... With Unix/Linux you can probably cut back some overhead, and the memory management is most likely better, but unless you need to go over 192GB of memory, you don't necessarily have to move to a different platform. ~Jason Windows 64-bit can certainly handle large memory spaces, but unless something has changed recently it my understanding Revolution Computing's 64-bit is the only 64-bit version of R available for Windows (due to the unavailability of adequate open source compilers for 64-bit Windows). So 64-bit R will need to be Revolution's solution or a non-Windows platform. It appears that GNU does have a project that has had some success at compiling 64 bit Windows applications: http://mingw-w64.sourceforge.net/ Not sure if all of the pieces are there for an R build, though. -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] R on Large Data Sets (again)
On 2009.11.29 14:24:40, Prof Brian Ripley wrote: Windows 64-bit can certainly handle large memory spaces, but unless something has changed recently it my understanding Revolution Computing's 64-bit is the only 64-bit version of R available for Windows (due to the unavailability of adequate open source compilers for 64-bit Windows). So 64-bit R will need to be Revolution's solution or a non-Windows platform. Or use a commercial Windows compiler. It appears that GNU does have a project that has had some success at compiling 64 bit Windows applications: http://mingw-w64.sourceforge.net/ Well, some interesed people have a project to port GCC and binutils: as far as I am aware that is not an official GNU project. Not sure if all of the pieces are there for an R build, though. You are welcome to show us how to do it (on the R-devel list): several people have spent man months attempting this (including submitting many patches to that project), and the rw-FAQ did tell you do so in http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-can-I-compile-R-from-source_003f Not a chance :) I got away from Windows 10 years ago for exactly these reasons. I was just trying help point a poor guy in the right direction. -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] R on Large Data Sets (again)
Hello Lars, On 2009.11.28 18:53:09, Lars Bishop wrote: Dear R users, I?ve search the R site for help on this topic but it is hard to find a precise answer for my questions. Which are the best options to overcome the RAM memory limitation problems when using R on ?large? data sets (such as 2 or 3 million records)? I think you'll have to provide a more precise definition of large---are we talking 1 GB of records or 100 GB? Also, it would help to know what you are trying to do with the data. The documentation for the biglm and bigmemory packages may provide some help. - Is the free available version of R (as opposed to the one provided by REvolution Computing) compatible with a windows 64-bit machine? And if I increase the RAM memory enough on win-64, would this virtually solve my memory limitation problems? I'm not familiar enough with the commercial version of R, but I do believe it provides better support for parallelization, which may be of some help. I don't think, however, that this version will solve your problem. - Is a Unix-like platform a better option than win-64? Again, would this solve my memory limitation problems? Possibly, but Win64 should provide plenty of memory (I believe Windows 7 Ultimate can use up to 192 GB of memory). You just have to find the system that can take that much... With Unix/Linux you can probably cut back some overhead, and the memory management is most likely better, but unless you need to go over 192GB of memory, you don't necessarily have to move to a different platform. ~Jason -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] Multivariate problems . . . with 200 resposes variables and 1 explanatory variable
Please see the posting guide here: http://www.r-project.org/posting-guide.html In short, it would be helpful if you provided more information on your data and what the goal of your analysis is. However, to get you started, see the polr() function in the MASS package. Depending on your goal/data, that may help. ~Jason On 2009.11.25 16:55:13, ychu066 wrote: How should I analysis it in R all the resposes variables are ordinal from 0 to 10. and the explanatory variable is a factor ... -- View this message in context: http://old.nabble.com/Multivariate-problems-.-.-.-with-200-resposes-variables-and-1-explanatory-variable-tp26522912p26522912.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] linear mixed model question
Hello Wen: On 2009.09.06 10:49:03, Wen Huang wrote: Hello, I wanted to fit a linear mixed model to a data that is similar in terms of design to the 'Machines' data in 'nlme' package except that each worker (with triplicates) only operates one machine. I created a subset of observations from 'Machines' data such that it looks the same as the data I wanted to fit the model with (see code below). I fitted a model in which 'Machine' was a fixed effect and 'Worker' was random (intercept), which ran perfectly. Then I decided to complicate the model a little bit by fitting 'Worker' within 'Machine', which was saying variation among workers was nested within each machine. The model could be fitted by 'lme', but when I tried to get confidence intervals by 'intervals(fm2)' it gave me an error: Error in intervals.lme(fm2) : Cannot get confidence intervals on var-cov components: Non-positive definite approximate variance-covariance I am wondering if this is because it is impossible to fit a model like 'fm2' or there is some other reasons? The problem doesn't seem to be the model specification but is most likely the result of estimating a more complicated model with very little data. Using the complete Machines dataset with the same model specification seems to work fine: # - # fm3 - lme(score ~ Machine, random = ~ Machine - 1 | Worker, data = Machines) intervals(fm3) Approximate 95% confidence intervals Fixed effects: lower est.upper (Intercept) 48.972459 52.36 55.73865 MachineB 3.093747 7.97 12.83959 MachineC10.816607 13.916667 17.01673 attr(,label) [1] Fixed effects: Random Effects: Level: Worker lower est. upper sd(MachineA)2.1702468 4.0792807 7.6675752 sd(MachineB)4.6301082 8.6252908 16.0677975 sd(MachineC)2.3387870 4.3894795 8.2382579 cor(MachineA,MachineB) 0.1992744 0.8027499 0.9647702 cor(MachineA,MachineC) -0.1702480 0.6225047 0.9260744 cor(MachineB,MachineC) 0.1235115 0.7708309 0.9579666 Within-group standard error: lower est. upper 0.7629124 0.9615766 1.2119736 # - # With the restricted dataset, there are only 18 observations in 6 groups. This is probably too little data for the (restricted) maximum likelihood technique used by lme(). Hope that helps, ~Jason -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] run R codes every startup.
On 2009.08.16 15:59:15, milton ruser wrote: Dear all, how can I setup R(gui) to run some commands evertime R startup? cheers milton You'll want to read: help(Startup) HTH, ~Jason -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] lme funcion in R
On 2009.08.03 10:15:46, Hongwei Dong wrote: Hi, R users, I'm using the lme function in R to estimate a 2 level mixed effects model, in which the size of the subject groups are different. It turned out that It takes forever for R to converge. I also tried the same thing in SPSS and SPSS can give the results out within 20 minutes. Anyone can give me some advice on the lme function in R, especially why R does not converge? Thanks. Harry Hello Harry, As Chuck mentions, providing some more information on the model and the data you are using would be helpful. Also, be sure to compare the optimization methods used in SPSS to that used in R. You can change the optimization method in R if the default seems to be causing issues. See help(lmeControl) for numerous setting options. ~Jason -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] error ellipse
On 2009.06.20 16:04:21, Alexandru T Codilean wrote: Dear All, I have a data set with the following structure: [A], [a], [B], [b] where [A] and [B] are measurements and [a] and [b] are the associated uncertainties. I produce [B]/[A] vs. [A] plots in R and would like to show uncertainties as error ellipses (rather than error bars). Would this be relatively easy to do in R? I would appreciate any help on this Thanks a lot Tibi The car package has an Ellipses function that draws elliptical confidence intervals for estimated model parameters. It's not exactly what you want, but the code may help you create your own function. Cheers, ~Jason -- Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210 __ 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] Dummy (factor) based on a pair of variables
On 2009.04.18 13:52:35, Serguei Kaniovski wrote: Bernardo: this is not quite what I am looking for, Let the data be: y,i,j 1,AUT,BEL 2,AUT,GER 3,BEL,GER then the dummies sould look like: y,i,j,d_AUT,d_BEL,d_GER 1,AUT,BEL,1,1,0 2,AUT,GER,1,0,1 3,BEL,GER,0,1,1 I can generate the above dummies but can this design be imputed in a reg. model directly? Serguei Hello Serguei, I am sure there is a better way to do this, but the following seems to work: # Create sample data.frame() i - c(AUT, AUT, BEL) j - c(BEL, GER, GER) df - data.frame(i=i, j=j) # Create dummy vectors df$d.aut - ifelse(df$i==AUT|df$j==AUT, 1, 0) df$d.bel - ifelse(df$i==BEL|df$j==BEL, 1, 0) df$d.ger - ifelse(df$i==GER|df$j==GER, 1, 0) # Print results df HTH, ~Jason -- Jason W. Morgan Graduate Student, Political Science *The Ohio State University* __ 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] Dummy (factor) based on a pair of variables
On 2009.04.18 15:58:30, Jason Morgan wrote: On 2009.04.18 13:52:35, Serguei Kaniovski wrote: I can generate the above dummies but can this design be imputed in a reg. model directly? Oops, I apologize for not reading the whole question. Can you do the following: lm(y ~ I(ifelse(df$i==AUT|df$j==AUT, 1, 0)) + I(ifelse(df$i==BEL|df$j==BEL, 1, 0)) + I(ifelse(df$i==GER|df$j==GER, 1, 0)), data=df) If you exclude the ifelse(), you will get a vector of TRUE/FALSE, which may or may not work. ~Jason Hello Serguei, I am sure there is a better way to do this, but the following seems to work: # Create sample data.frame() i - c(AUT, AUT, BEL) j - c(BEL, GER, GER) df - data.frame(i=i, j=j) # Create dummy vectors df$d.aut - ifelse(df$i==AUT|df$j==AUT, 1, 0) df$d.bel - ifelse(df$i==BEL|df$j==BEL, 1, 0) df$d.ger - ifelse(df$i==GER|df$j==GER, 1, 0) # Print results df HTH, ~Jason -- Jason W. Morgan Graduate Student, Political Science *The Ohio State University* __ 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] The R Inferno
Excellent read, Patrick. A very useful and clear guide. On 2009.01.09 16:14:49, Patrick Burns wrote: The R Inferno is now on the Burns Statistics website at http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Abstract: If you are using R and you think you're in hell, this is a map for you. Also, I've expanded the outline concerning R on the Burns Statistics 'Links' page. Suggestions (off-list) for additional items are encouraged. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) __ 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. -- ~ Jason Morgan __ 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.