lag

Lagging Forward in plm

↘锁芯ラ 提交于 2019-12-10 12:48:06
问题 This is a very simple question, but I haven't been able to find a definitive answer, so I thought I would ask it. I use the plm package for dealing with panel data. I am attempting to use the lag function to lag a variable FORWARD in time (the default is to retrieve the value from the previous period, and I want the value from the NEXT). I found a number of old articles/questions (circa 2009) suggesting that this is possible by using k=-1 as an argument. However, when I attempt this, I get an

Android - onStop() will be called with a delay

痴心易碎 提交于 2019-12-10 02:44:47
问题 I found my activities onStop() method will be called with a less than 10 seconds delay. I've never seen before this behavior. Note :- The activity is singleTop and it starts with Intent.FLAG_ACTIVITY_REORDER_TO_FRONT flag. Note :- I'm using Build Tools v23.0.2. The delay wasn't before and the method would be called immediately. 回答1: I am guessing that you are starting another activity and you expect the current activity to receive an onStop() callback. According to the activity lifecycle, the

ListView scroll lagging when images is shown?

大城市里の小女人 提交于 2019-12-09 23:47:37
问题 My listview lags when scrolling. It seems as the lazyload works but the lag happens everytime an image is shown. I'm using the imageLoader found here http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/ and this is my adapter: public class EventAdapter extends ArrayAdapter<Event>{ public ListImageLoader imageLoader; public DisplayImageOptions imgDispOpts; private ArrayList<Event> objects; public EventAdapter(Context context, int textViewResourceId, ArrayList<Event>

What's the opposite function to lag for an R vector/dataframe?

南笙酒味 提交于 2019-12-09 15:55:30
问题 I have a problem dealing with time series in R. #--------------read data wb = loadWorkbook("Countries_Europe_Prices.xlsx") df = readWorksheet(wb, sheet="Sheet2") x <- df$Year y <- df$Index1 y <- lag(y, 1, na.pad = TRUE) cbind(x, y) It gives me the following output: x y [1,] 1974 NA [2,] 1975 50.8 [3,] 1976 51.9 [4,] 1977 54.8 [5,] 1978 58.8 [6,] 1979 64.0 [7,] 1980 68.8 [8,] 1981 73.6 [9,] 1982 74.3 [10,] 1983 74.5 [11,] 1984 72.9 [12,] 1985 72.1 [13,] 1986 72.3 [14,] 1987 71.7 [15,] 1988 72

How to create lag variables

强颜欢笑 提交于 2019-12-09 13:29:17
问题 I want to create lagged variable for a variable pm10 and used the following code. However, I could not get what I wanted. How could I create a lag of pm10? df2$l1pm10 <- lag(df2$pm10, -1, na.pad = TRUE) df2$l1pm102 <- lag(df2$pm10, 1) dput(df2) structure(list(var1 = 1:10, pm10 = c(26.956073733, NA, 32.838694951, 39.9560737332, NA, 40.9560737332, 33.956073733, 28.956073733, 32.348770798, NA), l1pm10 = structure(c(26.956073733, NA, 32.838694951, 39.9560737332, NA, 40.9560737332, 33.956073733,

QuartzCore shadow - lag UITableView?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 12:15:46
问题 I have an UITableView (NOTE:The UITableView is in a UIView) and I thought it would be nice to have an shadow added below it. I add the shadow with QuartzCore and it turns out really nice. But I also notice that when I come back from a 'Detail View' the animation back to the root is a bit lag. I've heard that QuartzCore and CoreAnimation can make the app slower, or in this case, add lag. First, am I right that CoreAnimation makes the app slower? If so, how can I keep my shadow but remove the

PostgreSQL Window Functions Ignore Null Values

拥有回忆 提交于 2019-12-08 09:25:39
问题 I am relatively new to PostgreSQL and am having a difficult time trying to implement the lag() function while ignoring null values. According to the docs, http://www.postgresql.org/docs/9.4/static/functions-window.html, it is not possible to simply pass a parameter to the function to achieve this. Does anyone know of any workaround? You can make up any example but if it helps here is something to get you started: Col_A Col_B Col_A_Lag Col_B_Lag ID Date VA_1 100 VA_1 100 AA Jan-1 null null VA

Lags in R within specific subsets?

丶灬走出姿态 提交于 2019-12-08 08:12:08
问题 Suppose I have the following dataframe: df <- data.frame("yearmonth"=c("2005-01","2005-02","2005-03","2005-01","2005-02","2005-03"),"state"=c(1,1,1,2,2,2),"county"=c(3,3,3,3,3,3),"unemp"=c(4.0,3.6,1.4,3.7,6.5,5.4)) I'm trying to create a lag for unemployment within each unique state-county combination. I want to end up with this: df2 <- data.frame("yearmonth"=c("2005-01","2005-02","2005-03","2005-01","2005-02","2005-03"),"state"=c(1,1,1,2,2,2),"county"=c(3,3,3,3,3,3),"unemp"=c(4.0,3.6,1.4,3.7

Lag in dataframe

泪湿孤枕 提交于 2019-12-08 06:38:30
问题 I have a dataframe like ID_CASE Month CS00000026A 201301 CS00000026A 201302 CS00000026A 201303 CS00000026A 201304 CS00000026A 201305 CS00000026A 201306 CS00000026A 201307 CS00000026A 201308 CS00000026A 201309 CS00000026A 201310 CS00000191C 201302 CS00000191C 201303 CS00000191C 201304 CS00000191C 201305 CS00000191C 201306 CS00000191C 201307 CS00000191C 201308 CS00000191C 201309 CS00000191C 201310 I want the final data frame to have three additional column like ID_CASE Month Lag_1 Lag_2 Lag_3

R - How can I check if a value in a row is different from the value in the previous row?

ε祈祈猫儿з 提交于 2019-12-08 03:13:52
问题 I would like to add a column to my table that compares a value with a previous value in an existing column 'farm' (to check if it is the same); and also controls if the value in the current row is "NULL". The objective is to get back in the new column 'switch' the value "new" when the value in the column 'farm' for that row is different from the value in the previous row for the column 'farm'. (exept when the value in farm is "NULL", then I would like to get back "") See here below the