similar to: Avoiding loops in creating a coinvestment matrix

Displaying 20 results from an estimated 8000 matches similar to: "Avoiding loops in creating a coinvestment matrix"

2010 Mar 04
1
ifthen() question
Hi All, I am using a specialized aggregation function to reduce a dataset with multiple rows per id down to 1 row per id. My function work perfect when there are >1 id but alters the 'var.g' in undesirable ways when this condition is not met, Therefore, I have been trying ifthen() statements to keep the original value when length of unique id == 1 but I cannot get it to work. e.g.:
2010 Mar 04
0
ifthen() question -- whoops--ifelse()
OK, I got it figured out. I was not keying into a length greater than 1, so: # I added this object and placed it into the iftelse statement: lid <- sum(match(id, st[i], nomatch = 0)) out$var.g[i]<-ifelse(lid ==1, meta$var.g[id==st[i]], aggs(g=g[id==st[i]], n.1= n.1[id==st[i]], n.2 = n.2[id==st[i]], cor)[2]) #full
2008 Nov 06
1
trouble with for loop
Hello, I'm having two similar problems with for loop and I would appreciate any help or comment. I want to use "for loop" to calculate series of initial values for an optimization problem. But some initial values have my function quit due to problems like calculating the inverse of singular matrices. I don't want to make my program check determinants and skip it if it is
2013 Oct 17
0
Singular Matrix 'a' in solve
Hi, I have a set of matrix data named “invest” consists of 450 observations (75 countries, 6 years) with 7 variables (set as I, pop, inv, gov, c, life, d; which each is “numeric[450]”). The procedure is modify from code provided by B.E. Hansen at http://www.ssc.wisc.edu/~bhansen/progs/ecnmt_00.html. *Then the variable is being transformed to* y <- lag_v(i,0) cf <-
2006 Jul 17
1
sem: negative parameter variances
Dear Spencer and Prof. Fox, Thank you for your replies. I'll very appreciate, if you have any ideas concerning the problem described below. First, I'd like to describe the model in brief. In general I consider a model with three equations. First one is for annual GRP growth - in general it looks like: 1) GRP growth per capita = G(investment, migration, initial GRP per
2001 Apr 09
4
fastest R platform
Hello, everyone! I picked up R several months ago and have adopted it as my choice for statistical programming. Coming from a Java background, I can honestly say that R is not only free, it is better tha S-plus: the lexical scope in R makes it very simple to simulate Java's object model. For this, I encourage everyone to read the artcle: Robert Gentleman and Ross Ihaka (2000) "Lexical
2006 Dec 24
2
FW: Passing lists from R to C, extracting elements, and sending lists back again
Thank you to everyone who responded to my previous post regarding the integration into R of C programs that use external libraries. I have another issue that I simply have not been able to figure out using documentation, list archives, and so forth. I have data that is stored in R lists. I would like to pass the list to C code using the .Call function, perform mathematical operations on the
2009 Jul 15
1
Matrix multiplication precision
Hi!! I am trying to multiply 5 matrices and then using the inverse of that matrix for further computation. I read about precision problems from the archives and the suggestion was to use as.numeric while computing the products. I am still having problems with the results. Here is how I am using it #Mn.mat<-(T.mat %*% Rz.mat %*% Q.mat %*% Rz.mat %*% T.mat) # I was doing this in one step
2013 Jan 11
0
Manual two-way demeaning of unbalanced panel data (Wansbeek/Kapteyn transformation)
Dear R users, I wish to manually demean a panel over time and entities. I tried to code the Wansbeek and Kapteyn (1989) transformation (from Baltagi's book Ch. 9). As a benchmark I use both the pmodel.response() and model.matrix() functions in package plm and the results from using dummy variables. As far as I understood the transformation (Ch.3), Q%*%y (with y being the dependent variable)
2011 Jan 16
1
\examples{} in Rd file
[Hope this is the right list where to send...] An attempt to update package 'mnormt' involves the addition of a small new function called 'pd.solve'. When I come to the package checking stage, an error occurs in parsing pd.solve.Rd. The full transcript of the outcome is copied below (it includes details on my installation) but the critical point is where the \examples{} section
2010 Dec 06
1
waldtest and nested models - poolability (parameter stability)
Dear All, I'm trying to use waldtest to test poolability (parameter stability) between two logistic regressions. Because I need to use robust standard errors (using sandwich), I cannot use anova. anova has no problems running the test, but waldtest does, indipendently of specifying vcov or not. waldtest does not appear to see that my models are nested. H0 in my case is the the vector of
2005 Mar 24
3
Caching computation in rails?
Caching computation in rails? Simple example: factorial modulus a large number input: integer x output: factorial( x ) % 12345678901234567 I want it so that if it computes factorial of N once, it will not have to compute for N again. code: class SiteController < ApplicationController caches_action :factorial, :inv def examine @inv = @params[''inv''] @outv =
2014 Dec 25
0
how useful could be a fast and embedded database for the R community?
On Wed, Dec 24, 2014 at 7:37 PM, joanv <joan.iglesias at live.com> wrote: > I'm sorry, but I cannot show code. Then can you stop using the word "release". To release means to let something go, preferably out into the wild. I can't even find a binary "release" on that site. Call it the first "version" if you want, but not "release". I'm
2003 Feb 19
1
getting/storing the name of an object passed to a function
Hi I have a couple of functions that work on the object created by another R command and then print out or summarise the results of this work. The main function is defined as: hotelling.t <- function(obj) { #internal commands } I then have print.hotelling.t() that takes the list returned by hotelling.t and prints it with some extra significance calculations, formatting, etc. I want to
2011 Jul 09
2
Meta-analysis with zero values for mean and sd. Continuous data.
Hi, I want to do a meta-analysis with count data for treatement/control cases. Mi problem is that I need to use zero values (an informative zero value) for the mean and standard deviation for one of the treatement, but R has a problem: "Studies with zero values for sd.e or sd.c get no weight in meta-analysis". I can agroup the case by Family (byvar=Family). ¿Can you help me? Thanks!
2012 Aug 07
2
Error using ddply inside user-defined function
Hi All, I *think* it's ddply because the function recognizes vr1, etc, in other parts of the function. Here's some code: # create dataset PROV.PM.FBCTS <- c(0.00 ,0.00, 33205.19, 25994.56, 23351.37, 26959.56 ,27632.58, 26076.24, 0.00, 0.00 , 6741.42, 18665.09 ,18129.59 ,21468.39 ,21294.60 ,22764.82, 26076.73) FBCTS.INV.TOT <- c(0 , 0, 958612, 487990, 413344, 573347,
2011 Jul 09
1
Meta-analysis with zero values for mean and sd
Hi! I want to do a meta-analysis with count data for treatement/control cases. Mi problem is that I need to use zero values (an informative value) for the mean and standard deviation for one of the treatement, but R has a problem: "Studies with zero values for sd.e or sd.c get no weight in meta-analysis". I can agroup the case by Family (byvar=Family). ¿anybody help me? Thanks! >
2010 Jan 31
3
combining data frames in a list - how do I add breaks?
I'm a week-old R user, and have become stuck trying to create usable CSV outputs for post-processing. I am using the package Rioja, which provides small datasets of results. I am running several analyses in a loop and iteratively adding the results to a *list* ("combined"). Within each iteration I use the following: > combined[[i]] <- performance(fit) With two iterations I
2012 Jul 31
1
about changing order of Choleski factorization and inverse operation of a matrix
Dear All, My question is simple but I need someone to help me out. Suppose I have a positive definite matrix A. The funtion chol() gives matrix L, such that A = L'L. The inverse of A, say A.inv, is also positive definite and can be factorized as A.inv = M'M. Then A = inverse of (A.inv) = inverse of (M'M) = (inverse of M) %*% (inverse of M)' = ((inverse of
2006 Dec 22
1
Powercom BNT-1200AP driver
Hello. What about driver for my UPS? I have changed the powercom driver for myself, but I have made it not absolutely correctly. However, somehow this driver works. Now i have protocol spec for powercom BNT series and attach it to this email. It can be interesting to authors? -- ? ?????????, ??????? ??????? mailto:alex@reutman.ru JID: alex@reutman.ru ICQ: 5052225 -------------- next part