Search found 11 matches
- Mon May 22, 2023 10:02 am
- Forum: R2MLwiN user forum
- Topic: Error in foreign:read.dta(chainfile[i])
- Replies: 2
- Views: 51748
Re: Error in foreign:read.dta(chainfile[i])
I tracked it down to the missing values in one character variable, recoded it to factor and problem solved. This was exact code from a year or so ago, so not sure if it is a result of package update, R update or my data transfers. Perhaps stupid on my part as I thought I had checked this, but error ...
- Mon May 15, 2023 3:43 pm
- Forum: R2MLwiN user forum
- Topic: Error in foreign:read.dta(chainfile[i])
- Replies: 2
- Views: 51748
Error in foreign:read.dta(chainfile[i])
Having difficulty when estimating a two-level binomial logit with MCMC on a dataframe of 15k rows. I previously had no problem with this model but I'm coming back to it on a new system.
Model is:
model <- runMLwiN(logit(outcome) ~ 1 + var1 + var2 + var3 + var4 + var5 + var6 + var7 + (1 | L2id ...
Model is:
model <- runMLwiN(logit(outcome) ~ 1 + var1 + var2 + var3 + var4 + var5 + var6 + var7 + (1 | L2id ...
- Thu Oct 06, 2022 10:25 am
- Forum: R2MLwiN user forum
- Topic: bug when setting starting parameters because of R update
- Replies: 1
- Views: 69626
bug when setting starting parameters because of R update
Since updating R I can no longer run models with start values and now receive error message
Error in if (class(testpd) == "try-error") { :
the condition has length > 1
From searching online it appears to be because of changes in that update that has affected multiple packages
https ...
Error in if (class(testpd) == "try-error") { :
the condition has length > 1
From searching online it appears to be because of changes in that update that has affected multiple packages
https ...
- Mon Jul 25, 2022 3:09 pm
- Forum: R2MLwiN user forum
- Topic: informative priorParam in random slope
- Replies: 2
- Views: 54738
Re: informative priorParam in random slope
This worked exactly as I wanted. Thanks very much for the help.
- Mon Jun 13, 2022 10:06 am
- Forum: R2MLwiN user forum
- Topic: informative priorParam in random slope
- Replies: 2
- Views: 54738
informative priorParam in random slope
I'm trying to run a random slope model with MCMC estimation:
runMLwiN(outcome ~ 1 + lev1_var + (1 + lev1_var | group_ID) + (1 | individual_ID), data = data, estoptions = list(EstM = 1, mcmcMeth = list(burnin = 500))
However, the model won't converge because the 'prior variance matrix is not ...
runMLwiN(outcome ~ 1 + lev1_var + (1 + lev1_var | group_ID) + (1 | individual_ID), data = data, estoptions = list(EstM = 1, mcmcMeth = list(burnin = 500))
However, the model won't converge because the 'prior variance matrix is not ...
- Tue Apr 20, 2021 2:05 pm
- Forum: R2MLwiN user forum
- Topic: Interaction plots for mlwinfitMCMC fixed effects
- Replies: 2
- Views: 64536
Re: Interaction plots for mlwinfitMCMC fixed effects
Thanks Chris this worked well. Wouldn't have worked it out without you.
Only change I made was to use bayestestR::hdi() to get credible intervals instead of the usual quantiles.
Only change I made was to use bayestestR::hdi() to get credible intervals instead of the usual quantiles.
- Wed Apr 07, 2021 4:05 pm
- Forum: R2MLwiN user forum
- Topic: Interaction plots for mlwinfitMCMC fixed effects
- Replies: 2
- Views: 64536
Interaction plots for mlwinfitMCMC fixed effects
Any recommendation for the best way to plot fixed interaction effects from mlwinfitMCMC objects?
Model is simple like:
m <- runmlwin(y ~ 1 + lev1x*lev1x + (1 | lev2id) + (1 | lev1id), estoptions = list(EstM = 1))
and want to plot the lev1x*lev1x
Would usually use plot_model from 'sjPlot' for ...
Model is simple like:
m <- runmlwin(y ~ 1 + lev1x*lev1x + (1 | lev2id) + (1 | lev1id), estoptions = list(EstM = 1))
and want to plot the lev1x*lev1x
Would usually use plot_model from 'sjPlot' for ...
- Mon Aug 31, 2020 11:44 am
- Forum: R2MLwiN user forum
- Topic: storing fitted values (propensity scores) from mlwinfitMCMC object
- Replies: 7
- Views: 67651
Re: storing fitted values (propensity scores) from mlwinfitMCMC object
I ran these examples and they all worked no problem so after a bit of trial and error I discovered the only reason it wasn't working is because one of the model variables was a character vector. Transforming it to factor and then running the full model allowed predict() to work.
What a load of work ...
What a load of work ...
- Thu Aug 27, 2020 8:12 pm
- Forum: R2MLwiN user forum
- Topic: storing fitted values (propensity scores) from mlwinfitMCMC object
- Replies: 7
- Views: 67651
Re: storing fitted values (propensity scores) from mlwinfitMCMC object
Here is model spec, basically just default with a bigger chain. Full formula does include a lot of variables and data is relatively large (>15k rows).
f <- logit(treatment, cons) ~ 1 + level1_var + level2_var + (1 | lev2)
mcmc1 <- runMLwiN(Formula = f, D = "Binomial", data = dat,
estoptions ...
f <- logit(treatment, cons) ~ 1 + level1_var + level2_var + (1 | lev2)
mcmc1 <- runMLwiN(Formula = f, D = "Binomial", data = dat,
estoptions ...
- Thu Aug 27, 2020 2:54 pm
- Forum: R2MLwiN user forum
- Topic: storing fitted values (propensity scores) from mlwinfitMCMC object
- Replies: 7
- Views: 67651
Re: storing fitted values (propensity scores) from mlwinfitMCMC object
Thanks for getting back, Chris. I worked around the immediate need by just calculating predictions in MLwiN UI then exporting worksheet back into R but this is obviously far from ideal. I probably should have given more info in my first post but I've tried both predict, fitted and augment and ...