similar to: Problem with lapply and splitted variables

Displaying 20 results from an estimated 30000 matches similar to: "Problem with lapply and splitted variables"

2011 Apr 14
1
Automatically extract info from Granger causality output
Dear Community, this is my first programming in R and I am stuck with a problem. I have the following code which automatically calculates Granger causalities from a variable, say e.g. "bs" as below, to all other variables in the data frame: log.returns<-as.data.frame( lapply(daten, function(x) diff(log(ts(x))))) y1<-log.returns$bs y2<- log.returns[,!(names(log.returns) %in%
2009 Apr 11
2
who happenly read these two paper Mohsen Pourahmadi (biometrika1999, 2000)
http://biomet.oxfordjournals.org/cgi/reprint/86/3/677 biometrika1999 http://biomet.oxfordjournals.org/cgi/reprint/94/4/1006 biometrika2000 Hi All: I just want to try some luck. I am currenly working on my project,one part of my project is to reanalysis the kenward cattle data by using the method in Mohsen's paper,but I found I really can get the same or close output as he did,so,any
2014 Nov 04
1
[R] Calculation of cross-correlation in ccf
Dear All, I am studying some process measurement time series in R and trying to identify time delays using cross-correlation function ccf. The results have however been bit confusing. I found a couple of years old message about this issue but unfortunately wasn't able to find it again for a reference. For example, an obvious time shift is observed between the measurements y1 and y2 when the
2007 May 29
1
rgl.postscript
Hi, I am having an issue when creating a postscript file from RGL window. It seems to cut off some of the axis labels. Here is the code I am using. I created a 3D plot using RGL_0.71 with R 2.5 on Windows XP. z1<-c(5,4,1,4.5,2,3,2,1,1) z2<-c(6,8,7,7.5,5,3.5,4,1,1) z3<-c(3,2,4,7,3,4.5,6,2,3) x1<-seq(1,9) x2<-seq(1,9) x3<-seq(10,18) y1<-seq(8,0) y2<--1*y1
2008 Oct 15
2
dynlm and lm: should they give same estimates?
Hi, I was wondering why the results from lm and dynlm are not the same for what I think is the same model. I have just modified example 4.2 from the Pfaff book, please see below for the code and results. Can anyone tell my what I am doing wrongly? Many thanks, Werner set.seed(123456) e1 <- rnorm(100) e2 <- rnorm(100) y1 <- ts(cumsum(e1)) y2 <- ts(0.6*y1 + e2) lr.reg <- lm(y2
2009 Nov 13
0
about the pgmm in plm package (application and singularity)
Dear Sir or Madam: I am Shaojuan Liao, the 3rd year Ph.D. student from Econ Department, Virginia Tech. I don't know whether it is appropriate to ask you questions on the command pgmm. But I don't know how to deal with the case where all X are exogenous and all T time periods' X can be used as the instrument. Problem 1: I know when X are predetermined, such as Z=[y1,X1,X2, 0,
2013 Apr 22
0
Copula fitMdvc:
Hello, I am trying to do a fit a loglikelihood function with Multivariate distribution via copulas with fitMdvc. The problem is that it doesn't recognize that my beta is a vector of km parameter and when I try to run it it say that the length of my initial values is not the same as the parameter. Can somebody guide me where my mistake is. Thanks, Elisa. #################################
2009 Jul 01
0
probit with sample selection error?
Deal all: i want to do the probit with sample selection estimation, the following is my code: probit with sample selection can be done by stata :heckprob The heckprobll is the likelihood function shown in W.H. Greene 5th p714 ¡´ The question is the convergence is very slow compare with Stata using likellihood only. ¡´ Second i did the similar way in matlab using fminsearch , the estimated
2005 May 09
0
Sampling from multivariate multiple regression prediction regions
I'd like to sample multiple response values from a multivariate regression fit. For example, suppose I have m=2 responses (y1,y2) and a single set of predictor variables (z1,z2). Each response is assumed to follow its own regression model, and the error terms in each model can be correlated (as in example 7.10 of section 7.7 of Johnson/Wichern): > ex7.10 <- + data.frame(y1 =
2010 Oct 21
1
All other variables in upper scope arg for stepAIC
Hi - I am trying to substitute for "the_other_y" in the code below. I want y2 and y3 to be there when i is 1, y1 and y3 to be there when i is 2 and y1 and y2 to be there when i is 3. I'm sure it's to do with what format the data should be in and I've tried alldata[,-i], but it fits all the columns of alldata except i rather than each column one at a time. I've tried
2006 Nov 30
1
data.frame within a function (PR#9294) (cont'd)
This continues the message "data.frame within a function (PR#9294)" that was posted on 2006/10/12. Duncan Murdoch kindly replied. I'm using the current version R 2.4.0, but the same issue exists. Just copy and paste the following code under R, and compare the output of f1() and f2() and the output of f3() and f4(). Does anybody have any idea? Thanks.
2003 Jun 16
2
extension to plot.formula?
Could I suggest the following extension to plot.formula: plot(cbind(y1,y2) ~ x, ...) should plot (y1 against x) and (y2 against x) on the same plot. The default y axis limits would be determined by the range of c(y1,y2). This would be pretty handy sometimes, replacing 4 lines of code. The current plot.formula evaluates cbind(y1,y2), which is a matrix, so plot.formula looks for
2011 Nov 05
1
acf?
I started to check what I thought I knew with autocovariance and it doesn’t jive with the the calculations given by ‘R’. I was wondering if there is some scaling or something that I am not aware of. Take the example Ø d <- 1:10 Ø (a <- acf(d, type="covariance", demean=FALSE, plot=FALSE)) Autocovariances of series ‘d’, by lag 0 1 2 3 4 5 6
2008 Apr 09
0
Endogenous variables in ordinal logistic (or probit) regression
A student brought this question to me and I can't find any articles or examples that are directly on point. Suppose there are 2 ordinal logistic regression models, and one wants to set them into a simultaneous equation framework. Y1 might be a 4 category scale about how much the respondent likes the American Flag and Y2 might be how much the respondent likes the Republican Party in America.
2008 Apr 03
3
summary(object, test=c("Roy", "Wilks", "Pillai", ....) AND ellipse(object, center=....)
Dear All, I would be very appreciative of your help with the following 1). I am running multivariate multiple regression through the manova() function (kindly suggested by Professor Venables) and getting two different answers for test=c("Wilks","Roy","Pillai") and tests=c("Wilks","Roy",'"Pillai") as shown below. In the
2011 May 18
0
scatter plot: multiple Y variables and error bars
#Hi all, #Using the example data that follows, can someone please show me how to get a scatterplot of points with #error bars in the Y direction. something like this works for one Y: xYplot(Cbind(y1, l1, u1) ~x1, data=y) #but this: xYplot(Cbind(y1, l1, u1) + Cbind(y2, l2, u2)~x1, data=y) # doesn't give me what I would have expected, which is both sets of points to have their respective
2008 Dec 29
4
Merge or combine data frames with missing columns
Hi R-experts, suppose I have a list with containing data frame elements: [[1]] (Intercept) y1 y2 y3 y4 -6.64 0.761 0.383 0.775 0.163 [[2]] (Intercept) y2 y3 -3.858 0.854 0.834 Now I want to put them into ONE dataframe like this: (Intercept) y1
2012 May 15
0
How to apply a function to a multidimensional array, based on its indices
Hello, Your way is much better than to mess with the dim attribute, like I did. But, "If you can create a data.frame or matrix that has the indices" Actually, it must be a matrix, indices can't be of type list. A way to avoid loops/apply altogether, and much faster, is the one creating K3 (K is the result from the op.) n <- 20 t2 <- system.time({ K2 <-
2013 Jul 23
0
Comparación entre dos DL50's
H ola Argel, Muchisimas gracias por los datos y el codigo! ;-) Una forma es hacer bootstrap. En http://www.mayin.org/ajayshah/KB/R/documents/boot.html hay una corta introduccion. Seria algo similar a lo siguiente: d <- LD50.1 - LD50.2 # diferencia real d #p = 0.5: #37.31248 # ------------ # bootstrap # ------------ B <- 1000 # numero de muestras bootstrap d.sample <-
2010 Oct 17
1
lattice xyplot - formatting of multiple Y variables when using subgroups
Hi all, Using xyplot I want to print to Y variables (y1, y2) versus X, conditional on the group. How can I obtain a line (type="l") for one relationship (ie. y1 ~ x) and points (type="p") for the other (y2 ~ x) ? library(lattice) # create some sample data df<-data.frame(group=as.factor(c(rep("a",4), rep("b",4))), # grouping variable for conditional