r-zelig

How can one simulate quantities of interest from the posterior density in MCMCglmm?

旧街凉风 提交于 2020-01-02 19:22:09
问题 I would like to simulate quantities of interest from a model estimated with MCMCglmm more or less the way Zelig package does. In Zelig you can set the values you want for the independent values and software calculates the result for the outcome variable (expected value, probability, etc). An example: # Creating a dataset: set.seed(666) df <- data.frame(y=rnorm(100,20,20),z=rnorm(100,50,70)) # Loading Zelig library(Zelig) # Model m1.zelig <- zelig(y~z, data=df, model="ls") summary(m1.zelig) #

Using stargazer with Zelig

允我心安 提交于 2019-12-30 10:55:23
问题 I am trying to use stargazer (Version 5.2) to output the standard summary() results of a regression estimated with Zelig (Version 5.0.13). However, I obtain the error Error in envRefInferField(x, what, getClass(class(x)), selfEnv) : ‘result’ is not a valid field or method name for reference class “Zelig-ls” when trying to feed the estimated model into stargazer. A minimal working example reproducing the error would be library(Zelig) library(stargazer) data("swiss") z <- zls$new() z$zelig

Multi-level regression model on multiply imputed data set in R (Amelia, zelig, lme4)

不想你离开。 提交于 2019-12-22 05:25:22
问题 I am trying to run a multi-level model on multiply imputed data (created with Amelia); the sample is based on a clustered sample with group = 24, N= 150. library("ZeligMultilevel") ML.model.0 <- zelig(dv~1 + tag(1|group), model="ls.mixed", data=a.out$imputations) summary(ML.model.0) This code produces the following error code: Error in object[[1]]$result$call : $ operator not defined for this S4 class If I run a OLS regression, it works: model.0 <- zelig(dv~1, model="ls", data=a.out

Installing ZeligMultilevel. Error : object ‘describe’ is not exported by 'namespace:Zelig'

守給你的承諾、 提交于 2019-12-12 05:26:10
问题 I am trying to use ZeligMultilevel but I am having problems when opening the library. Please, see below: > install.packages("ZeligMultilevel") trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/ZeligMultilevel_0.7-1.zip' Content type 'application/zip' length 267971 bytes (261 KB) downloaded 261 KB package ‘ZeligMultilevel’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\AppData\Local\Temp\RtmpkHO9ls\downloaded_packages > library

degrees of freedom, t-statistic, and f-values of combined multiply imputed data

微笑、不失礼 提交于 2019-12-12 02:24:35
问题 I am a novice R user. I installed Zelig version 4.1-3 and Amelia II version 1.7. I am puzzled on how I can obtain the degrees of freedom, t-statistic, and f-values of combined multiply imputed data using R packages and functions. First, I loaded Amelia and Zelig: require(Amelia) require(Zelig) Then, I loaded the sample data that came with Amelia: data(freetrade) I created 5 imputations for this dataset using the amelia function. a.out <- amelia(freetrade, m = 5, ts = "year", cs = "country")

texreg-ing Tobit output from zelig package (R)

£可爱£侵袭症+ 提交于 2019-12-11 08:59:08
问题 This is a strange question, but here goes: I am trying to output my model results into a TeX table with texreg . reg <- zelig(Y ~ X, model = "tobit", below = 0, above = Inf) However, I'm getting an error from texreg : texreg(reg) Error in .local(model, ...) : Only the following Zelig models are currently supported: logit, ls, mlogit, ologit, probit, relogit. My question is basically: is this an error from Zelig or from texreg ? 回答1: UPDATE 2015-07-20: extract.zelig now has a tobit method (

How to get measures of model fit (AIC, F-statistics) in zelig for multiply imputed data?

三世轮回 提交于 2019-12-11 03:45:08
问题 Following up on an earlier post, I am interested in learning how to get the usual measures of the relative quality of a statistical model in zelig for regression using multiply imputed data (created with Amelia). require(Zelig) require(Amelia) data(freetrade) #Imputation of missing data a.out <- amelia(freetrade, m=5, ts="year", cs="country") # Regression model z.out <- zelig(polity~tariff+gdp.pc, model="ls", data=a.out$imputations) summary(z.out) Model: ls Number of multiply imputed data

Multi-level regression model on multiply imputed data set in R (Amelia, zelig, lme4)

*爱你&永不变心* 提交于 2019-12-05 07:28:32
I am trying to run a multi-level model on multiply imputed data (created with Amelia); the sample is based on a clustered sample with group = 24, N= 150. library("ZeligMultilevel") ML.model.0 <- zelig(dv~1 + tag(1|group), model="ls.mixed", data=a.out$imputations) summary(ML.model.0) This code produces the following error code: Error in object[[1]]$result$call : $ operator not defined for this S4 class If I run a OLS regression, it works: model.0 <- zelig(dv~1, model="ls", data=a.out$imputations) m.0 <- coef(summary(model.0)) print(m.0, digits = 2) Value Std. Error t-stat p-value [1,] 45 0.34

Using stargazer with Zelig

China☆狼群 提交于 2019-12-01 08:46:24
I am trying to use stargazer (Version 5.2) to output the standard summary() results of a regression estimated with Zelig (Version 5.0.13). However, I obtain the error Error in envRefInferField(x, what, getClass(class(x)), selfEnv) : ‘result’ is not a valid field or method name for reference class “Zelig-ls” when trying to feed the estimated model into stargazer. A minimal working example reproducing the error would be library(Zelig) library(stargazer) data("swiss") z <- zls$new() z$zelig(Fertility~Education, data=swiss) stargazer(z) I assume I need to somehow access the place where the

Why am I getting “algorithm did not converge” and “fitted prob numerically 0 or 1” warnings with glm?

大城市里の小女人 提交于 2019-11-26 07:29:40
问题 So this is a very simple question, just can\'t seem to figure it out. I\'m running a logit using the glm function, but keep getting warning messages relating to the independent variable. They\'re stored as factors and I\'ve changed them to numeric but had no luck. I also coded them to 0/1 but that did not work either. Please help! > mod2 <- glm(winorlose1 ~ bid1, family=\"binomial\") Warning messages: 1: glm.fit: algorithm did not converge 2: glm.fit: fitted probabilities numerically 0 or 1