similar to: linear model coefficients by year and industry, fitted values, residuals, panel data

Displaying 20 results from an estimated 100 matches similar to: "linear model coefficients by year and industry, fitted values, residuals, panel data"

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 #one firm in the first have a corresponding
2010 Oct 21
4
Efficient nested loops
Dear R community, I am working with huge arrays, so I spend a lot of time computing. This is my code: for (x in 1:dim(variable)[1]){ for (y in 1:dim(variable)[2]){ for (z in 1:dim(variable)[3]){ result <- max(variable[x,y,z,]) } } } Is there a more efficient procedure to do this task? Thanks in advance! [[alternative HTML version deleted]]
2013 May 21
1
keep the centre fixed in K-means clustering
Dear R users I have the matrix of the centres of some clusters, e.g. 20 clusters each with 100 dimentions, so this matrix contains 20 rows * 100 columns numeric values. I have collected new data (each with 100 numeric values) and would like to keep the above 20 centres fixed/'unmoved' whilst just see how my new data fit in this grouping system, e.g. if the data is close to cluster 1
2012 Dec 12
2
help with predict.glm, and charting with factors
Dear R Wizards, After much frustration and days of confusion I have finally broken down and am asking for help, which I don’t like doing, but I just can’t figure this one out on my own. I’ve conducted a laboratory experiment testing the effects of temperature and salinity on whether or not a biological event will occur (Go or NoGo). I’ve coded the factors temperature and salinity as factors for
2007 Mar 23
1
objects of class "matrix" and mode "list"?
Hello everyone, I cannot seem to find information about objects of class "matrix" and mode "list", and how to handle them (apart from flattening the list). I get this type of object from using sapply(). Sorry for the long example, but the code below illustrates how I get this type of object. Is anyone aware of documentation regarding this object? Thanks very much, Stephen
2011 Jul 02
5
How many times occurs
Hi all, I have a data matrix likein "input.txt" 8 9 2 5 4 5 8 5 6 6 8 9 2 8 9 2 8 9 2 1 8 9 2 5 4 5 8 5 6 4 8 9 2 5 4 5 8 5 6 6 8 9 2 8 9 2 8 9 2 1 8 9 2 5 4 5 8 9 2 2 In this example will be an 6x10 matrix (or data frame) I want to detect how many times in a row appears this combination 8 follewd by 9 followed by 2, and create a new matrix with only this number of occurs then
2011 Dec 04
1
Polishing my geom_bar for publication
Dear list, I am new with ggplot2 and I have spend quiet some time putting together the following code to create the attached plot. However there's still a few things that I'm having trouble with! I would be grateful if someone can tell me how to fix (1) the colour of my bars into grey scales (2) removing the y-axis (species name) on the right figure to avoid duplication, and (3) fix the
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
2008 Apr 12
2
Predict Function
Hi all - my first time here and am having an issue with the Predict function. I am using a tutorial as a guide, locate here: http://www.ats.ucla.edu/STAT/R/dae/mlogit.htm My code gives this error > newdata1$predicted <- predict(mlogit,newdata=newdata1,type="response") Error in `$<-.data.frame`(`*tmp*`, "predicted", value = c(0.332822934960197, : replacement has
2013 Jun 08
0
data
Hi, Try this: final3New<-read.table(file="real_data_cecilia.txt",sep="\t") dim(final3New) #[1] 5369??? 5 #Inside the split within split, dummy==1 for the first row.? For lists that have many rows, I selected the row with dummy==0 (from the rest) using the #condition that the absolute difference between the dimensions of those rows and the first row dimension was minimum
2010 Feb 18
1
logistic regression - what is being predicted when using predict - probabilities or odds?
Dear gurus, I've analyzed a (fake) data set ("data") using logistic regression (glm): logreg1 <- glm(z ~ x1 + x2 + y, data=data, family=binomial("logit"), na.action=na.pass) Then, I created a data frame with 2 fixed levels (0 and 1) for each predictor: attach(data) x1<-c(0,1) x2<-c(0,1) y<-c(0,1) newdata1<-data.frame(expand.grid(x1,x2,y))
2013 Feb 26
1
Light Libraries
Dear R-Help group: I have been tinkering with how I want my personal standard library functions to look like. They are not designed to be professional and heavyweight, but lightweight. There are probably dozens of little bugs, because I don't know or have not properly taken care of a variety of internal R code issues. still, I like how this ended up, and there is no learning curve, so I
2008 Jun 15
2
How to take the average of multiple rows
Dear all, I have a matrix, called newdata1, > dim(newdata1) [1] 34176 83 It looks like: EntrezID Name S1 S2 S3 S4 S5..... 1 4076 CAPRIN1 0.1 0.2 0.3... 2 139170 WDR40B 0.4 0.5 0.6... 3 5505 PPP1R2P1 0.3 0.3 0.7... 4 4076 CAPRIN1 0.7 0.3 0.2... 5 139170 WDR40B null 0.8
2012 Aug 01
1
rpart package: why does predict.rpart require values for "unused" predictors?
After fitting and pruning an rpart model, it is often the case that one or more of the original predictors is not used by any of the splits of the final tree. It seems logical, therefore, that values for these "unused" predictors would not be needed for prediction. But when predict() is called on such models, all predictors seem to be required. Why is that, and can it be easily
2023 Jan 15
2
Removing variables from data frame with a wile card
I am new to this thread. At the risk of presenting something that has been shown before, below I demonstrate how a column in a data frame can be dropped using a wild card, i.e. a column whose name starts with "th" using nothing more than base r functions and base R syntax. While additions to R such as tidyverse can be very helpful, many things that they do can be accomplished simply
2008 Jun 14
1
how to select out some columns using cbind()
Hello! I have a matrix: > dim(data1) [1] 34176 581 of 34176 rows and 581 columns, I want to make a new matrix data2 by taking the 2nd column, 9th column, 16th column.... the column number is in the order of: 2 9 (2+7) 16 (9+7) 23 (16+7) ... the new matrix data2 should include 83 columns, is there an easy way to do that using cbind() function? Thanks a lot! Allen [[alternative HTML
2010 May 03
2
Hierarchical factors
Hello, Hierarchical factors are a very common data structure. For instance, one might have municipalities within states within countries within continents. Other examples include occupational codes, biological species, software types (R within statistical software within analytical software), etc. Such data structures commonly use hierarchical coding systems. For example, the 2007 North
2011 Sep 27
0
Keep consecutive year observations (remove gap's) in panel data (dataframes). Difficulties in using lag(). Package plm.
Hi everyone. I have two questions. I’ve found some other questions and answers similar to these but they didn’t solve my problem. I’m working with a panel of firm/years observations (see my reproducible example). I’m using the plm package. My panel not only is unbalanced but also have some gap’s in years. #reproducible example
2023 Jan 14
1
Removing variables from data frame with a wile card
Hello Avi, while something like d$something <- ... may seem like you're directly modifying the data it does not actually do so. Most R objects try to be immutable, that is, the object may not change after creation. This guarantees that if you have a binding for same object the object won't change sneakily. There is a data structure that is in fact mutable which are environments. For
2003 Apr 03
4
Two y-axis in plots
Hi, I am trying to plot two data sets on one plot but with using a different y-axis ranges for each - preferably with one shown on each side of the graph. Is there a function that will allow me to do this. Thanks Allan McRae [[alternate HTML version deleted]]