search for: year1

Displaying 20 results from an estimated 24 matches for "year1".

Did you mean: year
2008 Dec 10
2
how to merge panel data stored by variable?
Hi, I have two datasets stored in tab-separated format in the following way file1: country year1 year2 Germany var1 var1 Hungary var1 var1 file2: country year1 year2 Germany var2 var2 Hungary var2 var2 I can easily read in these files, but how can I merge them as a panel dataset? Thanks, Viktor [[alter...
2010 Aug 24
2
chisq.test on samples of different lengths
...I am trying to see whether there has been a significant difference in whether people experienced damages from wildlife in two different years. I therefore have two columns: year 1: yes no no no yes yes no year 2: no yes no yes I wanted to do a chisq.test, but if I enter it this way: chisq.test(year1, year2) I get the error saying the columns are two different lengths. So then I tried doing: damages<-matrix(c(3,4, 2,2), ncol=2, dimnames=list(answer=c("yes", "no"), year=c("year1", year2))) chisq.test(damages) Does that make sense? Should I maybe be doing a dif...
2003 Nov 17
1
Generalized linear model
Hi all! I am fitting a Poisson model, using the following command: > fit2<-glm(canc~id1+year1+time+lnpa,family=poisson) where 'id1', 'year1' and 'time' are factors. I defined them with: > id1<-C(factor(id1), treatment) and 'lnpa' is a continuous variable. The 'summary' function gives me all the effects estimates, that is, for id1, I end...
2007 Jun 29
1
Assign name to a name
...ataset that has different years in it. I am writing scripts using R and I would like to give a month a generic name and then use the generic name to do different analysis. The reason for the generic name would be so that I only have to change one thing if I wanted to change the year. For example. Year1 = 1999 datayear <- subset(dataset, Year = Year1) I would want to subset for whatever year is in "Year1". I am not sure if R does this but it would be great if it does. Is there also anyway for R to ask the user for the variable in the console without going into the script and then u...
2011 Dec 01
0
Error message: object 'A' not found
...;C","C","C","T","T","T","T","T","T","T","T","T"),nrow=18,ncol=1) #CHANGE THIS!!! nrow=# of T and Cs or A-Ks (same #) hab <- data.frame(hab) #Year effects year <- matrix(c("Year1","Year1","Year1","Year1","Year2","Year2","Year2","Year2","Year2","Year1","Year1","Year1","Year1","Year2","Year2","Year2","Year2",&quot...
2006 Aug 24
1
Using a 'for' loop : there should be a better way in R
...bit inelegant and given all the warnings in the Intro to R, etc, about using loops I wondered if anyone could suggest something a bit simpler or more efficent? Example: cat1 <- c( 1,1,6,1,1,5) cat2 <- c( 1,2,3,4,5,6) cat3 <- c( 5,4,6,7,8,8) cat4 <- c( 1,2,1,2,1,2) years <- c( 'year1', 'year2', 'year3', 'year3', 'year1', 'year1') id <- c('a','a','b','c','c','a') df1 <- data.frame(id,years,cat1,cat2, cat3, cat4) nn <- levels(df1$id) # levels for outer loop hh <- levels(d...
2004 Jul 24
0
rbind()
hi. I'm merging two datasets. one of them is 51 rows, and a typical row looks like this: midwar[midwar$dispnum==89,] dispnum synch sanum saname sbnum sbname year1 yearn ainit binit fatala 158 89 0 220 FRN 230 SPN 1822 1823 1 1 4 fatalb key1 keyn warnum year1.war yearn.war awon 158 5 2202301822 2202301823 1 1823 1823 2 The other is 3 rows, and it looks like this: dispnum synch sanum...
2006 Dec 14
1
legend/plotmath/substitute problem
...only one data series: year = 2001 g = 1.9 plot(1) legend('top', legend=substitute(paste(year, ': ', gamma, '=', g), list(year=year, g=g)) ) My problem starts, when I want to put more than one series of data in the plot and accordingly need one legend row per data series: year1 = 2001 year2 = 2005 g1 = 1.9 g2 = 1.7 plot(1) legend('top', legend=c( substitute(paste(year, ': ', gamma, '=', g), list(year=year1, g=g1)), substitute(paste(year, ': ', gamma, '=', g), list(year=year2, g=g2)) ) ) This obviously does not produce the de...
2012 Jul 04
2
Date
Hi I have monthly data and the dates are in MM/YY Format I need to convert them into DD/MM/YY format by pasting 01 in place of DD to all the observations in my Year Column ex: Year Stock Prices 01/2000 1 02/2000 2 03/2000 3 I need to convert them to Year Stock Prices 01/01/2000 1 01/02/2000 2 01/03/2000
2011 Apr 18
1
Comparing two lines - Ancova: lm or aov?
...Residuals: Min 1Q Median 3Q Max -1.35062 -0.42695 -0.02234 0.29789 1.78540 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -8.699125 0.543372 -16.010 <2e-16 *** Length 0.151462 0.006708 22.578 <2e-16 *** Year1 1.627903 1.168158 1.394 0.1660 Length:Year1 -0.024259 0.014510 -1.672 0.0972 . --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.6016 on 119 degrees of freedom Multiple R-squared: 0.8384, Adjusted R-squared: 0.8343 F-statistic: 205...
2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
...n 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) industry1<-rep(20,50) X<-rnorm(50) Y<-rnorm(50) Z<-rnorm(50) data1<-data.frame(firm1,year1,industry1,X,Y,Z) data1 colnames(data1)<-c("firm","year","industry","X","Y","Z") firm2<-sort(rep(11:15,...
2010 Jan 30
2
drawing a line that shifts from solid to broken
I am graphing longitudinal data from three time points. I'd like to draw a solid line from point 1 to point 2, and then a dashed line from point 2 to point 3. It works if I do it in two steps: > first.vector <- c(mean(year1$variable1), mean(year2$variable1)) > second.vector <- c(NA, mean(year2$variable1), mean(year3$variable1)) > plot(first.vector, type="b", xlim=c(1,3)) > lines(second.vector, type="b", lty=2) It's clunky, though, and I have a bunch of these to do. Can I streamline...
2012 May 24
1
svychisq using two frames
...? function, but cannot figure out how to do this across what is currently two data frames. I haven?t actually tried to run a svychisq with the two frames yet as I am waiting on the data for the second frame. I?m trying to plan out the logic ahead of time. So, let?s say I have survey design frame Year1 with variables Wt1 and MyVar, and survey design frame Year2 with variables Wt2 and MyVar ? remember the variable name is the same in both frames. My first inclination is that I would use a statement like: svychisq(~MyVar+MyVar, Year1+Year2, statistic=?Chisq?) However, it seems from reading the he...
2010 Aug 20
1
Shifting of Principal amount while calculating Present Value
Dear R Helpers I have following data - cash_flow = c(7, 7, 107)  # 107 = Principle 100 + interest of 7% t = c(1,2,3) and zero rate table as rating         year1           year2           year3 AAA            3.60            4.17              4.73 AA              3.65            4.22              4.78 A                 3.72           4.32              4.93 BBB            4.10            4.67             5.25 For each of these ratings I need to calculate...
2012 Jun 24
2
Defining multiple variables in a loop
...lt;- as.matrix(sample(country1$lagunemployment, size = (nrow(country1)), replace = T)) unemployment2 <- as.matrix(sample(country2$lagunemployment, size = (nrow(country2)), replace = T)) unemployment3 <- as.matrix(sample(country3$lagunemployment, size = (nrow(country3)), replace = T)) country.year1 <- as.matrix(cbind(country1$Country, country1$Year2)) country.year2 <- as.matrix(cbind(country2$Country, country2$Year2)) country.year3 <- as.matrix(cbind(country3$Country, country3$Year2)) country1.2 <- as.data.frame(cbind(country.year1, exp1, tax1, gdp1, unemployment1)) country2.2 &l...
2011 Jul 04
4
How to build a matrix of number of appearance?
I have a matrix of claims at year1 that I get simply by claims<-read.csv(file="Claims.csv") qq1<-claims[claims$Year=="Y1",] I have MemberID and ProviderID for every claim in qq1 both are integers An example for the type of questions that I want to answer is how many times ProviderID number 345 appears...
2008 Oct 12
0
false convergence (8) after removal of the two-way interaction
...er of obs: 486, groups: rnr, 341; nk, 125 Fixed effects: Estimate Std. Error z value Pr(>|z|) (Intercept) -1.513e-01 1.356e+00 -0.1116 0.91112 VAR2 -1.440e-02 6.429e-02 -0.2241 0.82271 VAR3 3.130e-04 1.413e-03 0.2215 0.82469 year1 -2.671e-01 5.719e-01 -0.4670 0.64050 year2 4.888e-01 4.792e-01 1.0199 0.30780 year3 -2.720e+00 1.169e+00 -2.3260 0.02002 * year4 1.287e+00 4.211e-01 3.0569 0.00224 ** year5 -1.180e-01 4.195e-01 -0.2812 0.77855...
2013 Jun 07
4
matched samples, dataframe, panel data
...firms where #one firm in the first have a corresponding firm in the second with the same #year, industry and dimension (the dimension doesn't need to be exactly the #same, it could vary in an interval of +/- 10%, for example) #My reproducible example firm1<-sort(rep(1:10,5),decreasing=F) year1<-rep(2000:2004,10) industry1<-rep(20,50) dummy1<-c(0,0,1,1,0,0,1,1,0,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,1,1,1) dimension1<-c(2120,345,2341,5678,10900,4890,2789,3412,9500,8765,4532,6593,12900,123,2345,3178,2678,6666,647,23789, 2189,4289,8543,637,2...
2013 Apr 07
2
group data in classes
Hello all! I have a problem to group my data (years) in 10 years classes. For example for year year decade 1598 1590-1600 1599 1590-1600 1600 1590-1600 1601 1600-1610 --- my is like this> [1] 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 [16] 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 [31] 1628 1629 1630 1631 1632 1633
2010 Feb 24
1
Remove missing observations
...jects filled out a questionnaire every year. The time span covers 2 years. Now I want to check if there is a significant change in the outcome over the 2 years with a paired wilcox.test. The problem: Not every subject completed both questionnaires. Thus, some subjects have the outcome only for year1 and others only for year2. If I try wilcox.test(Outcome~Year, paired=T), I receive an error "not the same length". Is there a fast method to remove those subjects with missing outcomes? Thanks for any help. Regards, Denis Aydin _____________________________________________ Denis Ay...