Re: [R] sqlFetch maximum rows
The problem has been cope after I copy a new *.mdb file, just wondering if it will be happened again beyond future... :confused: -- View this message in context: http://n4.nabble.com/sqlFetch-maximum-rows-tp1593601p1593660.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.
Re: [R] RE xcel Macro Mode
I would like to do so as well, but I faced some problems as well.. livia wrote: > > Hi everyone, I would like to write VBA macros for accessing R and it is my > first attempt. I really could use some help here. > > I am trying to use the following code to read data from Access. The R code > between "" is correct as I successfully run it from R, but when I call it > using VBA, it comes out the error message "Compile error Syntax error" > > Call RInterface.RRun("mdbConnect <- > odbcConnectAccess("//c/users/Shared/data.mdb")") > > If I would like to run a function , is the following codes correct? > > Call RInterface.RRun("quareturn <- function(x){ > ... > ...{ > ... >} > ... > }") > > Could anyone give me some advice? > -- View this message in context: http://www.nabble.com/RExcel-Macro-Mode-tp13670651p24778784.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.
Re: [R] RE xcel foreground and background server
I have installed, its workable in frontground mode while but background mode, may I know how do I activate background mode? Thanks Irina Ursachi wrote: > > Dear all, > > I have a question regarding background and foreground server in RExcel: > Can somebody explain the main difference between them? As far as I > understood from the RExcel webpage, for both of them one needs rights > for access to Windows registries. The only difference that I can see so > far is that for the installation of the background server, one needs the > R(D)COM package, whereas for the foreground server installation, the > rcom package is required. > > Further more, does anyone know, how Excel proccesses and R processes > communicate? Is it possible for more than one Excel-process to > communicate with more than one R process? > > Thank you in advance! > > Best regards, > Irina Ursachi. > > __ > 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. > > -- View this message in context: http://www.nabble.com/RExcel-foreground-and-background-server-tp21668224p25720937.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.
[R] cross-entity equation
vector1 vector2 vector3 vector4 h = 1.2345h = 1.2212h = 1.2065h = 1.3423 x1 = 0.8654y1 = 0.7525z1 = 1.3254x3 = 0.5746 x2 = 0.8642y2 = 0.2458z2 = 0.9543y1 = 0.3584 x3 = 0.5548y3 = 0.4685z3 = 0.4685y4 = 0.7566 x4 = 0.3546y4 = 0.8346z4 = 0.6752z3 = 0.9546 ...... .. Above are 3 independent vectors, and then vector4 link the previous 3vectors to be vector5 as shown below. May I know is there any package may cope with my problem? vector5 h = ??? x1 = ??? x2 = ??? x3 = ??? x4 = ??? .. y1 = ??? y2 = ??? y3 = ??? y4 = ??? .. z1 = ??? z2 = ??? z3 = ??? z4 = ??? .. -- View this message in context: http://old.nabble.com/cross-entity-equation-tp26241287p26241287.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.
Re: [R] Time Series Rating Model
http://n4.nabble.com/file/n956255/TimeSeries%2BLikelihood.jpg >From the attachment, I need to find out the maximum likelihood value of ξ, while I stuck to write in R codes. I will appreciate of experts advices. Thanks. ryusuke wrote: > > > To R programming experts, > > I am a undergraduate student, and now doing research personally. I apply > diagonal bivariate poisson (R package "bivpois") with stochatics weighted > function (refer to dixoncoles97 section 4.5 to 4.7). However I dont know > how to fit this stochatical weighted function to the completed bivariate > poisson model. > > I know that some other references for dynamic soccer team rating apply > below two methods, while I am not familiar with these method:- > 1. Brownian Motions > ifs (CRAN package) > sde (CRAN package) > dvfBm (CRAN package) > > 2. Kalman Filters > FKF (CRAN package) > KFAS (CRAN package) > > Hereby I attach some references. I upload the model in R programming file > "model.RData" in my skydrive as well. > > I will appreciate if prof would sharing your precious advice or > suggestion. Thank you. > > > Best Regards, > > Ryusuke > A Soccer Scores Modelling Enthursiast > > > _ > USBã¡ã¢ãªä»£ããã«ã使ããã ãããç¡æã§ä½¿ãã25GBã > > > > > > __ > 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. > > -- View this message in context: http://n4.nabble.com/Time-Series-Rating-Model-tp930676p956255.html Sent from the R help mailing list archive at Nabble.com. [[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.
Re: [R] joint estimation of two poisson equations
ryusuke wrote: > > > > Owen Powell-2 wrote: >> >> Thanks Tirthankar, that did the trick. >> Here's the solution to my problem using the "bivpois" package: >> >> rm(list = ls()) >> library(bivpois) >> >> y1 = c(1,2,3,4,4,3) >> y2 = c(0,2,0,2,3,5) >> x1 = c(2,3,4,8,1,3) >> x2 = c(3,5,6,7,8,9) >> d = data.frame(cbind(y1, y2, x)) >> >> eq1 = y1 ~ x1 + x2 >> eq2 = y2 ~ x1 + x2 >> >> out = lm.pb(eq1, eq2, data = d, zeroL3 = TRUE) >> print(out) >> >> I couldn't find out how to get standard errors and p-values from the >> package, so I bootstrapped them. >> >> ~Owen >> >> 2009/4/13 Tirthankar Chakravarty >> >>> You should probably try the -bivpois- package: >>> http://cran.r-project.org/web/packages/bivpois/index.html >>> >>> A very good discussion of multivariate Poissons, negative binomials >>> etc. can be found in Chapter 7 of Rainer Winkelmann's book >>> "Econometric Analysis of Count Data" (Springer 2008). Most of the >>> likelihoods involved are fairly straightforward. >>> >>> T >>> >>> On Mon, Apr 13, 2009 at 9:32 AM, Owen Powell wrote: >>> > Dear list members, >>> > >>> > Is there a package somewhere for jointly estimating two poisson >>> processes? >>> > >>> > I think the closest I've come is using the "SUR" option in the Zelig >>> > package (see below), but when I try the "poisson" option instead of >>> > the "SUR" optioin I get an error (error given below, and indeed, >>> > reading the documentation of the Zelig package, I get the impression >>> > "poisson" was not meant to handle a system of equations). >>> > >>> > I think I could do it myself by constructing the likelihood function >>> > and then applying ML, but I'd prefer to avoid doing that unless it's >>> > entirely necessary. >>> > >>> > I'll post my solution to the list when I've worked it out. >>> > >>> > Regards, >>> > >>> > ~Owen >>> > >>> > # CODE FOR "sur" OPTION >>> > rm(list = ls()) >>> > library(Zelig) >>> > >>> > y1 = c(1,2,3,4) >>> > y2 = c(0,2,0,2) >>> > x = c(2,3,4,8) >>> > d = data.frame(cbind(y1, y2, x)) >>> > >>> > eq1 = y1 ~ x >>> > eq2 = y2 ~ x >>> > eqSystem = list (eq1, eq2) >>> > >>> > system_out = zelig(formula = eqSystem, model = "sur", data = d) >>> > summary(system_out) >>> > >>> > - >>> > >>> > # ERROR FROM REPLACING "sur" WITH "poisson" >>> > Error in switch(mode(x), `NULL` = structure(NULL, class = "formula"), >>> : >>> > invalid formula >>> > >>> > -- >>> > Owen Powell >>> > http://center.uvt.nl/phd_stud/powell >>> > >>> > __ >>> > 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. >>> > >>> >>> >>> >>> -- >>> To every ù-consistent recursive class ê of formulae there correspond >>> recursive class signs r, such that neither v Gen r nor Neg(v Gen r) >>> belongs to Flg(ê) (where v is the free variable of r). >>> >> >> >> >> -- >> Owen Powell >> http://center.uvt.nl/phd_stud/powell >> >> [[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. >> >> > > I would like to know the bivpois coding and write a same function in VBA > Excel, anyone gonna good suggestion? > http://www.nabble.com/file/p24115406/%257Ebivpois%257E.txt %7Ebivpois%7E.txt -- View this message in context: http://www.nabble.com/joint-estimation-of-two-poisson-equations-tp23019442p24115406.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.
[R] Robust Bivariate Poisson
To Experts, x = x1 + x3 y = x2 + x3 x3 = cov(x1,x2) By refer to package "bivpois", I'ld like to downweight previous x,y in my data based on date, I am wondering if lambda3 should robust as well, since lambda3 measure the co-relationship of lambda1 and lambda2, but if robust lambda3 might effect the covariance of lambda1 and lambda2 I though. I am sorry if misunderstanding the concept of a bivariate Poisson. Appreciate if experts willing to share precious advice. -- View this message in context: http://n4.nabble.com/Robust-Bivariate-Poisson-tp991214p991214.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.
[R] Survival Analysis for soccer scoring process
6.4.1 Estimation of fixed effects Heterogeneous team ability is a possible explanation for the result in Section 6.3. That result simply indicates that the more goals a team scores, the higher the probability that it will score more. However, teams that can score more goals also indicate teams with greater ability, or just greater scoring ability, than their opponents. As mentioned in Section 6.1.1, it is very natural that the higher ability team will score more, even though that stronger team has decided to defend more. Therefore, we need to control for this in the estimation. This problem is similar, but not identical, to the problem identified by Heckman and Singer (1984), that heterogeneous subjects will tend to yield decreasing hazards because a longer time of no failure indicates that the particular sample is intrinsically not likely to fail. Here, heterogeneous teams tend to yield a higher hazard of scoring for the leading team because such teams are intrinsically more likely to score. *For the estimation controlled for fixed effects, a series of dummy variables are added. Two dummy variables are added for each team, one for home ground and another for away ground (with the exception of Manchester City to prevent colinearity and act as baseline hazard). * As there are in total 25 teams6 involving in the English Premiership, there are 48 dummy variables added. Similarly, there are 22 and 25 teams in the German Bundesliga and Spanish Primera Liga and therefore I add 42 and 48 dummy variables respectively. Fitting the model by these dummy variables only can yield the ability difference between teams. Manchester Cityâs hazard ratio is equal to 1 in all columns because it is the benchmark. Arsenal is obviously a strong team as it has very high hazard ratios for scoring (1.40 of Manchester Cityâs hazard at home) and very low hazard ratios for being scored against (0.81 of Manchester Cityâs hazard at home) I am currently modelling soccer scoring process, may I know how do I set a variable as baseline hazard benchmark (as Bold characters inside above articles)? Hope some body willing to share your precious ideas. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Survival-Analysis-for-soccer-scoring-process-tp3801400p3801400.html Sent from the R help mailing list archive at Nabble.com. [[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.
[R] Package "survival" --- Difference of coxph strata with subset?
[code]>require("survival") > coxph(Surv(futime,fustat)~age + strata(rx),ovarian) Call: coxph(formula = Surv(futime, fustat) ~ age + strata(rx), data = ovarian) coef exp(coef) se(coef) z p age 0.137 1.15 0.0474 2.9 0.0038 Likelihood ratio test=12.7 on 1 df, p=0.000368 n= 26, number of events= 12 > coxph(Surv(futime,fustat)~age, ovarian, subset=rx==1) Call: coxph(formula = Surv(futime, fustat) ~ age, data = ovarian, subset = rx == 1) coef exp(coef) se(coef)z p age 0.115 1.12 0.0456 2.52 0.012 Likelihood ratio test=8.68 on 1 df, p=0.00321 n= 13, number of events= 7 > coxph(Surv(futime,fustat)~age, ovarian, subset=rx==2) Call: coxph(formula = Surv(futime, fustat) ~ age, data = ovarian, subset = rx == 2) coef exp(coef) se(coef)z p age 0.351 1.420.183 1.92 0.055 Likelihood ratio test=6 on 1 df, p=0.0143 n= 13, number of events= 5 [/code] May I know why I cant separate coxph(Surv(futime,fustat)~age + strata(rx),ovarian) To be coxph(formula = Surv(futime, fustat) ~ age, data = ovarian, subset = rx == 1) coxph(formula = Surv(futime, fustat) ~ age, data = ovarian, subset = rx == 2) May I know the difference of these issue? Many thanks... -- View this message in context: http://r.789695.n4.nabble.com/Package-survival-Difference-of-coxph-strata-with-subset-tp3657397p3657397.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.
Re: [R] Package "survival" --- Difference of coxph strata with subset?
Finally, I found the answer from here... http://www.childrensmercy.org/stats/weblog2005/StratifiedCoxRegression.asp http://www.childrensmercy.org/stats/weblog2005/StratifiedCoxRegression.asp Thernau and Grambsch describe it well in their book on survival analysis. /Analysis of multicenter clinical trials frequently uses stratification. Because of varying patient populations and referral patterns, the different clinical centers in the trial are likely to have difference baseline survival curves, ones that do not have simple parallel relationships. Strata play a role similar to blocks in randomized block designs analyzed by two-factor analysis of variance. (page 44)./ -- View this message in context: http://r.789695.n4.nabble.com/Package-survival-Difference-of-coxph-strata-with-subset-tp3657397p3658798.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.
[R] Second-order effect in Parametric Survival Analysis
Hi experts, http://r.789695.n4.nabble.com/file/n4034318/Parametric_survival_analysis_2nd-order_efffect.JPG Parametric_survival_analysis_2nd-order_efffect.JPG As we know a normal survival regression is the equation (1) Well, I'ld like to modify it to be 2nd-order interaction model as shown in equation(2) Question: Assume a and z is two covariates. x = dummy variable (1 or 0) z = factors (peoples' name) fit <- survreg(Surv(time,censor)~x*z, data=sample, dist="exponential") I tried to apply survreg(), while I have few questions: 1) If */survreg(Surv(time,censor)~x*z, data=sample, dist="exponential")/* correct? 2) If the baseline hazard is the value excluded both x and z effects? 3) How can I get the value and plot the hazard with only x effect (but exclude effect z) Thanks Best, Ryusuke -- View this message in context: http://r.789695.n4.nabble.com/Second-order-effect-in-Parametric-Survival-Analysis-tp4034318p4034318.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.
Re: [R] Second-order effect in Parametric Survival Analysis
Thank you Dr. David. I try to summarize it. Assumes x and z are two covariates: x = dummy variable (1 or 0) z = factors (people name) x*z = x + z + x*z therefore this is not a 2nd-order interactions, it should be (for an exponential survival regression):- h(t|(X=x,Z=z)) = exp(Beta0 + XZBeta1) #--- I believe there is no 2nd-order interactions survival regression as I searched over www.rseek.org. While I tried to read through the codes of survreg(), I stuck (cannot understand) at survreg6.c survreg6.c apply C Language which involves Cholesky decomposition multi-matrix (first-order interactions) calculation. 1) chinv2.c 2) cholesky3.c 3) chsolve2.c (only solve the equations of first-order interactions) If someone gives some idea or suggestion on these? Thank you. Best, Ryusuke -- View this message in context: http://r.789695.n4.nabble.com/Second-order-effect-in-Parametric-Survival-Analysis-tp4034318p4036005.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.
[R] Joint modelling of survival data
Assume that we collect below data : - subjects = 20 males + 20 females, every single individual is independence, and difference events = 1, 2, 3... n covariates = 4 blood types A, B, AB, O http://r.789695.n4.nabble.com/file/n4245397/CodeCogsEqn.jpeg λm = hazards rates for male λn = hazards rates for female Wm = Wn x ε, frailty for males, where ε is the edge ratio of male compare to female Wn = frailty for females X = covariates, blood types effects β = coefficients of blood types I would like to apply frailty model to get below results:- 1) 1 edge ratio between male and female ε 2) 4 coefficient values of blood types β Under this situation, shall I use which package (coxme or frailtypack)? will coxme function able to cope with it? -- View this message in context: http://r.789695.n4.nabble.com/Joint-modelling-of-survival-data-tp4245397p4245397.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.
Re: [R] Joint modelling of survival data
Hi Dr Terry, Thank you for your reply. Step(1) - Lets assume Generalized Poisson model (GLM) as basic model where constant hazards ratio as time goes by. Below are two correlated GLM. X_ij = Poisson( lambda_1 = \gamma * \alpha_i * \delta_j ) Y_ij = Poisson( lambda_2 = \alpha_j * \delta_i ) X_ij { 0, 1, 2 } and Y_ij { 0, 1, 2 } Where i is not equal to j , \alpha and \delta are unknown parameters. mean of production between \alpha with \delta constraint to 1 (will be random effects in below survival model) \gamma is a constant parameter (might be an intercepts in GLM) Therefore we need to make data size from n to be 2*n to get the coefficient value of \alpha and \delta , as well as \gamma. Step(2) - A Cox proportional hazards model. \lambda(t) = \lambda_0(t) * exp( X * \beta ) \lambda_0(t) is baseline hazards function , X is covariate , \beta is coefficient value. If I would extend static hazards ratio from Step(1) :- \lambda_1k(t) = exp( \gamma * \alpha_ik * \delta_jk ) \lambda_2k(t) = exp(* \alpha_jk * \delta_ik ) Where k is a group, and between groups are all independence. k = 1,2,3... n (n is data size in Step1) Below are fixed effects, X_ij { 0, 1, 2 } and Y_ij { 0, 1, 2 } will below 9 parameters. Then 9 coefficient values for \lambda_1(t) and also 9 for \lambda_2(t) where X_00 for both \lambda_1(t) and \lambda_2(t) as 1:- 01) hazards ratio during X_ij = 0 & Y_ij = 0(terms as \lambda_00 with factor( X_00 )) 02) hazards ratio during X_ij = 0 & Y_ij = 1(terms as \lambda_01 with factor( X_01 )) 03) hazards ratio during X_ij = 0 & Y_ij = 2(terms as \lambda_02 with factor( X_02 )) 04) hazards ratio during X_ij = 1 & Y_ij = 0(terms as \lambda_10 with factor( X_10 )) 05) hazards ratio during X_ij = 1 & Y_ij = 1(terms as \lambda_11 with factor( X_11 )) 06) hazards ratio during X_ij = 1 & Y_ij = 2(terms as \lambda_12 with factor( X_12 )) 07) hazards ratio during X_ij = 2 & Y_ij = 0(terms as \lambda_20 with factor( X_20 )) 08) hazards ratio during X_ij = 2 & Y_ij = 1(terms as \lambda_21 with factor( X_21 )) 09) hazards ratio during X_ij = 2 & Y_ij = 2(terms as \lambda_22 with factor( X_22 )) Step(3) - Fit correlated random effects into proportional hazards model. Due to \lambda_1(t) = \lamda_0(t) * exp( X * \beta ) exp( Z * b ) \lambda_2(t) = \lamda_0(t) * exp( X * \beta ) exp( Z * b ) \lambda_0(t) is baseline hazards function , X are covariates include { X_00, X_01... X_22 }. b ~ N(0, A) \beta = fixed effects coef X = covariate matrix for fixed effects b= random effects coefs, Z= covariate matrix for random effects *** Question : (1) How do I fit above \gamma , \alpha and \delta as random effects? (2) Under this situation, personally believe that \gamma should be intercept where require a parametric survreg() model but not coxme(). However I am not sure am I right? Since \lambda_1(t) and \lambda_2(t) are sharing same \alpha and \delta coefficient values but only \lambda_1(t) has extra \gamma value... Thank you. Best, Ryusuke -- View this message in context: http://r.789695.n4.nabble.com/Joint-modelling-of-survival-data-tp4245397p4264703.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.
Re: [R] Quality adjusted survival analysis
paper for reference http://www.google.com.hk/url?sa=t&rct=j&q=Package+iSQoL&source=web&cd=1&ved=0CCYQFjAA&url=http%3A%2F%2Fwww.stat.sinica.edu.tw%2Fjshwang%2Fweb%2Fwp-content%2Fplugins%2Fdownload-monitor%2Fdownload.php%3Fid%3D2&ei=fcMST6CgJ4yIrAfb_bT9AQ&usg=AFQjCNG4elXcSmsAElv2M5bHoqTNf8qXGQ&cad=rja R Package iSQoL R package to download http://www.stat.sinica.edu.tw/jshwang/web/isqol/ http://www.stat.sinica.edu.tw/jshwang/web/isqol/ Ryusuke -- View this message in context: http://r.789695.n4.nabble.com/Quality-adjusted-survival-analysis-tp4293706p4296761.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.
[R] sqlSave data into multiple *.mdb files
Hi All, con <- member <- class <- list() for(i in 1:5) { con[[i]] <- odbcConnectAccess(paste("C:/Desktop/Data/source",i,".mdb",sep = '')) #read data from Access files member[[i]] <- sqlFetch(con[[i]],'member') #get table data from *.mdb files observe[[i]] <- sqlFetch(con[[i]],'observe') #get table data from *.mdb files }; rm(i) memberID <- Reduce(function(x, y) merge(x, y, all=T), member, accumulate=F) #merge members to be unique memberID observe <- Reduce(function(x, y) merge(x, y, all=T), observe, accumulate=F) #merge observation data files attach(member) params <- glm(Ranking~Andy+Jackie+Kelly+Aaron...) #start calculation from merged data... output <- params$coef #get the coef of every single member detach(member) result <- sqlSave(con[[i]].) #save the coef of every single member into pre-merge source *mdb filesFrom the above coding, I got some data files from *.mdb files and merge it to calculate, but I was wondering how to save the result into the table of pre-merge *.mdb files. Best Regards, Ryusuke http://soccer.oksport.cn _ $B:#G/$...@als$7$h$&!*$^$:$O%M%C%HBe$+$i!#(B [[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.
Re: [R] Creating a new Access database with R
I am facing the same problem as well, I would like to code with following concept but wondering how to cope it. if (*mdb file exist) { add new row/col } else { add new *mdb file } -- From: Uri Shimron Date: Thu 21 Sep 2006 - 13:27:35 GMT First of all, since this is my first posting, I would like to thank anybody who works/has worked on R, and made it such a beautiful open source package! My question is: how do I create a new Access database with R? I need a channel before I can do anything, but if the mdb-file doesn't exist, I can't connect to it with odbcConnectAccess. I've looked at the RODBC.pdf on CRAN, searched the mailing-lists, and looked at test.R file in the package. But probably I've overlooked something. It is of course possible to keep a clean new mdb-file somewhere and then copy it to the required directory with: shell("copy EmptyDB.mdb NewLocation.mdb") But that isn't very elegant... Thanks in advance, Uri Shimron _ USB$B%a%b%jBe$o$j$K$*;H$$$/$...@$5$$!#l5na$g;H$($k(B25GB$B!#(B [[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.
Re: [R] Creating a new Access database with R
I have just got an idea which is using RExcel and coding with Excel VBA may cope with it, its work!!! Ryusuke From: urishim...@optiver.com To: ryusukeke...@hotmail.com Date: Mon, 15 Feb 2010 08:31:49 +0100 Subject: RE: RE:Creating a new Access database with R No idea, sorry. Haven$B!G(Bt checked it since. You might want to look at simply creating a new file titled $B!F(Bjustanothername.mdb$B!G(B and see if it works (probably not) Sorry I can$B!G(Bt be more helpful, which is why I keep this off the list$B!D(B Uri From: Ryusuke Kenji [mailto:ryusukeke...@hotmail.com] Sent: Thursday 11 February 2010 16:51 To: Uri Shimron; r-help@r-project.org Subject: RE:Creating a new Access database with R I am facing the same problem as well, I would like to code with following concept but wondering how to cope it. if (*mdb file exist) { add new row/col } else { add new *mdb file } -- From: Uri Shimron Date: Thu 21 Sep 2006 - 13:27:35 GMT First of all, since this is my first posting, I would like to thank anybody who [[elided Hotmail spam]] My question is: how do I create a new Access database with R? I need a channel before I can do anything, but if the mdb-file doesn't exist, I can't connect to it with odbcConnectAccess. I've looked at the RODBC.pdf on CRAN, searched the mailing-lists, and looked at test.R file in the package. But probably I've overlooked something. It is of course possible to keep a clean new mdb-file somewhere and then copy it to the required directory with: shell("copy EmptyDB.mdb NewLocation.mdb") But that isn't very elegant... Thanks in advance, Uri Shimron USB$B%a%b%jBe$o$j$K$*;H$$$/$...@$5$$!#l5na$g;H$($k(B25GB$B!#(B SkyDrive$B$r:#$9$0BN83(B *** This email and any files transmitted with it are confide...{{dropped:23}} __ 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.
[R] sqlFetch maximum rows
Hi, I was trying to import data from MS Access while face some capacity problem. There was only 320 rows sqlFetch into R even though I write max equal to 0: >sqlFetch(channel, tablenames='Sample', max=0) When I try sqlFetchMore there was only shown -1. May I know if there gotta better way to cope with my problem? Thanks lot Thanks, Ryusuke _ $B%M%C%H$ON)GI$J8GDjHq$G$9!#(bhotmail$b$...@\b3$,$...@$k!*(B [[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.
Re: [R] Time Series Rating Model
Experts, I have try to do seperate and doing simulation on lm.dibp (bivpois). I edited some elements to fit my soccer scores model. The static model has completed, I try to biuld a weight function for dynamic model as refer to dixon & coles(1997). existing weighted function in bivpois for zero-inflated purpose = "internal.data1$v1" dixon & coles dynamical weighted function = "weighted.data" May I know how to joined these two weighted function and fit into glm? I am not really know how to apply these two function correctly into glm. From: ryusuke Date: Wed, 09 Dec 2009 10:03:08 -0800 (PST) http://n4.nabble.com/file/n956255/TimeSeries%2BLikelihood.jpg >From the attachment, I need to find out the maximum likelihood value of þ, while I stuck to write in R codes. I will appreciate of experts advices. Thanks. ryusuke wrote: > > > To R programming experts, > > I am a undergraduate student, and now doing research personally. I apply > diagonal bivariate poisson (R package "bivpois") with stochatics weighted > function (refer to dixoncoles97 section 4.5 to 4.7). However I dont know > how to fit this stochatical weighted function to the completed bivariate > poisson model. > > I know that some other references for dynamic soccer team rating apply > below two methods, while I am not familiar with these method:- > 1. Brownian Motions > ifs (CRAN package) > sde (CRAN package) > dvfBm (CRAN package) > > 2. Kalman Filters > FKF (CRAN package) > KFAS (CRAN package) > > Hereby I attach some references. I upload the model in R programming file > "model.RData" in my skydrive as well. > > I will appreciate if prof would sharing your precious advice or > suggestion. Thank you. > > > Best Regards, > > Ryusuke > A Soccer Scores Modelling Enthursiast > > > _ > USBãÆÂ¡Ã£ÆÂ¢Ã£ÆÂªÃ¤Â»Â£Ã£âÂãâŠã«ãŠ使ãÂâãÂÂã > ãÂâ¢Ã£Ââãâ¬âçâ¡æââ¢Ã£Â§ä½¿ãÂËãââ¹25GBãâ¬â > > > > > > __ > R-help_at_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. _ ç¡æã§ä½¿ãã25GBãUSBã¡ã¢ãªã®ä»£ããã«ãWebã«ä¿å http://skydrive.live.com/?showunauth=1&mcid=HomeliveMerchBox1 [[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.
Re: [R] XML and RCurl: problem with encoding (htmlTreeParse)
Hi All, First method:- >library(XML) >theurl <- "http://home.sina.com"; >download.file(theurl, "tmp.html") >txt <- readLines("tmp.html") >txt <- htmlTreeParse(txt, error=function(...){}, useInternalNodes = TRUE) >g <- xpathSApply(txt, "//p", function(x) xmlValue(x)) >head(grep(" ", g, value=T)) [1] "ç¹é« | ç°¡é« | ENGLISH" "女æ²å µç«å´ é»é¢¨æä¼ºå" [3] "鬼åé ç¾å°å¥³ é¸ç¾çå·ç¨±å¾(å)" "ï¼åéï¼æ§æèªç©ºå»£å ä¿åè£¸ç©ºå§æ´é£æ©" [5] " åæµ·åå¿æ ¶éåä¹å°ç£ç°å³¶æ¸¸""é è³¼æ©ç¥¨! éæ æ¸¸å¡! æ½äºæé åºåæ©ç¥¨!" SecondMethod:- >library(RCurl) >theurl <- getURL("'GB2312') >Encoding(theurl) [1]"unknown" >txt <- readLines(con=textConnection(theurl),encoding='GB2312') >txt[5:10] #show the lines which occurred encoding problem. [1] "" [2] "SINA.com US æ°æµªç¶² -åç¾" [3] "" [4] "" [5]"" [6] "http://ui.sina.com/assets/css/style_home.css\"; />" i am trying to read data from a Chinese language website, but the Chinese characters always unreadable, may I know if any good idea to cope such encoding problem in RCurl and XML? Regards, Ryusuke _ [[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.
Re: [R] XML and RCurl: problem with encoding (htmlTreeParse)
Hi Prof, Thank you for your reply. Sorry that I missed out the below information. >Sys.getlocale() [1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252" I have just noticed that traditional chinese character cause the encoding problem, while chinese simplified works fine. >library(RCurl) >theurl <- getURL("'utf8') #Encoding(theurl) #[1]"latin1" >txt <- readLines(con=textConnection(theurl),encoding='utf8') >write.table(file='D:/fileas.txt',txt) When I open the fileas.txt, the Chinese traditional character readable in notepad, but when I try to read file to Rgui:- > smple <- scan('D:/fileas.txt',what='') Then it comes to unrecognisable character again, I was wondering if Rgui support traditional Chinese character now... I think I need to looking for solution of inter-Chinese character's translation. Thank you. Best, Ryusuke === Hi Ryusuke I would use the encoding parameter of htmlParse() and download and parse the content in one operation: htmlParse("http://home.sina.com";, encoding = "UTF-8") If you want to use getURL() in RCurl, use the .encoding parameter You didn't tell us the output of Sys.getlocale() or how your terminal/console is configured, so the above may vary under your configuration, but works on various machines for me with different settings. D. Ryusuke Kenji wrote: > > Hi All, > > First method:- > >library(XML) > > >theurl <- "http://home.sina.com"; > >download.file(theurl, "tmp.html") > > >txt <- readLines("tmp.html") > > >txt <- htmlTreeParse(txt, error=function(...){}, useInternalNodes = > TRUE) > > >g <- xpathSApply(txt, "//p", function(x) xmlValue(x)) > > >head(grep(" ", g, value=T)) > > > [1] "?? | ?? | ENGLISH" > "??? ???" > [3] "??? ?? ??(???)" > "?? " > [5] " ???""? ??! > ? ??! !" > > > > SecondMethod:- > >library(RCurl) > > >theurl <- getURL("'GB2312') > > >Encoding(theurl) > > [1]"unknown" > > >txt <- readLines(con=textConnection(theurl),encoding='GB2312') > >txt[5:10] #show the lines which occurred encoding problem. > [1] " />" > [2] "SINA.com US ? -??" > [3] " ???, ??,, SINA, US, News, Chinese, > Asia\" />" > [4] " content=\"???, > ???24, , > , ??, , ?BBS, > ???.\" />" > [5]"" > > > > [6] " href=\"http://ui.sina.com/assets/css/style_home.css\"; />" > > i am trying to read data from a Chinese language website, but the Chinese > characters always unreadable, may I know if any good idea to cope such > encoding problem in RCurl and XML? > > > Regards, > Ryusuke > > _ > > > [[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. -- "There are men who can think no deeper than a fact" - Voltaire Duncan Temple Langdun...@wald.ucdavis.edu Department of Statistics work: (530) 752-4782 4210 Mathematical Sciences Bldg. fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA _ ¥á©`¥ë¤òÒ»À¨¥Á¥§¥Ã¥¯£¡Ëû¤ÎoÁÏ¥á©`¥ë¤â¥×¥í¥Ð¥¤¥À©`¥á©`¥ë¤â¡£ [[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.