Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 16127

Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.

2 votes
1 answer
6k views

Problems optimizing a likelihood function in R

I'm trying to maximize the log-likelihood $y_1 \log(p_1) + (1-y_1)\log(p_1) + y_2\log(p_2) + (1-y_2)\log(p_2)$. I have data on success of an experiment. Y identifies if person died or not, and X ident …
user1172558's user avatar
1 vote
1 answer
3k views

How to define contrast coefficient matrix?

I have this data data <- as.data.frame(cbind(y,x1,x2,pre)) data$x1 <- as.factor(data$x1) data$x2 <- as.factor(data$x2) data$x1 <- C(data$x1, contr.treatment, base=3) data$x2 <- C(data$x2, contr.tre …
user1172558's user avatar
1 vote
1 answer
458 views

How do I fit a constrained regression in R?

I haven't done this kind of thing before, and I'd like to have some help to solve this issue in R. I observe $z_i$ (money) and four characteristics of population. … From this I can find $$\frac{D_2}{D_1} = \tilde{\alpha} + \tilde{\beta} \qquad \frac{D_3}{D_1} = 1 - \tilde{\beta} \qquad \frac{D_4}{D_1} = \tilde{\alpha}$$ I want to estimate the equation above in R
user1172558's user avatar
3 votes
1 answer
2k views

How can I make a predict plot varying two variables in R?

I guess I could do that using predict() function in R, but I am running a model that does not have such function developed yet. …
user1172558's user avatar
1 vote
1 answer
4k views

Code Problem in Lognormal Bayesian Model in JAGS/WinBUGS

head(x) gdp.cap bf.cap 1 8.789771 0.03911118 2 10.204732 0.02341257 3 6.890112 0.04160150 4 9.178957 0.03892352 5 9.384171 0.03880186 6 9.562188 0.04165802 I'm calling JAGS from R … for (j in 1:K) { # b are the number betas to be estimated beta[j] ~ dnorm(m[j], prec[j]) } # Prior for precision of Y tau ~ dgamma(tau.a, tau.b) sigma <- 1/sqrt(tau) } 2) In R: …
user1172558's user avatar