Re: [R] Code works on Mac but not Windows
Dear Glenn, Please keep the mailing list in cc. In this case I would drop the "signature" like values and use correct defaults. TermStructure <- function(rates.data, method = "ns") you can drop if(missing(method)) method = "ns" in that case. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-05-12 13:43 GMT+02:00 Glenn Schultz : > Hi Thierry, > Thanks, I see what you are saying. I should alter the code to test for > values, correct? > > Glenn > > Sent from my iPhone > > On May 12, 2015, at 2:40 AM, Thierry Onkelinx > wrote: > > Dear Glenn, > > I think that you are confusing the signature of a method and the default > values of of function. It looks like you want the signature(rates.data = > "character", method = "character"). But you are setting "character" as > default value of both function arguments. Since you define a default value > for methods, it will not be missing when you omit is from the call. > > Best regards, > > ir. Thierry Onkelinx > Instituut voor natuur- en bosonderzoek / Research Institute for Nature and > Forest > team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance > Kliniekstraat 25 > 1070 Anderlecht > Belgium > > To call in the statistician after the experiment is done may be no more > than asking him to perform a post-mortem examination: he may be able to say > what the experiment died of. ~ Sir Ronald Aylmer Fisher > The plural of anecdote is not data. ~ Roger Brinner > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > 2015-05-11 17:36 GMT+02:00 Glenn Schultz : > >> Hi Thierry, >> >> Below is the function >> setMethod("initialize", signature("TermStructure"), function(.Object,..., >> tradedate = "character", period = "numeric", date = "character", spotrate >> = "numeric", forwardrate = "numeric", TwoYearFwd = "numeric", TenYearFwd >> = "numeric") { .Object@tradedate = tradedate .Object@period = period . >> Object@date = date .Object@spotrate = spotrate .Object@forwardrate = >> forwardrate .Object@TwoYearFwd = TwoYearFwd .Object@TenYearFwd = >> TenYearFwd return(.Object) callNextMethod(.Object,...) })#' The >> TermStructure constructor function it is a wrapper function around the >> package termstrc#' #' This is a wrapper function around the R package >> termstrc. The function passes swap rate data#' cash flows the to >> termstrc and creates the TermStructure object used by Bondlab.#' The >> function call rates data processes the yield curve and derives cashflow#' >> for the daily close swap curve. A Rates object must be called in the local#' >> environment for this function to work.#' @param rates.data A character >> string representing the data for which the user#' would like to call the >> swap curve#' @param method A character string indicating the fitting >> method ns = Nelson Siegel, dl = Diebold Lee,#' sv = Severson, asv = >> adjusted Severson, cs = cubic spline (not yet implemented in Bond Lab).#' >> For addiition details see the termstrc documentation.#' @examples#' >> \dontrun{#' TermStructure(rates.data = "01-10-2013", method = "ns")}#' >> @importFrom lubridate %m+%#' @importFrom lubridate years#' @importFrom >> lubridate day#' @importFrom lubridate month#' @importFrom termstrc >> estim_nss estim_cs spotrates forwardrates#'@export TermStructure >> TermStructure <- function(rates.data = "character", method = "character" >> ){ #function(trade.date = "character", method = "character") #Error Trap >> User inputs to the function if(missing(rates.data)) stop("missing rates >> data object") # this is the code snippet that works in MAC but not >> windows *#Default to Nelson-Siegel** if(missing(method)) method = "ns"* >> #Default >> to parametric if(method == "cs") stop("cubic spline not implemented") #Check >> that the user input a valid method CheckMethod <- c("ns", "dl", "sv", " >> asv", "cs") if(!method %in% CheckMethod) stop ("Invalid 'method' Value") # >> pass the yield curve to the function rates.data <- rates.data #set the >> column counter to make cashflows for termstrucutre ColCount <- >> as.numeric(ncol(rates.data)) Mat.Years <- as.numeric(rates.data[2,2: >> ColCount]) Coupon.Rate <- as.numeric(rates.data[1,2:ColCount]) Issue.Date >> <- as.Date(rates.data[1,1]) #initialize coupon bonds S3 class #This can >> be upgraded when bondlab has
[R] Residual Plots
HI All, I Am creating a residual plot for my linear model. the code I created is : plot(eval$bty_avg,residuals,ylab="residuals", xlab="Score", main = "Residual Analysis")Here data set is eval. eval$bty_avg is my response variable and residual is the var I have created using resid function to store the residuals. syntax used is : residuals<- resid(m_bty) However when I run the syntax I receive the following error message:- Error in eval$bty_avg : object of type 'closure' is not subsettable Please suggest. -- View this message in context: http://r.789695.n4.nabble.com/Residual-Plots-tp4707138.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] geom_text in ggplot (position)
This problem is discussed in Winston Chang's R Graphics Handbook, section 3.9. Adapting his code to this example: test <- data.frame(variables = c("PE_35", "PE_49"), value1=c(13,3), value2=c(75,31), value3=c(7,17), value4 =c(5,49)) library(reshape2) library(ggplot2) library(plyr) m <- melt(test, "variables") m$cO <- gl(2, 2, length = nrow(m), labels = c("A", "B")) m$cat <- gl(2, 4, labels = c(0, 1)) names(m)[3] <- "recuento" mm <- ddply(m, .(variables, cat), mutate, pos = cumsum(recuento) - 0.5 * recuento) ## this is the key part ggplot(mm, aes(x = cat, y = recuento, fill = cO)) + geom_bar(stat = "identity") + geom_text(aes(y = pos, label = recuento)) + facet_wrap(~ variables) Dennis On Tue, May 12, 2015 at 9:50 AM, AURORA GONZALEZ VIDAL wrote: > Hello everybody. > > I have an "esthetic" question. I have managed to create a stacked and > grouped bar plot but I don't manage with putting the text in the middle of > the bar plots. Do you know how to write the numbers in that position? > > Thank you so much. > > Example code: > > test <- data.frame(variables = c("PE_35", "PE_49"), > value1=c(13,3), > value2=c(75,31), > value3=c(7,17), > value4 =c(5,49)) > > library(reshape2) # for melt > > melted <- melt(test, "variables") > melted$cO <- c("A","A","B","B","A","A","B","B") > > melted$cat <- '' > melted[melted$variable == 'value1' | melted$variable == 'value2',]$cat <- > "0" > melted[melted$variable == 'value3' | melted$variable == 'value4',]$cat <- > "1" > > names(melted)[3] <- "recuento" > > library(ggplot2) > > ggplot(melted, aes(x = cat, y = recuento,ymax=max(recuento)*1.05, fill = > cO)) + > geom_bar(stat = 'identity', position = 'stack', col="black") + > facet_grid(~ variables)+ > geom_text(aes(label = recuento), size = 5, hjust = 0.5, vjust = 1, > position ="stack") > > > -- > Aurora González Vidal > > Sección Apoyo Estadístico. > Servicio de Apoyo a la Investigación (SAI). > Vicerrectorado de Investigación. > Universidad de Murcia > Edif. SACE . Campus de Espinardo. > 30100 Murcia > > @. aurora.gonzal...@um.es > T. 868 88 7315 > F. 868 88 7302 > www.um.es/sai > www.um.es/ae > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Residual Plots
Hi Shivi82, The error message suggests that "eval$bty_avg" is a function. What does: str(eval) say about its components? Jim On Wed, May 13, 2015 at 7:33 PM, Shivi82 wrote: > HI All, > I Am creating a residual plot for my linear model. > the code I created is : plot(eval$bty_avg,residuals,ylab="residuals", > xlab="Score", main = "Residual Analysis")Here data set is eval. eval$bty_avg > is my response variable and residual is the var I have created using resid > function to store the residuals. > syntax used is : residuals<- resid(m_bty) > > However when I run the syntax I receive the following error message:- > Error in eval$bty_avg : object of type 'closure' is not subsettable > > Please suggest. > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Residual-Plots-tp4707138.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Mean rain per rain day
Hi Frederic, It looks like you have a number of daily rainfall values and you want to get the mean rainfall on days where there was some rain. What you probably want is: daily_rainfall<-rpois(50,2) mean(daily_rainfall[daily_rainfall>0]) You may have to add na.rm=TRUE if there are NAs in your data. Jim On Wed, May 13, 2015 at 4:38 PM, Frederic Ntirenganya wrote: > Hi All, > > I want to compute Mean rain per rain day from rainfall data but i don't > know how to go about that. Anyone who understand the approach I can use can > help me. In addition, I would like to have RScript which can help me to > compute it. thanks. > > Regards, > Frederic. > > Frederic Ntirenganya > Maseno University, > African Maths Initiative, > Kenya. > Mobile:(+254)718492836 > Email: fr...@aims.ac.za > https://sites.google.com/a/aims.ac.za/fredo/ > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
r-help@r-project.org
Hi nusrat, The ifelse function returns the number of values that result from the logical expression in the first argument. If you use &&, you get one logical value. If you use & you get logical values for the number of conditionals that you specify. For example: 1:10 > 0 && 1:10 < 11:20 [1] TRUE 1:10 > 0 & 1:10 < 11:20 [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE And for your sake and our's, get a real computer. Jim On Wed, May 13, 2015 at 2:41 AM, nusrat ullah wrote: > Ip, g ftehgytreehjjjijiputv > > Sent from my iPadgypyrrytutytytfedewaqyŷiijj > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with pedigree() function in kinship2
Your problem is that PatientID, FatherID, MotherID are factors. The authors of kinship2 (myself and Jason) simply never thought of someone doing this. Yes, that is an oversight. We will correct it by adding some more checks and balances. For now, turn your id variables into character or numeric. Terry Therneau On 05/13/2015 05:00 AM, r-help-requ...@r-project.org wrote: Dear R-help, I am interested in plotting some pedigrees and came across the kinship2 package. What follows is an example of the pedigrees I am working with Now, when running ## check package availability if(!require(kinship2)) install.packages('kinship2') require(kinship2) ## data to plot d <- structure(list(FamilyID = c("1", "1", "1", "1", "1", "1", "1", "1", "1"), PatientID = structure(c(2L, 3L, 5L, 11L, 12L, 15L, 16L, 17L, 6L), .Label = c(" 1", " 2", " 3", " 4", " 5", " 6", " 7", " 9", "10", "11", "13", "14", "18", "20", "23", "24", "25", "27", "28", "29", "30", "31", "33", "34", "35", "37", "38", "39", "41", "43", "45", "50", "62", "63", "64", "65", "66", "67", "85", "88"), class = "factor"), FatherID = structure(c(1L, 1L, 6L, 1L, 5L, 6L, 1L, 7L, 6L), .Label = c("0", "1", "10", "11", "13", "2", "23", "27", "28", "3", "33", "34", "35", "38", "5", "62", "64", "66", "9"), class = "factor"), MotherID = structure(c(1L, 1L, 7L, 1L, 14L, 7L, 1L, 5L, 7L), .Label = c("0", "10", "18", "2", "24", "29", "3", "30", "33", "34", "39", "4", "43", "5", "6", "63", "65", "9"), class = "factor"), Sex = structure(c(2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L), .Label = c("Female", "Male"), class = "factor"), AffectionStatus = structure(c(1L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 2L), .Label = c("1", "2"), class = "factor")), .Names = c("FamilyID", "PatientID", "FatherID", "MotherID", "Sex", "AffectionStatus" ), row.names = c(NA, 9L), class = "data.frame") ## plotting ped <- with(d, pedigree(PatientID, FatherID, MotherID, Sex, affected = AffectionStatus, famid = FamilyID)) ## Error in pedigree(PatientID, FatherID, MotherID, Sex, affected = AffectionStatus, : ##Value of 'dadid' not found in the id list 1/0 1/0 1/2 1/0 1/2 I get an error. My sessionInfo() is at the end. I was wondering if someone could help me to dissect what the cause of this error is and how it can be fixed. Thank you very much for your help. Best regards, Jorge Velez.- __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lmList Error in !unlist(lapply(coefs, is.null))
I have a dataframe with the following structure: 'data.frame': 13095 obs. of 1433 variables: $ my : Factor w/ 624 levels "19631","19632",..: 1 1 1 1 1 1 1 1 1 1 ... $ s1 : num NA NA NA NA NA NA NA NA NA NA ... Where my is a factor with the number of the month, s1,..,,s1426 vectors that contain my dependent variable, f1,..,f6 vectors that contain my indepent variables. S1 is a vector with many NA observations. I want to regress s1 on f1,...,f6. To make the regression, I used the following code: try1 <- lmList(s1 ~ f1+f2+f3+f4+f5+f6 |my , data=d1) try1 And I received the following output: Call: lmList(formula = s1 ~ f1 + f2 + f3 + f4 + f5 + f6 | my, data = d1) Coefficients: Error in !unlist(lapply(coefs, is.null)) : invalid argument type I tried to change na.action to na.omit but I have the same output. I tried to create a new dataframe with: d2<-data.frame(d1$my,d1$s1,d1$f1,d1$f2,d1$f3,d1$f4,d1$f5,d1$f6) colnames(d2)<-c("my", "s1", "f1", "f2", "f3", "f4", "f5", "f6") d2 has the following structure: 'data.frame': 13095 obs. of 8 variables: $ my: Factor w/ 624 levels "19631","19632",..: 1 1 1 1 1 1 1 1 1 1 ... $ s1: num NA NA NA NA NA NA NA NA NA NA ... $ f1: num -0.54 1.66 0.68 0.06 0.9 -0.16 0.19 0.25 0.57 -0.1 ... $ f2: num 0.94 0.98 0.63 0.32 -0.03 0.11 0.2 -0.03 0.07 0.01 ... $ f3: num 0.31 -0.25 0.02 0.29 0.22 0.07 -0.09 -0.17 0.21 0.28 ... $ f4: num 1.5 1.7 1.14 -0.02 0.36 0.49 -0.13 0.18 0.14 0.47 ... $ f5: num -0.5 -1.96 -0.66 -0.17 -0.43 0.24 -0.12 -0.01 -0.58 0.52 ... $ f6: num 0.38 0.3 0.35 0.3 0.08 0.13 -0.18 -0.05 -0.08 0.03 ... When I run the regression: try2<-lmList(s1~f1+f2+f3+f4+f5+f6|my,data=d2) try2, It works without any problem. How can I solve the problem? I need to run a regression for every s, so I can't just create a new dataframe every time. I read the documentation of lmList and also this site but I didn't find anything related at the size of the dataframe, so I don't think that the problem depends from the size of d1, but for all the other things the two dataframe are equivalent. I also tried to create an example but when I build a new dataframe, also with many NA like my file, I don't have these problems (i.e. lmList works fine). [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Count
Hello Team, I have data like this have Small doubts on the following calculation For example, Employee sizeCamp 1camp 2 Camp 3 11 0 0 20 0 1 311 0 100 1 2 10 0 for employee size columns values are repeated and its not uniqe id so i want to find that how many zero's are there in 1st id and 2nd id? for example for employee size(1st row) 1=0+0 (4th row) 1=0+0 here totally 4 zero,s i want results like this [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help regarding multi-page web application
Hello, I am using shiny package to develop web application but got stuck while creating multi-page web application. I googled my problem but did not get proper help. I just found R is not supporting multi-page web application but it was to old question. *Is R supports multi-page web application development?* *If yes please guide me how and which package to use?* Looking forward to hear from you soon. Thank you. Regards, *Rehman Zafar (R programmer)* [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] rminer package
Hello, I googled and looked on r-bloggers website for how to plot several REC curves (rminer package) on the same plotting area but couldn't find anything useful. I want to compare several regression (not logic regression and not classification) predictive models analyzing the REC curves and the error rates. Could you please tell me how it can be done? Thank you, Nick [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Count
Hi, On Wed, May 13, 2015 at 5:58 AM, venkadesan venky wrote: > Hello Team, > > I have data like this > > have Small doubts on the following calculation > > > For example, > > Employee sizeCamp 1camp 2 Camp 3 > > 11 0 0 > > 20 0 1 > > 311 0 > > 100 1 > > 2 10 0 Using dput() is easier for everyone else than just pasting your data in. > for employee size columns values are repeated and its not uniqe id so i > want to find that how many zero's are there in 1st id and 2nd id? > > for example for employee size(1st row) 1=0+0 > > (4th row) 1=0+0 > > here totally 4 zero,s i want results like this I'm not at all sure I understand what you're asking, but what about: testdata <- data.frame(EmpSize = c(1,2,3,1,2), Camp1 = c(1,0,1,0,1), Camp2 = c(0,0,1,0,0), Camp3 = c(0,1,0,1,0)) aggregate(rowSums(testdata[, -1] == 0), list(testdata$EmpSize), FUN="sum") -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Code works on Mac but not Windows
Yes > bar <- function(y = "12345"){ + message(y) + } > foo <- function(x = "a", y = "b"){ + bar(y = y) + } > bar() 12345 > bar(y = "abc") abc > foo() b > foo(y = "xyz") xyz ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-05-13 17:43 GMT+02:00 Glenn Schultz : > Hi Thierry, > > Last question I promise. This function is often embedded in other > functions which call various analytic functions for mortgage backed > securities like total return etc. If I understand you correctly the > default is set in the TermStructure function. This is the first software > package I have built so sometimes my understanding is incomplete due to a > lack of experience. If I provide "ns" default in the function and the user > chooses an alternative such as "cs" will that flow to method? > > for example: > PassThroughAnalytic(bond.id = foo, tradedate= foo, method = cs, price){ > bond.id <- MBS(bond.id = bond.id) > rates.data <- rate(trade.date = foo) > TermStrucuture <- TermStructure(rate.data = rates.data, method = method) > *#if I understand correctly the method = "cs" will override the default > value "ns" in TermStructure * > MtgCashFlow <- MortgageCashFlow(bond.id = bond.id, tradedate = tradedate, > price = price) > KeyRate <- MtgKeyRate(trade.date = trade.date, MtgCashFlow = MtgCashFlow} > > Thanks, > Glenn > > > > On May 13, 2015, at 02:53 AM, Thierry Onkelinx > wrote: > > Dear Glenn, > > Please keep the mailing list in cc. > > In this case I would drop the "signature" like values and use correct > defaults. > > TermStructure <- function(rates.data, method = "ns") > > you can drop if(missing(method)) method = "ns" in that case. > > Best regards, > > ir. Thierry Onkelinx > Instituut voor natuur- en bosonderzoek / Research Institute for Nature and > Forest > team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance > Kliniekstraat 25 > 1070 Anderlecht > Belgium > > To call in the statistician after the experiment is done may be no more > than asking him to perform a post-mortem examination: he may be able to say > what the experiment died of. ~ Sir Ronald Aylmer Fisher > The plural of anecdote is not data. ~ Roger Brinner > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > 2015-05-12 13:43 GMT+02:00 Glenn Schultz : > >> Hi Thierry, >> Thanks, I see what you are saying. I should alter the code to test for >> values, correct? >> >> Glenn >> >> Sent from my iPhone >> >> On May 12, 2015, at 2:40 AM, Thierry Onkelinx >> wrote: >> >> Dear Glenn, >> >> I think that you are confusing the signature of a method and the default >> values of of function. It looks like you want the signature(rates.data = >> "character", method = "character"). But you are setting "character" as >> default value of both function arguments. Since you define a default value >> for methods, it will not be missing when you omit is from the call. >> >> Best regards, >> >> ir. Thierry Onkelinx >> Instituut voor natuur- en bosonderzoek / Research Institute for Nature >> and Forest >> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance >> Kliniekstraat 25 >> 1070 Anderlecht >> Belgium >> >> To call in the statistician after the experiment is done may be no more >> than asking him to perform a post-mortem examination: he may be able to say >> what the experiment died of. ~ Sir Ronald Aylmer Fisher >> The plural of anecdote is not data. ~ Roger Brinner >> The combination of some data and an aching desire for an answer does not >> ensure that a reasonable answer can be extracted from a given body of data. >> ~ John Tukey >> >> 2015-05-11 17:36 GMT+02:00 Glenn Schultz : >> >>> Hi Thierry, >>> >>> Below is the function >>> setMethod("initialize", signature("TermStructure"), function(.Object, >>> ..., tradedate = "character", period = "numeric", date = "character", >>> spotrate = "numeric", forwardrate = "numeric", TwoYearFwd = "numeric", >>> TenYearFwd = "numeric") { .Object@tradedate = tradedate .Object@period = >>> period .Object@date = date .Object@spotrate = spotrate .Object@ >>> forwardrate = forwardrate .Object@TwoYearFwd = TwoYearFwd .Object@ >>> TenYearFwd = TenYearFwd return(.Object) callNextMethod(.Object,...) }) >>> #' The TermStructure constructor function it is a wrapper function >>> around the package termstrc
Re: [R] Residual Plots
This example might help: tmp <- data.frame(x=1:10, y=rnorm(10)) foo <- lm(y~x, data=tmp) plot(tmp$x, residuals(foo)) It appears that eval$bty_avg is not what you think it is. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 5/13/15, 2:33 AM, "Shivi82" wrote: >HI All, >I Am creating a residual plot for my linear model. >the code I created is : plot(eval$bty_avg,residuals,ylab="residuals", >xlab="Score", main = "Residual Analysis")Here data set is eval. >eval$bty_avg >is my response variable and residual is the var I have created using >resid >function to store the residuals. >syntax used is : residuals<- resid(m_bty) > >However when I run the syntax I receive the following error message:- >Error in eval$bty_avg : object of type 'closure' is not subsettable > >Please suggest. > > > >-- >View this message in context: >http://r.789695.n4.nabble.com/Residual-Plots-tp4707138.html >Sent from the R help mailing list archive at Nabble.com. > >__ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fw: Downloading R
Hmmm. Follow the instructions at http://www.r-project.org/ After choosing a mirror, you will reach a page that says, in part: partial quote Source Code for all Platforms Windows and Mac users most likely want to download the precompiled binaries listed in the upper box, not the source code. The sources have to be compiled before you can use them. If you do not know what this means, you probably do not want to do it! The latest release (2015-04-16, Full of Ingredients) R-3.2.0.tar.gz, read what's new in the latest version. end partial quote Then click the link labeled "R-3.2.0.tar.gz" -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 5/11/15, 6:41 PM, "e.robin...@pnc.com" wrote: >> My name is Erick Robinson and I am a SAS administrator at PNC >> Bank. I have been tasked with installing R on two of our SAS servers, >> but am having trouble downloading the source. I have little background >> in UNIX (our servers run On Solaris under Unix) and cannot get to the >> site to download. I clicked on the link in red and it took me to the >> green arrow without any options to download. I was going to download to >> Windows and then FTP to the server. What is the best way to download >the source to our solaris server? Thanks > >Erick Robinson >Software Engineer Lead >Retail MIS SAS Support > >PNC Technology and Operations >23000 Mill Creek Blv. >Hignland Hills, Oh 44122 >440-342-3100 >e.robin...@pnc.com > > > > >- Forwarded by Erick Robinson/TPS/CLE/PNC on 05/11/2015 09:39 PM - > >From: Duncan Murdoch >To: e.robin...@pnc.com, r-wind...@r-project.org, >Date: 05/11/2015 02:52 PM >Subject:Re: Downloading R > > > >On 11/05/2015 2:37 PM, e.robin...@pnc.com wrote: >> Hello, >> >> My name is Erick Robinson and I am a SAS administrator at PNC >> Bank. I have been tasked with installing R on two of our SAS servers, >> but am having trouble downloading the source. I have little background >> in UNIX (our servers run On Solaris under Unix) and cannot get to the >> site to download. I clicked on the link in red and it took me to the >> green arrow without any options to download. I was going to download to >> Windows and then FTP to the server > >It is much easier to install from a tarball, not from the Subversion >repository. But more importantly, you're writing to the wrong place. >If my hint is not sufficient, please write to R-help, not to R-windows. > This is the development list for the Windows version, not a general >support list. > >Duncan Murdoch > >> >> >> >> >> >> >> >> Erick Robinson >> Software Engineer Lead >> Retail MIS SAS Support >> >> *PNC Technology and Operations* >> 23000 Mill Creek Blv. >> Hignland Hills, Oh 44122 >> 440-342-3100 >> e.robin...@pnc.com >> >> >> >> >> >> The contents of this email are the property of PNC. If it was not >> addressed to you, you have no legal right to read it. If you think you >> received it in error, please notify the sender. Do not forward or copy >> without permission of the sender. This message may be considered a >> commercial electronic message under Canadian law or this message may >> contain an advertisement of a product or service and thus may constitute >> a commercial electronic mail message under US law. You may unsubscribe >> at any time from receiving commercial electronic messages from PNC at >> http://pages.e.pnc.com/globalunsub/ >> PNC, 249 Fifth Avenue, Pittsburgh, PA 15222; pnc.com >> > > > >The contents of this email are the property of PNC. If it was not >addressed to you, you have no legal right to read it. If you think you >received it in error, please notify the sender. Do not forward or copy >without permission of the sender. This message may be considered a >commercial electronic message under Canadian law or this message may >contain an advertisement of a product or service and thus may constitute >a commercial electronic mail message under US law. You may unsubscribe at >any time from receiving commercial electronic messages from PNC at >http://pages.e.pnc.com/globalunsub/ >PNC, 249 Fifth Avenue, Pittsburgh, PA 15222; pnc.com > > > > [[alternative HTML version deleted]] > >__ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] binding two lists of lists of dataframes together
Hi David, I tried both solutions you provided(lapply(dlist, function(x) rbind(x,x) ) & Map( rbind, smaller, smaller)) and they seem to transpose and reshape the data into a different structure. Whenever I added the str - I only get a NULL. > You basically want a list of the same general structure as list1 where all > the elements in list two at the same position and depth have been > concatenated? Yes - that sounds exactly right. I've created new input(list1,list2) and desired output(list3) examples below. I hope this makes the request a lot clearer. Not sure if this helpful, but I found this bit of script and it keeps V1,V2,V3 separate and keeps each set of observations as vectors, but it doesn't concatenate the v1 observations with v2 observations together. sample.list <- list(list1,list2) library(data.table) nr <- nrow(sample.list[[1]]) fastbind.ith.rows <- function(i) rbindlist(lapply(sample.list, "[", i, TRUE)) fastbound <- lapply(1:nr, fastbind.ith.rows) Link: http://stackoverflow.com/questions/4863341/fast-vectorized-merge-of-list-of-data-frames-by-row Thank you again! Vince Please find below the structure for list1, list2, and the desired output list3: list1<-structure(list( V1 = list(c(15L, 19L, 28L, 9L, 17L, 3L, 11L, 21L,7L, 8L, 11L, 13L), c(1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), c(NaN,NaN, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), structure(c(7L, 11L, 21L, 29L, 9L, 23L, 3L, 14L, 27L, 28L, 3L, 5L), .Label = c("ID1", "ID10", "ID11", "ID12", "ID13", "ID14", "ID15", "ID16", "ID17", "ID18", "ID19", "ID2", "ID20", "ID21", "ID22", "ID23", "ID24", "ID25", "ID26", "ID27", "ID28", "ID29", "ID3", "ID4", "ID5", "ID6", "ID7", "ID8", "ID9"), class = "factor"), structure(c(7L, 11L, 21L, 29L, 9L, 23L, 3L, 14L, 27L, 28L, 3L, 5L), .Label = c("Issuer1", "Issuer10", "Issuer11", "Issuer12", "Issuer13", "Issuer14", "Issuer15", "Issuer16", "Issuer17", "Issuer18", "Issuer19", "Issuer2", "Issuer20", "Issuer21", "Issuer22", "Issuer23", "Issuer24", "Issuer25", "Issuer26", "Issuer27", "Issuer28", "Issuer29", "Issuer3", "Issuer4", "Issuer5", "Issuer6", "Issuer7", "Issuer8", "Issuer9"), class = "factor"), c(99.5, 95.5, 99.5, 100, 98.5, 99.646, 99.833, 98, 99.75, 100, 99.833, 98.563), c(0.4, 0.55, 0.4, 0.4, 0.5, 0.45, 0.4, 0.45, 0.6, 0.4, 0.4, 0.4)), V2 = list(c(10L, 29L, 5L, 19L, 28L, 3L, 10L, 12L, 1L, 21L, 23L, 25L), c(1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), c(NaN, NaN, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), structure(c(2L, 22L, 25L, 11L, 21L, 23L, 2L, 4L, 1L, 14L, 16L, 18L), .Label = c("ID1", "ID10", "ID11", "ID12", "ID13", "ID14", "ID15", "ID16", "ID17", "ID18", "ID19", "ID2", "ID20", "ID21", "ID22", "ID23", "ID24", "ID25", "ID26", "ID27", "ID28", "ID29", "ID3", "ID4", "ID5", "ID6", "ID7", "ID8", "ID9"), class = "factor"), structure(c(2L, 22L, 25L, 11L, 21L, 23L, 2L, 4L, 1L, 14L, 16L, 18L), .Label = c("Issuer1", "Issuer10", "Issuer11", "Issuer12", "Issuer13", "Issuer14", "Issuer15", "Issuer16", "Issuer17", "Issuer18", "Issuer19", "Issuer2", "Issuer20", "Issuer21", "Issuer22", "Issuer23", "Issuer24", "Issuer25", "Issuer26", "Issuer27", "Issuer28", "Issuer29", "Issuer3", "Issuer4", "Issuer5", "Issuer6", "Issuer7", "Issuer8", "Issuer9"), class = "factor") , c(98.5, 100.25, 99, 95.5, 99.5, 99.646, 98.5, 94.75, 98.75, 98, 99, 99.388), c(0.6, 0.4, 0.45, 0.55, 0.4, 0.45, 0.6, 0.55, 0.5, 0.45, 0.55, 0.4)), V3 = list(c(21L, 28L, 3L, 7L, 25L, 25L, 15L, 13L, 3L, 20L, 16L, 18L), c(1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), c(NaN, NaN, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), structure(c(14L, 21L, 23L, 27L, 18L, 18L, 7L, 5L, 23L, 13L, 8L, 10L), .Label = c("ID1", "ID10", "ID11", "ID12", "ID13", "ID14", "ID15", "ID16", "ID17", "ID18", "ID19", "ID2", "ID20", "ID21", "ID22", "ID23", "ID24", "ID25", "ID26", "ID27", "ID28", "ID29", "ID3", "ID4", "ID5", "ID6", "ID7", "ID8", "ID9"), class = "factor"), structure(c(14L, 21L, 23L, 27L, 18L, 18L, 7L, 5L, 23L, 13L, 8L, 10L), .Label = c("Issuer1", "Issuer10", "Issuer11", "Issuer12", "Issuer13", "Issuer14", "Issuer15", "Issuer16", "Issuer17", "Issuer18", "Issuer19", "Issuer2", "Issuer20", "Issuer21", "Issuer22", "Issuer23", "Issuer24", "Issuer25", "Issuer26", "Issuer27", "Issuer28", "Issuer29", "Issuer3", "Issuer4", "Issuer5", "Issuer6", "Issuer7", "Issuer8", "Issuer9"), class = "factor"), c(98, 99.5, 99.646, 99.75, 99.388, 99.388, 99.5, 98.563, 99.646, 98, 99.563, 100.375), c(0.45, 0.4, 0.45, 0.6, 0.4, 0.4, 0.4, 0.4, 0.45, 0.3, 0.45, 0.5))), .Names = c("V1", "V2", "V3"), row.names = c("id", "WgtBand", "Wgt", "Held", "LoanXID", "Issuer", "Bid", "Offer"), class = c("data.table", "data.frame")) list2<-structure(list(V1 = list( c(15L, 8L, 2L, 21L, 8L, 2L, 23L, 25L, 20L, 4L), c(1, 1, 2, 3, 4, 5, 6, 7, 8, 9), c(NaN, NaN, NA, NA, NA, NA, NA, NA, NA, NA), c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), structure(c(7L,
Re: [R] binding two lists of lists of dataframes together
On May 13, 2015, at 2:01 PM, Vin Cheng wrote: > Hi David, > > I tried both solutions you provided(lapply(dlist, function(x) rbind(x,x) ) & > Map( rbind, smaller, smaller)) and they seem to transpose and reshape the > data into a different structure. Whenever I added the str - I only get a > NULL. I believe you are misrepresenting my suggestion. I suggested that you coerce each of the items in those lists to data.frames with appropriate column names before applying rbind.data.frame Those list1 and list2 examples appear to me as pathologically deformed. They claim to be data.tables but they have no self referential pointers, suggesting to me that they are not data.tables, and they have no column names suggesting not either data.table, nor data.frame. > class(list1) [1] "data.table" "data.frame" > class(list2) [1] "data.table" "data.frame" > > > You basically want a list of the same general structure as list1 where all > > the elements in list two at the same position and depth have been > > concatenated? > > Yes - that sounds exactly right. > Fix up the data.structures, first. Then use Map(rbind, ...) as described previously. list1a <- lapply(list1, function(x) setNames( data.frame(x), paste0("V", seq(length(x)) ) ) ) list2a <- lapply(list2, function(x) setNames( data.frame(x), paste0("V", seq(length(x)) ) )) list3a <- Map( rbind.data.frame, list1a, list2a) str(list3a) List of 3 $ V1:'data.frame': 22 obs. of 8 variables: ..$ V1: int [1:22] 15 19 28 9 17 3 11 21 7 8 ... ..$ V2: num [1:22] 1 1 2 3 4 5 6 7 8 9 ... ..$ V3: num [1:22] NaN NaN NA NA NA NA NA NA NA NA ... ..$ V4: num [1:22] 0 0 0 0 0 0 0 0 0 0 ... ..$ V5: Factor w/ 29 levels "ID1","ID10","ID11",..: 7 11 21 29 9 23 3 14 27 28 ... ..$ V6: Factor w/ 29 levels "Issuer1","Issuer10",..: 7 11 21 29 9 23 3 14 27 28 ... ..$ V7: num [1:22] 99.5 95.5 99.5 100 98.5 ... ..$ V8: num [1:22] 0.4 0.55 0.4 0.4 0.5 0.45 0.4 0.45 0.6 0.4 ... $ V2:'data.frame': 22 obs. of 8 variables: ..$ V1: int [1:22] 10 29 5 19 28 3 10 12 1 21 ... ..$ V2: num [1:22] 1 1 2 3 4 5 6 7 8 9 ... ..$ V3: num [1:22] NaN NaN NA NA NA NA NA NA NA NA ... ..$ V4: num [1:22] 0 0 0 0 0 0 0 0 0 0 ... ..$ V5: Factor w/ 29 levels "ID1","ID10","ID11",..: 2 22 25 11 21 23 2 4 1 14 ... ..$ V6: Factor w/ 29 levels "Issuer1","Issuer10",..: 2 22 25 11 21 23 2 4 1 14 ... ..$ V7: num [1:22] 98.5 100.2 99 95.5 99.5 ... ..$ V8: num [1:22] 0.6 0.4 0.45 0.55 0.4 0.45 0.6 0.55 0.5 0.45 ... $ V3:'data.frame': 22 obs. of 8 variables: ..$ V1: int [1:22] 21 28 3 7 25 25 15 13 3 20 ... ..$ V2: num [1:22] 1 1 2 3 4 5 6 7 8 9 ... ..$ V3: num [1:22] NaN NaN NA NA NA NA NA NA NA NA ... ..$ V4: num [1:22] 0 0 0 0 0 0 0 0 0 0 ... ..$ V5: Factor w/ 29 levels "ID1","ID10","ID11",..: 14 21 23 27 18 18 7 5 23 13 ... ..$ V6: Factor w/ 29 levels "Issuer1","Issuer10",..: 14 21 23 27 18 18 7 5 23 13 ... ..$ V7: num [1:22] 98 99.5 99.6 99.8 99.4 ... ..$ V8: num [1:22] 0.45 0.4 0.45 0.6 0.4 0.4 0.4 0.4 0.45 0.3 .. -- David > I've created new input(list1,list2) and desired output(list3) examples below. > I hope this makes the request a lot clearer. > > Not sure if this helpful, but I found this bit of script and it keeps > V1,V2,V3 separate and keeps each set of observations as vectors, but it > doesn't concatenate the v1 observations with v2 observations together. > > sample.list <- list(list1,list2) > library(data.table) > nr <- nrow(sample.list[[1]]) > fastbind.ith.rows <- function(i) rbindlist(lapply(sample.list, "[", i, TRUE)) > fastbound <- lapply(1:nr, fastbind.ith.rows) > > Link: > http://stackoverflow.com/questions/4863341/fast-vectorized-merge-of-list-of-data-frames-by-row > > Thank you again! > Vince > > Please find below the structure for list1, list2, and the desired output > list3: > > list1<-structure(list( > V1 = list(c(15L, 19L, 28L, 9L, 17L, 3L, 11L, 21L,7L, 8L, 11L, 13L), > c(1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), > c(NaN,NaN, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), > c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), > structure(c(7L, 11L, 21L, 29L, 9L, 23L, 3L, 14L, 27L, 28L, 3L, 5L), .Label = > c("ID1", "ID10", "ID11", "ID12", "ID13", "ID14", "ID15", "ID16", "ID17", > "ID18", "ID19", "ID2", "ID20", "ID21", "ID22", "ID23", "ID24", "ID25", > "ID26", > "ID27", "ID28", "ID29", "ID3", "ID4", "ID5", "ID6", "ID7", "ID8", "ID9"), > class = "factor"), structure(c(7L, 11L, 21L, 29L, 9L, 23L, 3L, 14L, 27L, 28L, > 3L, 5L), .Label = c("Issuer1", "Issuer10", "Issuer11", "Issuer12", > "Issuer13", "Issuer14", "Issuer15", "Issuer16", "Issuer17", "Issuer18", > "Issuer19", "Issuer2", "Issuer20", "Issuer21", > "Issuer22", "Issuer23", "Issuer24", "Issuer25", "Issuer26", "Issuer27", > "Issuer28", "Issuer29", "Issuer3", "Issuer4", "Issuer5", "Issuer6", > "Issuer7", "Issuer8", "Issuer9"), > class = "factor"), c(99.5, 95.5, 99.5, 100, 98.5, 99.646, 99.833, 98, 99.75, > 100, 99.833, 98.563), c(
[R] Post-hoc test on split-plot design
Hi Richard, Thank you very much for your cooperation. I installed the packages "HH" and run the following model: Bud.aov<-aov(terms(Budburst~CO2*SoilTemp*Photoperiod+Greenhouse/(SoilTemp*Photoperiod),keep.order=TRUE),data=data) > summary(Bud.aov) Df Sum Sq Mean Sq F valuePr(>F) CO211465.21465.2 109.612 < 2e-16 *** SoilTemp 1238.0 238.0 17.805 3.60e-05 *** CO2:SoilTemp 1145.7 145.7 10.900 0.001125 ** Photoperiod 2986.9 493.4 36.914 1.62e-14 *** CO2:Photoperiod 2 0.2 0.1 0.0060.994095 SoilTemp:Photoperiod2 14.67.3 0.5450.580893 CO2:SoilTemp:Photoperiod 2186.3 93.2 6.969 0.001167 ** Greenhouse 275.537.8 2.8240.061538 . SoilTemp:Greenhouse 2 5.9 3.0 0.2210.801896 Photoperiod:Greenhouse 4283.4 70.8 5.300 0.000433 *** SoilTemp:Photoperiod:Greenhouse 456.714.2 1.060 0.377363 Residuals 216 2887.313.4 The results that I got don't look like the results for the split-plot design which I got using the model below: mod<-aov(Budburst~CO2*SoilTemp*Photoperiod+Error(Greenhouse/(SoilTemp*Photoperiod)),data=data) > summary(mod) Error: Greenhouse Df Sum Sq Mean Sq F value Pr(>F) CO21 1465.2 1465.2 38.810.0248 * Residuals 2 75.537.8 Error: Greenhouse:SoilTemp Df Sum Sq Mean Sq F value Pr(>F) SoilTemp 1 238.00 238.00 80.57 0.0122 * CO2:SoilTemp 1 145.70 145.70 49.32 0.0197 * Residuals 2 5.912.95 Error: Greenhouse:Photoperiod Df Sum Sq Mean Sq F value Pr(>F) Photoperiod 2 986.9 493.46.9650.0498 * CO2:Photoperiod 20.2 0.1 0.001 0.9989 Residuals4 283.470.8 Error: Greenhouse:SoilTemp:Photoperiod Df Sum Sq Mean Sq F value Pr(>F) SoilTemp:Photoperiod 2 14.567.280.5140.6330 CO2:SoilTemp:Photoperiod 2 186.31 93.15 6.5760.0544 . Residuals 4 56.67 14.17 Error: Within Df Sum Sq Mean Sq F value Pr(>F) Residuals 216 2887 13.37 The F and P values are quite different. Moreover, I could not run the post-hoc tests as well. At this stage I shall highly appreciate your further cooperation. Thanks. Shah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Post-hoc tests on Split-plot design
Hi Richard, Thank you very much for your cooperation. I installed the packages "HH" and run the following model: Bud.aov<-aov(terms(Budburst~CO2*SoilTemp*Photoperiod+Greenhouse/(SoilTemp*Photoperiod),keep.order=TRUE),data=data) > summary(Bud.aov) Df Sum Sq Mean SqF valuePr(>F) CO211465.21465.2 109.612 < 2e-16 *** SoilTemp 1238.0 238.0 17.805 3.60e-05 *** CO2:SoilTemp 1145.7 145.7 10.900 0.001125 ** Photoperiod 2986.9 493.4 36.914 1.62e-14 *** CO2:Photoperiod 2 0.2 0.1 0.0060.994095 SoilTemp:Photoperiod2 14.67.3 0.5450.580893 CO2:SoilTemp:Photoperiod 2186.3 93.2 6.969 0.001167 ** Greenhouse 275.537.8 2.8240.061538 . SoilTemp:Greenhouse 2 5.9 3.0 0.2210.801896 Photoperiod:Greenhouse 4283.4 70.8 5.300 0.000433 *** SoilTemp:Photoperiod:Greenhouse 456.714.2 1.060 0.377363 Residuals 216 2887.313.4 The results don't look like the results for the split-plot design which I got using the model below: mod<-aov(Budburst~CO2*SoilTemp*Photoperiod+Error(Greenhouse/(SoilTemp*Photoperiod)),data=data) > summary(mod) Error: Greenhouse Df Sum Sq Mean Sq F value Pr(>F) CO21 1465.2 1465.2 38.810.0248 * Residuals 2 75.537.8 Error: Greenhouse:SoilTemp Df Sum Sq Mean Sq F value Pr(>F) SoilTemp 1 238.00 238.00 80.57 0.0122 * CO2:SoilTemp 1 145.70 145.70 49.32 0.0197 * Residuals 2 5.912.95 Error: Greenhouse:Photoperiod Df Sum Sq Mean Sq F value Pr(>F) Photoperiod 2 986.9 493.46.9650.0498 * CO2:Photoperiod 20.2 0.1 0.001 0.9989 Residuals4 283.470.8 Error: Greenhouse:SoilTemp:Photoperiod Df Sum Sq Mean Sq F value Pr(>F) SoilTemp:Photoperiod 2 14.567.280.5140.6330 CO2:SoilTemp:Photoperiod 2 186.31 93.15 6.5760.0544 . Residuals 4 56.67 14.17 Error: Within Df Sum Sq Mean Sq F value Pr(>F) Residuals 216 2887 13.37 The F and P values are quite different. Moreover, I could not run the post-hoc tests as well. At this stage I shall highly appreciate your further assistance. Thanks. Shah -- View this message in context: http://r.789695.n4.nabble.com/Post-hoc-tests-on-Split-plot-design-tp4707106p4707165.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] error using the huge R package
Dear List I am trying to do an association network using some expression data I have, the data is really huge: 300 samples and ~30,000 genes. I would like to apply a gaussian graphical model to my data using the huge R package. Here is the code I am using > dim(data) #[1] 317 32200 > huge.out <- huge.npn(data) > huge.stars <- huge.select(huge.out, criterion=“stars”) However in this last step I got the following error: Error in cor(x) : sampling…..in progress:10% Missing values present in input variable ‘x’. Consider using use = ‘pairwise.complete.obs’ Any help would be very appreciated Juan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plotting times at night and getting plot limits correct
Hi Bob, Given the other answers I may be off target, but perhaps this will help: # create two "nights" worth of data Times<-strptime( paste(c("2015-05-13","2015-05-14"),paste(rep(c(18:23,0:6),2),":30:00",sep="")), "%Y-%m-%d %H:%M:%S") # telescope the two nights into repeated hours Hours<-strptime(format(Times,"%H:%M:%S"),"%H:%M:%S") # get a measure that can be checked for the correct output calls_per_hour<-sample(10:100,length(Hours)) # plot the repeated values - looks okay plot(Hours,calls_per_hour) # now calculate the mean values for each hourly measurement mean_calls_per_hour<-by(calls_per_hour,as.character(Hours),mean) # plot the means, making sure that the orders match plot(sort(unique(Hours)),mean_calls_per_hour) Jim On Wed, May 13, 2015 at 1:20 AM, Richard M. Heiberger wrote: > Try this. > > >From the full data-time value subtract 18:00:00. > This places the times you are interested in into the range 00:00:00 - 12:00:00 > Remove the date from these adjusted date-time values and plot y > against the new times. > Take control of the tick-labels and display 18:00 - 0600 instead of > the default 00:00 - 12:00 > > Rich > > On Tue, May 12, 2015 at 10:34 AM, Bob O'Hara wrote: >> I'm helping colleagues with analysis of frog calls at night, and they >> want to plot call statistics against time. This means we hit a >> problem: we want the x-axis to start at (say) 18:00 and end at (say) >> 06:00. I'm reluctant to use the date as well, because we have data >> from several dates, but only want to plot against time of day. >> >> Here's some code to illustrate the problem (don't worry about the data >> being outside the range of the plot: this is only for illustration). >> >> library(chron) >> Times <- chron(times.=paste(c(18:23,0:9),":30:00", sep="")) >> Thing <- rnorm(length(Times)) # just something for the y-axis >> >> plot(Times,Thing) # x-axis wrong >> plot(Times,Thing, xlim=chron(times.=c("05:00:00", "18:00:00"))) # x-axis >> right >> plot(Times,Thing, xlim=chron(times.=c("18:00:00", "05:00:00"))) # >> would like this to work... >> >> Can anyone suggest a solution? >> >> Bob >> >> -- >> Bob O'Hara >> >> Biodiversity and Climate Research Centre >> Senckenberganlage 25 >> D-60325 Frankfurt am Main, >> Germany >> >> Tel: +49 69 798 40226 >> Mobile: +49 1515 888 5440 >> WWW: http://www.bik-f.de/root/index.php?page_id=219 >> Blog: http://occamstypewriter.org/boboh/ >> Journal of Negative Results - EEB: www.jnr-eeb.org >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Cross correlation between two time series over nested time periods?
Dear R users, I have two time series Calculate and plot cross correlation between two time series over nested time periods. Each point in either time series is for a week (not exactly a calendar week, but the first week in a calendar year always starts from Jan 1, and the other weeks in the same year follow that, and the last week of the year may contain more than 7 days but no more than 13 days). The first time series A is stored in a compressed (.gz) text file, which looks like (each week and the corresponding time series value are separated by a comma in a line): week,value 20060101-20060107,0 20060108-20060114,5 ... 20061217-20061223,0 20061224-20061230,0 20070101-20070107,0 20070108-20070114,4 ... 20150903-20150909,0 20150910-20150916,1 The second time series B is similarly stored in a compressed (.gz) text file, but over a subset of period of A, which looks like: week,value 20130122-20130128,509 20130129-20130204,204 ... 20131217-20131223,150 20131224-20131231,148.0 20140101-20140107,365.0 20140108-20140114,45.0 ... 20150305-20150311,0 20150312-20150318,364 I wonder how to calculate the cross correlation between the two time series A and B (up to a specified maximum lag), and plot A and B in a single plot? Thanks and regards, Tim __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.