Forum: help


RE: Strange resultf from systemfit [ Reply ] By: Arne Henningsen on 2015-06-27 06:11 | [forum:42334] |
Hi Carol The formulas for argument "inst" must include *all* instrumental variables, i.e. including the exogenous regressors: inst1 <- ~ probc11 + bbpop + paperpen + buying + rlstate + auto + pi inst2 <- ~ probc21 + bbpop + paperpen + tv + radio + rlstate + auto + pi If variables "buying", "tv", "radio", "probc11", and "probc21" are indeed exogenous, you could use all instrumental variables for both of the equations: inst <- ~ probc11 + probc21 + bbpop + paperpen + buying + tv + radio + rlstate + auto + pi Best regards, Arne |
Strange resultf from systemfit [ Reply ] By: Carol Ting on 2015-06-26 14:49 | [forum:42333] |
Hi everyone, I am fitting a 2-equation system with the systemfit package: log(ads) = log(clicks) + bbpop + paperpen + buying + rlstate + auto + pi log(clicks) = log(ads) + bbpop + paperpen + tv +radio + rlstate + auto + pi Where the variables log(clicks) and log(ads) are endogenous, and they are instrumented by variables probc11 and probc21, respectively. The dataset is in my public folder https://dl.dropboxusercontent.com/u/14429852/search.csv and I used the following code to perform the analysis but got some strange results below (a large number of standard errors are NA's): eq1 <- lads ~ lclicks + bbpop + radio + tv + paperpen + rlstate + auto + pi eq2 <- lclicks ~ lads + bbpop + buying + paperpen + rlstate + auto + pi system <- list( ads = eq1, clicks = eq2 ) inst1 <- ~ probc11 inst2 <- ~ probc21 instlist <- list( inst1, inst2 ) fit3sls <- systemfit( system, "3SLS", inst = instlist, data = Search ) summary(fit3sls) RESULTS------------------------- systemfit results method: 3SLS N DF SSR detRCov OLS-R2 McElroy-R2 system 606 589 100710 3219.98 -98.5842 -38.5621 N DF SSR MSE RMSE R2 Adj R2 ads 303 294 10026.1 34.1025 5.83974 -119.0536 -122.3204 clicks 303 295 90683.4 307.4013 17.53286 -96.7416 -99.0609 The covariance matrix of the residuals used for estimation ads clicks ads 7.52202 -9.55094 clicks -9.55094 55.42238 The covariance matrix of the residuals ads clicks ads 34.1025 85.2243 clicks 85.2243 307.4013 The correlations of the residuals ads clicks ads 1.000000 0.832372 clicks 0.832372 1.000000 3SLS estimates for 'ads' (equation 1) Model Formula: lads ~ lclicks + bbpop + radio + tv + paperpen + rlstate + auto + pi Instruments: ~probc11 Estimate Std. Error t value Pr(>|t|) (Intercept) 5.11322e-02 NA NA NA lclicks -3.00638e-01 6.52312e+05 0e+00 1.00000 bbpop 1.91237e-03 1.72256e+02 1e-05 0.99999 radio 8.44606e-05 1.72739e+04 0e+00 1.00000 tv 2.01290e-01 NA NA NA paperpen 1.28808e-02 NA NA NA rlstate -1.24766e+00 NA NA NA auto -9.46462e+00 NA NA NA pi 5.42942e+00 NA NA NA Residual standard error: 5.839735 on 294 degrees of freedom Number of observations: 303 Degrees of Freedom: 294 SSR: 10026.135118 MSE: 34.1025 Root MSE: 5.839735 Multiple R-Squared: -119.053649 Adjusted R-Squared: -122.320415 3SLS estimates for 'clicks' (equation 2) Model Formula: lclicks ~ lads + bbpop + buying + paperpen + rlstate + auto + pi Instruments: ~probc21 Estimate Std. Error t value Pr(>|t|) (Intercept) 4.89695e+00 6.75394e+06 0 1 lads -4.66608e-01 NA NA NA bbpop -6.42986e-04 NA NA NA buying 6.98992e-02 NA NA NA paperpen -2.61266e-02 NA NA NA rlstate 4.82680e+00 NA NA NA auto -3.11123e+01 NA NA NA pi 1.70815e+01 NA NA NA Residual standard error: 17.532862 on 295 degrees of freedom Number of observations: 303 Degrees of Freedom: 295 SSR: 90683.370466 MSE: 307.401256 Root MSE: 17.532862 Multiple R-Squared: -96.741634 Adjusted R-Squared: -99.060927 Will really appreciate it if anyone can point out what is going on. Thanks a lot!!! Carol |