Re: [R] Obtaining predicted values for glm() function

2014-08-14 Thread Jeff Newmiller
Please don't repeat post. In fact, you should definitely read the Posting Guide mentioned at the bottom if this or any other post from the list and follow its advice. The usual way to predict output of a model in R is to use the predict function appropriate to your model object class. You might

[R] Obtaining predicted values for glm() function

2014-08-14 Thread DHIMAN BHADRA
Dear all. I am trying to relate daily deaths in a given city with air pollution values. The model I am using is as follows: model <- glm(deaths ~ pollution + ns(time, 13) + ns(temp, 7) + ns(rh, 5) + dow + holiday, family=quasipoisson, data=city) Where - deaths: daily number of deaths pollution:

Re: [R] Installation of R version 3.1.0

2014-08-14 Thread jwd
On Thu, 14 Aug 2014 12:15:58 -0400 VG wrote: > Hi Everyone, > I am currently using *R version 3.0.0 RC (2013-03-28 r62434) -- > "Masked Marvel"* > > I am using Ubuntu 10.04 LTS- the Lucid Lynx. > > I downloaded the tar.gz of R 3.1.0 under my Downloads folder. > I changed my directory to Downlo

Re: [R] identicalFiles(filename1, filename2)?

2014-08-14 Thread Prof Brian Ripley
On 14/08/2014 23:57, William Dunlap wrote: Is there a function in core R that takes 2 strings and returns TRUE if they refer to the same file? (If either does not refer to a file, I think it would be fine if it returned FALSE.) No, but equality for normalizePath() works well enough on most OSe

[R] Using Moran.I

2014-08-14 Thread Janet Choate
Dear R community, i am attempting to use Moran.I for the first time, and am not quite sure on the inputs needed i have loaded the ape library. i have a data frame that includes concentrations of nutrients (no3, nh4, po4) and the percentage of different land use types (urb, ag, ud, comm, sr, dp

[R] identicalFiles(filename1, filename2)?

2014-08-14 Thread William Dunlap
Is there a function in core R that takes 2 strings and returns TRUE if they refer to the same file? (If either does not refer to a file, I think it would be fine if it returned FALSE.) Compariing inode/device numbers on Unix-like systems and the output of normalizePath on Windows would probably d

[R] Coding up GAMMs for multi-site trends analysis.

2014-08-14 Thread Katarzyna Sawicka
Dear R users, I would like to ask you for help with coding up. I would like to recreate a method from a paper of Malcolm et al. (2014) (MALCOLM, I. A., GIBBINS, C. N., FRYER, R. J., KEAY, J., TETZLAFF, D. & SOULSBY, C. 2014. The influence of forestry on acidification and recovery: Insights from l

Re: [R] Sldf command returns negative value for date

2014-08-14 Thread Gabor Grothendieck
On Thu, Aug 14, 2014 at 3:47 PM, Sneha Bishnoi wrote: > Hi All! > > I am trying to increment date column of data frame so as to merge it with > another data frame using sqldf: > my query is : > merge<-sqldf("select m.* ,e.* from mdata as m left join event as e on > date(m.Datest,'+1 day')=e.Start"

Re: [R] Operating on the value from row i and row i+1

2014-08-14 Thread MacQueen, Don
You didnĀ¹t say why you want it to return 6 and 4 for times 4 and 12 respectively, so I made an assumption. On that basis, try this example: mydf <- data.frame(time=c(0,3,9), resp=c(5,6,4)) myint <- approx( mydf$time, mydf$resp, xout=c(6,12), method='constant', f=0, rule=2) It r

[R] Sldf command returns negative value for date

2014-08-14 Thread Sneha Bishnoi
Hi All! I am trying to increment date column of data frame so as to merge it with another data frame using sqldf: my query is : merge<-sqldf("select m.* ,e.* from mdata as m left join event as e on date(m.Datest,'+1 day')=e.Start") The query returns null for all columns related to event table. Wh

[R] Pollution-mortality prediction.

2014-08-14 Thread DHIMAN BHADRA
Dear all. I am trying to relate daily deaths in a given city with air pollution values. The model I am using is as follows: model <- glm(deaths ~ pollution + ns(time, 13) + ns(temp, 7) + ns(rh, 5) + dow + holiday, family=quasipoisson, data=city) Where - deaths: daily number of deaths pollution:

Re: [R] Operating on the value from row i and row i+1

2014-08-14 Thread Jeff Newmiller
So for part one it seems you already have your answer. For part two you should look at time series types like "zoo", with which you can merge NAs at the new times at which you want "interpolated" answers and use the na.locf function to fill in values.

Re: [R] Operating on the value from row i and row i+1

2014-08-14 Thread Bert Gunter
?findInterval -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Thu, Aug 14, 2014 at 9:39 AM, Jaiprasart, Pharavee (HSC) wrote: > Hi Bert, > > I should have

Re: [R] Prediction intervals (i.e. not CI of the fit) for monotonic loess curve using bootstrapping

2014-08-14 Thread David Winsemius
On Aug 14, 2014, at 9:06 AM, David Winsemius wrote: > > On Aug 14, 2014, at 7:17 AM, Jan Stanstrup wrote: > >> Thank you very much for this snippet! >> >> I used it on my data and indeed it does give intervals which appear quite >> realistic (script and data here >> https://github.com/stanst

Re: [R] Operating on the value from row i and row i+1

2014-08-14 Thread Jaiprasart, Pharavee (HSC)
Hi Bert, I should have phrased my question differently. I actually want to do two things. First is to make a step plot. The "s"/"S" is a typo on my part. The second is to write a script that when I ask the program for Response of time == 4, I want it to return "6", or if I ask for response of

Re: [R] Installation of R version 3.1.0

2014-08-14 Thread Prof Brian Ripley
On 14/08/2014 17:15, VG wrote: Hi Everyone, I am currently using *R version 3.0.0 RC (2013-03-28 r62434) -- "Masked Marvel"* I am using Ubuntu 10.04 LTS- the Lucid Lynx. I downloaded the tar.gz of R 3.1.0 under my Downloads folder. Why? 3.1.1 is current. I changed my directory to Download

Re: [R] How Can SVD Reconstruct a Matrix

2014-08-14 Thread Peter Langfelder
On Wed, Aug 13, 2014 at 11:57 PM, Peter Brady wrote: > Hi All, > > I've inherited some R code that I can't work out what they've done. It > appears to work and give sort of reasonable answers, I'm just trying to > work out why they've done what they have. I suspect that this is a > simple vector

Re: [R] How Can SVD Reconstruct a Matrix

2014-08-14 Thread Martyn Byng
Hi, The G matrix can be constructed from the SVD because GGt is square and symmetric, so the matrices of the left and right singular values (i.e. U and V) are the same. Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Pete

Re: [R] Operating on the value from row i and row i+1

2014-08-14 Thread Bert Gunter
Your query is a bit unclear, but I suspect ?plot and a **careful read** about types "s" and "S" therein would address your problem. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not

Re: [R] How Can SVD Reconstruct a Matrix

2014-08-14 Thread Richard M. Heiberger
This looks like a variant of the Woodbury formula http://en.wikipedia.org/wiki/Woodbury_matrix_identity On Thu, Aug 14, 2014 at 2:57 AM, Peter Brady wrote: > Hi All, > > I've inherited some R code that I can't work out what they've done. It > appears to work and give sort of reasonable answers,

[R] Installation of R version 3.1.0

2014-08-14 Thread VG
Hi Everyone, I am currently using *R version 3.0.0 RC (2013-03-28 r62434) -- "Masked Marvel"* I am using Ubuntu 10.04 LTS- the Lucid Lynx. I downloaded the tar.gz of R 3.1.0 under my Downloads folder. I changed my directory to Downloads folder and then used following commands to install the vers

Re: [R] Prediction intervals (i.e. not CI of the fit) for monotonic loess curve using bootstrapping

2014-08-14 Thread David Winsemius
On Aug 14, 2014, at 7:17 AM, Jan Stanstrup wrote: > Thank you very much for this snippet! > > I used it on my data and indeed it does give intervals which appear quite > realistic (script and data here > https://github.com/stanstrup/retpred_shiny/blob/master/retdb_admin/make_predictions_CI_tes

[R] How Can SVD Reconstruct a Matrix

2014-08-14 Thread Peter Brady
Hi All, I've inherited some R code that I can't work out what they've done. It appears to work and give sort of reasonable answers, I'm just trying to work out why they've done what they have. I suspect that this is a simple vector identity that I've just been staring at too long and have forgot

Re: [R] Prediction intervals (i.e. not CI of the fit) for monotonic loess curve using bootstrapping

2014-08-14 Thread Jan Stanstrup
Thank you very much for this snippet! I used it on my data and indeed it does give intervals which appear quite realistic (script and data here https://github.com/stanstrup/retpred_shiny/blob/master/retdb_admin/make_predictions_CI_tests.R). I also tried getting the intervals with predict.cobs b

[R] Operating on the value from row i and row i+1

2014-08-14 Thread Jaiprasart, Pharavee (HSC)
Hi all, I'd like to make a step plot of Time vs Response graph. This is the example of my data frame - the real data frame has more than a thousand rows. Time Duration of infusion Infusion RateResponse Subtype 0 3

Re: [R] populating matrix with binary variable after matching data from data frame

2014-08-14 Thread William Dunlap
This is what I got: > x1 <- data.frame(V1=c("K","D","K","M"), V2=c("L","A","M","A")) > X <- array(0, c(4,4), rep(list(LETTERS[1:4]), 2)) > f(X, x1, badEntryAction="omitRows") A B C D A 0 0 0 0 B 0 0 0 0 C 0 0 0 0 D 1 0 0 0 > table(lapply(x1, factor, levels=LETTERS[1:4])) V2 V1 A B C D A 0 0

Re: [R] populating matrix with binary variable after matching data from data frame

2014-08-14 Thread Adrian Johnson
Hi Bill, sorry for trouble. It did not work both solutions. Error in `[<-`(`*tmp*`, i, value = 1) : subscript out of bounds my x matrix is may not have items that x1 has. say x only has A,B, C, D , whereas x1 has K, L, M , A and D. However x1 does not have any relationship between B and C thu

Re: [R] New reshape2 question

2014-08-14 Thread Jeff Newmiller
You shouldn't need to worry about your system clock (time) for analyzing time data from files, but only your system timezone. The default value of TZ leads to assuming system timezone... setting it explicitly changes the assumed timezone for the purposes of the current instance of R. I prefer

[R] New reshape2 question answered

2014-08-14 Thread Neotropical bat risk assessments
Hi all, Thanks all who replied. Arun, Jim and Jeff. Seems like there are always multiple ways to achieve the same goals with R! Jim Holtman suggested using the base functions. Not PLYR or RESHAPE x <- read.table(text = "Species Location Date Time... Myochi Chena 5/26/09 18:38 remain

Re: [R] scale_*_manual in ggplot2

2014-08-14 Thread Jeff Newmiller
There is a difference between specifying a scale inside the aes or aes_string functions, and doing it in the arguments to the geom function. Inside the aes function call it creates a mapping from your input data to the layer variables, and you do not want to specify strings such as "Cusum" but