slope_log_q: estimate slope coefficient on quarterly data, using log...

Description Usage Arguments Details

View source: R/regression.R

Description

function to df is a dataframe that is in tidy format with the variables in columns and a date column. gp_vec variable that is used in the group_by to estimate the slope for different metro areas y1 is the dependent variable x1 is the time trend transf_l is the label to be used in the transf column originally wrote this as part of the fred "work1_bk.R" script

Usage

1
slope_log_q(df, start_date, end_date, gp_vec, y1, x1, transf_l)

Arguments

transf_l

Details

# In writing the function above I had started with the following simple example 20 year empetot regression regdf <- tmbk_q filter(date >= start_20yr & date <= end_prior_q) group_by(area_sh) do(fiteq = lm((log(empetot)) ~ time(date), data = .))

get the coefficients by group in a tidy data_frame dfslope <- tidy(regdf, fiteq) filter(term == "time(date)") mutate(value = (((1+estimate)^4) -1)) mutate(transf = "gr20yr") mutate(variable = "empetot") select(area_sh, variable, transf, value)

get the summary statistics by group in a tidy data_frame dfsumm = glance(regdf, fiteq)


aranryan/arlodr documentation built on Oct. 28, 2018, 4:13 p.m.