search for: firm

Displaying 20 results from an estimated 1141 matches for "firm".

Did you mean: fire
2012 Mar 09
1
From (common IDs different Names) To (common IDs common Names)
Dear Community I have a large dataframe x as follows with common ids but different names: > x <- data.frame(ID = c(1,1,2,2,2,3,3), + Name = c("B Branch A Firm ","A Firm","B Firm","B Firm","B Firm C Branch","C Firm","C Firm A Branch") + ) > x ID Name 1 1 B Branch A Firm 2 1 A Firm 3 2 B Firm 4 2 B Firm 5 2 B Firm C Branch 6 3 C...
2005 Dec 29
9
Single Table Inheritance
Hi all, Quick question for STI. With the following setup: class Company < AR::Base; end class Firm < Company; end Why does Firm.find(:all) return all Companies, not just those that have type==''Firm''? -- Alex
2005 Sep 05
4
Dummy variables model
Hi, all! Anyone know an easy way to specify the following model. Panel dataset, with stock through time, by firm. I want to run a model of y on a bunch of explanatory variables, and one dummy for each firm, which is 1 for observations that come from firm i, and 0 everywhere else. I have over 200 firms (and a factor variable that contains a firm identifier). Any easy way of going about this, without hav...
2013 Jun 07
4
matched samples, dataframe, panel data
I R-helpers #I have a data panel of thousands of firms, by year and industry and #one dummy variable that separates the firms in two categories: 1 if the firm have an auditor; 0 if not #and another variable the represents the firm dimension (total assets in thousand of euros) #I need to create two separated samples with the same number os firms where...
2009 May 04
4
Creating a variable which is the sum of equal rows in a dataframe
Hi everyone: I need to count the number of banks of each firm in my data. The firm is identified by the fiscal number. The banks of each firm appears like this: Firm Banks 500600700 Citybank 500600700 CGD 500600700 BES 500600800 Citybank 500600800 Bank1 500600900 CGD I want to obt...
2011 May 19
2
balanced panel data
I have a dataframe with many firm-year observations and many variables. Not all firms have information for all the years. I want another dataframe with only those firms that have information all years. This is, I want a balanced panel data, but with the maximum number of years. In my reprocucible example I want to keep firms 1...
2011 Oct 02
2
subset in dataframes
I need help in subseting a dataframe: data1<-data.frame(year=c(2001,2002,2003,2004,2001,2002,2003,2004, 2001,2002,2003,2004,2001,2002,2003,2004), firm=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4),x=c(11,22,-32,25,-26,47,85,98, 101,14,87,56,12,43,67,54), y=c(110,220,302,250,260,470,850,980,1010,140,870,560,120,430,670,540)) data1 I want to keep the firms where all x>0 (where there are no negative values in x) So my output should be: year f...
2006 Jun 03
1
Can I tell if the associated record is new in a belongs_to save?
In a belongs_to association, is there a way to tell if the associated object was newly created? Hopefully this will explain my question: A Firm class declares has_many<http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000530>:clients and a client class declares belongs_to<http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000532>:firm. Now you do the following: Create...
2009 May 10
1
Select the rows in a dataframe that matches a criteria in another dataframe
Hi everyone! Thank you for the help you have been given to me, and here I'm with another problem with my dataframes: I have two dataframes (with much more observations), like these: Dataframe1 Firm Year cash 500400200 2007 100 500400200 2006 200 500400200 2005 400 500400300 2007 300 500400300 2006 240 500400300 2005 120 500400400 2007 340 500400400 2006 890 500400400 2005 250 Dataframe 2 Firm Audited c...
2013 Apr 08
2
How can I extract part of the data in a panel dataset?
Taking the Grunfeld data, which is built-in in R, for example, (1)How can I construct a dataset (or dataframe) that consists of the data of all firms in 1951? (2)How can I calculate the average capital in each form over the period 1951-1954? What I can imagine is to categorize the data by firm, and then select the data between 1951 and 1954 for each firm, but how can I do it? Thanks, Miao Grunfeld data: invest value capital firm year 317...
2010 Jan 22
2
sorted reshaping?
dear R wizards:? I am wrestling with reshape.? I have a long data set that I want to convert into a wide data set, in which rows are firms and columns are years. > summary(rin) firm fyear sim1 Min. :1004.00 Min. :1964.0 Min. : -1.00000 1st Qu.:1010.00 1st Qu.:1979.0 1st Qu.: -0.14334 Median :1016.00 Median :1986.0 Median : 0.00116 Mean :1016.34 Mean :1986.1 Mean : 1....
2013 Oct 15
1
Problem with lapply
Hi together I'm pretty new to R, so excuse me if it is a basic question. I have a big dataset (extract of it found in the attachment) of returns from firms. I'd like to compute the Pearson correlation of each firm with the "Market" and the corresponding p-Value. So I thought of making a list of 'cor.test's and then extract the needed values with a for loop. What I did so far... dataset=Testcor dataset$DATE<-as.Date(dataset$DA...
2013 Jan 11
0
Manual two-way demeaning of unbalanced panel data (Wansbeek/Kapteyn transformation)
...able(t.ind,i.ind))==1,]) D<-data.matrix(cbind(D1,D2)) Q<-I-D%*%ginv(crossprod(D))%*%t(D)#fQ(D1)-fQ(D1)%*%D2%*%ginv(t(D2)%*%fQ(D1)%*%D2)%*%t(D2)%*%fQ(D1) Q } ############################## library(plm) library(lmtest) data(Grunfeld) y_i<-Grunfeld$inv-ave(Grunfeld$inv,index=Grunfeld$firm) y_t<-Grunfeld$inv-ave(Grunfeld$inv,index=Grunfeld$year) y_it<-(Grunfeld$inv-ave(Grunfeld$inv,index=Grunfeld$firm)-ave(Grunfeld$inv,index=Grunfeld$year)+rep(mean(Grunfeld$inv),length(Grunfeld$inv))) x1_it<-(Grunfeld$value-ave(Grunfeld$value,index=Grunfeld$firm)-ave(Grunfeld$value,index=Gru...
2010 Jul 22
4
Drop firms in unbalanced panel if not more than 5 observations in consecutive years for all variables
Dear R-user, a few weeks ago I consulted the list-serve with a similar question. However, my task changed a little but sufficiently to get lost again. So I would appreciate any help on the following issue. I use the plm package and work with firm-level data in a panel. I would like to eliminate all firms that do not fulfill the requirement of having an observation in every variable used for at least x consecutive years. For illustration of the problem assume the following data set > data id year y z 1 a 2000 1 1 2 b 2000 NA...
2010 Nov 25
1
Help on running regression by grouping firms
Hi there, I have a huge data set with multiple firms years and other firm characteristics. I want to run a regression on the dependent variable and other explanatory variables and calculate the residual terms by grouping the firms in same year and same industry. What I want to do is to divide my obseravtion into sub sample that contains the observ...
2008 Jun 05
7
Improving data processing efficiency
...re as follows: I have a data set on quarterly institutional ownership of equities; some of them have had recent IPOs, some have not (I have a binary flag set). The total dataset size is 700k+ rows. My goal is this: For every quarter since issue for each IPO, I need to find a "matched" firm in the same industry, and close in market cap. So, e.g., for firm X, which had an IPO, i need to find a matched non-issuing firm in quarter 1 since IPO, then a (possibly different) non-issuing firm in quarter 2 since IPO, etc. Repeat for each issuing firm (there are about 8300 of these). Thus...
2004 Jun 17
2
Question on lists and vectors of lists
I have an elementary programming question. Could someone please point me in the right direction? I have a function which will run for thousands of companies. At each invocation, it returns 2 numbers. I plan to do something like: think_one_firm <- function(filename) { # Do stuff return(list(x=x,y=y)) } So for each of the firms in my dataset, I will call think_one_firm(datafilename) and it will give me back two numbers x and y. I could say: l = think_one_firm("blah") print(l$x); print(l$y); and all would be...
2010 Mar 16
2
plm "within" models: is the correct F-statistic reported?
...ally specifying the time control dummies [2]. [1] vignette("plm") [2] http://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf Two examples below: library("AER") data("Grunfeld", package = "AER") library("plm") gr <- subset(Grunfeld, firm %in% c("General Electric", "General Motors", "IBM")) pgr <- plm.data(gr, index = c("firm", "year")) > dim(pgr) [1] 60 5 ## the first example is actually on "individual" effects > gr_fe <- plm(invest ~ value + capital, data...
2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
Hi R-helpers, My real data is a panel (unbalanced and with gaps in years) of thousands of firms, by year and industry, and with financial information (variables X, Y, Z, for example), the number of firms by year and industry is not always equal, the number of years by industry is not always equal. #reproducible example firm1<-sort(rep(1:10,5),decreasing=F) year1<-rep(2000:2004,10) i...
2007 Nov 30
1
rollapply on zoo object
Dear R users. I have zoo object "size_june" containing market-capital values: > dim(size_june) # market-cap data of 625 firms for 20 years [1] 20 625 > class(size_june) [1] "zoo" > size_june # colnames = "size.firmcode" size.34020 size.4710 size.11050 size.10660 size.9540 size.8060 size.16160 size.8080 size.9280 1988-06-30 NA NA NA NA NA NA...