statistics - Save P values from R ivreg AER package or tsls sem package -


i want extract pr(>|t|) column after using either ivreg "aer" package or tsls "sem" package. both give list of terms similar , not seem provide looking for.

ivregest <- ivreg(mdetect~bednet | treat1+treat2, data=simdata) > names(ivregest)  [1] "coefficients"  "residuals"     "fitted.values" "weights"        [5] "offset"        "n"             "nobs"          "rank"           [9] "df.residual"   "cov.unscaled"  "sigma"         "call"           [13] "formula"       "terms"         "levels"        "contrasts"      [17] "model"         "y"  tslsest <-  tsls(mdetect~bednet , ~ treat1+treat2, data=simdata) > names(tslsest) [1] "n"             "p"             "coefficients"  "v"             [5] "s"             "residuals"     "response"      "model.matrix"  [9] "instruments"   "weights"       "response.name" "formula" 

the p though promising looking provides count of number of parameters being estimated in second stage regression. yet if use summary command on either of these objects return p value.

so 2 questions answered: 1. can find p-value? 2. how can find of hidden attributes of objects if looking f-stat next time or whatever know look? names() not seem sufficient.

thank can provide!

first, model taken file of function ivreg.

library(aer) data("cigarettessw") cigarettessw$rprice <- with(cigarettessw, price/cpi) cigarettessw$rincome <- with(cigarettessw, income/population/cpi) cigarettessw$tdiff <- with(cigarettessw, (taxs - tax)/cpi)  ## model  fm <- ivreg(log(packs) ~ log(rprice) + log(rincome) | log(rincome) +              tdiff + i(tax/cpi),             data = cigarettessw, subset = year == "1995") 

p-values, t-values , calculated when call summary() function on model. @ time function summary.ivreg() called. if need p-values should save result of summary() object. object (list) contains several parts , coefficients stored in matrix named coefficients.

sum.res<-summary(fm) names(sum.res)  [1] "call"          "terms"         "residuals"     ""              "coefficients"  "sigma"          [7] "df"            "r.squared"     "adj.r.squared" "waldtest"      "vcov"    

to coefficients:

sum.res$coefficients                estimate std. error   t value     pr(>|t|) (intercept)   9.8949555  1.0585599  9.347563 4.120910e-12 log(rprice)  -1.2774241  0.2631986 -4.853461 1.496034e-05 log(rincome)  0.2804048  0.2385654  1.175379 2.460247e-01 

p-values stored in 4. column of matrix:

sum.res$coefficients[,4]  (intercept)  log(rprice) log(rincome)  4.120910e-12 1.496034e-05 2.460247e-01  

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -