Displaying 20 results from an estimated 5000 matches similar to: "lme model specification"
2012 Dec 04
1
Winbugs from R
Hi,
I am trying to covert a Winbugs code into R code. Here is the winbugs code
model{# model’s likelihoodfor (i in 1:n){time[i] ~ dnorm( mu[i], tau ) # stochastic componenent# link and linear predictormu[i] <- beta0 + beta1 * cases[i] + beta2 * distance[i]}# prior distributionstau ~ dgamma( 0.01, 0.01 )beta0 ~ dnorm( 0.0, 1.0E-4)beta1 ~ dnorm( 0.0, 1.0E-4)beta2 ~ dnorm( 0.0, 1.0E-4)#
2012 Oct 03
1
Errors when saving output from WinBUGS to R
Dear all
I used R2WinBUGS package's bugs() function to generate MCMC results. Then I
tried to save the simulation draws in R, using read.bugs() function. Here is
a simple test:
######################
library(coda)
library(R2WinBUGS)
#fake some data to test
beta0=1
beta1=1.5
beta2=-1
beta3=2
N=200
x1=rnorm(N, mean=0,sd=1)
x2=rnorm(N, mean=0,sd=1)
x3=rnorm(N, mean=0,sd=1)
lambda2= exp(beta0+
2012 Jul 02
1
How to get prediction for a variable in WinBUGS?
Dear all,I am a new user of WinBUGS and need your help. After running the following code, I got parameters of beta0 through beta4 (stats, density), but I don't know how to get the prediction of the last value of h, the variable I set to NA and want to model it using the following code.Does anyone can given me a hint? Any advice would be greatly appreciated.Best
2007 May 14
1
Hierarchical models in R
Is there a way to do hierarchical (bayesian) logistic regression in R, the
way we do it in BUGS? For example in BUGS we can have this model:
model
{for(i in 1:N) {
y[i] ~ dbin(p[i],n[i])
logit(p[i]) <- beta0+beta1*x1[i]+beta2*x2[i]+beta3*x3[i]
}
sd ~ dunif(0,10)
tau <- pow(sd, -2)
beta0 ~ dnorm(0,0.1)
beta1 ~ dnorm(0,tau)
beta2 ~ dnorm(0,tau)
beta3 ~
2012 May 27
7
Customized R Regression Output?
Hello R-Experts,
I am facing the problem that I have to estimate several parameters for a lot
of different dependent variables.
One single regression looks something like this:
y = beta0 + beta1 * x1 + beta2 * x2 + beta3 * x1 * x2 + beta4 * x4 + beta5 *
lag(x4,-1)
where y is the dependent variable and xi are the independent ones. Important
to me are the different estimates of betai and their
2010 Jun 23
1
Estimate of variance and prediction for multiple linear regression
Hi, everyone,
Night. I have three questions about multiple linear regression in R.
Q1:
y=rnorm(10,mean=5)
x1=rnorm(10,mean=2)
x2=rnorm(10)
lin=lm(y~x1+x2)
summary(lin)
## In the summary, 'Residual standard error: 1.017 on 7 degrees of freedom',
1.017 is the estimate of the constance variance?
Q2:
beta0=lin$coefficients[1]
beta1=lin$coefficients[2]
beta2=lin$coefficients[3]
2010 Nov 14
1
score test for logistic regression
Dear R experts,
I'm trying to find a code to calculate the p-value from the score test for the logistic regression. My fit is like this: logit=beta0+beta1*x1+beta2*x2 +....+ betak* xk. And my H0 is beta1=beta2=...=betak =0.
Any help will be highly appreciated. Thank you!
Ying
2008 Mar 19
1
betabinomial model
Hi,
can anyone help me fit betabinomial model to the following dataset where
each iD is a cluster in itself , if i use package aod 's betabinom model it
gives an estimate of zero to phi(the correlation coeficient ) and if i fix
it to the anova type estimate obtained from icc( in package aod) then it
says system is exactly singular. And when i try to fit my loglikelihood by
2005 Dec 01
2
Minimizing a Function with three Parameters
Hi,
I'm trying to get maximum likelihood estimates of \alpha, \beta_0 and
\beta_1, this can be achieved by solving the following three equations:
n / \alpha + \sum\limits_{i=1}^{n} ln(\psihat(i)) -
\sum\limits_{i=1}^{n} ( ln(x_i + \psihat(i)) ) = 0
\alpha \sum\limits_{i=1}^{n} 1/(psihat(i)) - (\alpha+1)
\sum\limits_{i=1}^{n} ( 1 / (x_i + \psihat(i)) ) = 0
\alpha \sum\limits_{i=1}^{n} (
2009 Sep 06
2
question about ... passed to two different functions
I have hit a problem with the design of the mcmc package I can't
figure out, possibly because I don't really understand the R function
call mechanism. The function metrop in the mcmc package has a ... argument
that it passes to one or two user-supplied functions, which are other
arguments to metrop. When the two functions don't have the same arguments,
this doesn't work.
2007 Oct 29
1
How to test combined effects?
Suppose I have a mixed-effects model where yij is the jth sample for
the ith subject:
yij= beta0 + beta1(age) + beta2(age^2) + beta3(age^3) + beta4(IQ) +
beta5(IQ^2) + beta6(age*IQ) + beta7(age^2*IQ) + beta8(age^3 *IQ)
+random intercepti + eij
In R how can I get an F test against the null hypothesis of
beta6=beta7=beta8=0? In SAS I can run something like contrast age*IQ
1,
2012 Aug 07
6
Decimal number
HI
>i have a little problem please help me to solve it
>this is the code in R:
>> beta0
[1] 64.90614
> beta1
[1] 17.7025
> beta
[1] 17 64
>her beta<- c(beta0, beta1)
thank you in advance
hafida
--
View this message in context: http://r.789695.n4.nabble.com/Decimal-number-tp4639428.html
Sent from the R help mailing list archive at Nabble.com.
2011 May 04
1
hurdle, simulated power
Hi all--
We are planning an intervention study for adolescent alcohol use, and I
am planning to use simulations based on a hurdle model (using the
hurdle() function in package pscl) for sample size estimation.
The simulation code and power code are below -- note that at the moment
the "power" code is just returning the coefficients, as something isn't
working quite right.
The
2008 Sep 12
1
Error in "[<-"(`*tmp*`, i, value = numeric(0)) :
I use "while" loop but it produces an errro. I have no idea about this.
Error in "[<-"(`*tmp*`, i, value = numeric(0)) :
nothing to replace with
The problem description is
The likelihood includes two parameters to be estimated: lambda
(=beta0+beta1*x) and alpha. The algorithm for the estimation is as
following:
1) with alpha=0, estimate lambda (estimate beta0
2004 Apr 21
2
Question on CAR appendix on NLS
The PDF file on the web, which is an appendix on nonlinear regression
associated with the CAR book, is very nice.
When I ran through the code presented there, I found something
odd. The code does a certain model in 3 ways: Vanilla NLS (using
numerical differentation), Analytical derivatives (where the user
supplies the derivatives) and analytical derivatives (using automatic
differentiation). The
2008 May 22
1
How to account for autoregressive terms?
Hi,
how to estimate a the following model in R:
y(t)=beta0+beta1*x1(t)+beta2*x2(t)+...+beta5*x5(t)+beta6*y(t-1)+beta7*y(t-2)+beta8*y(t-3)
1) using "lm" :
dates <- as.Date(data.df[,1])
selection<-which(dates>=as.Date("1986-1-1") & dates<=as.Date("2007-12-31"))
dep <- ts(data.df[selection,c("dep")])
indep.ret1
2013 Apr 03
3
Generating a bivariate joint t distribution in R
Hi,
I conduct a panel data estimation and obtain estimators for two of the
coefficients beta1 and beta2. R tells me the mean and covariance of the
distribution of (beta1, beta2). Now I would like to find the distribution
of the quotient beta1/beta2, and one way to do it is to simulate via the
joint distribution (beta1, beta2), where both beta1 and beta2 follow t
distribution.
How could we
2007 Dec 04
1
Metropolis-Hastings within Gibbs coding error
Dear list,
After running for a while, it crashes and gives the following error message: can anybody suggest how to deal with this?
Error in if (ratio0[i] < log(runif(1))) { :
missing value where TRUE/FALSE needed
################### original program ########
p2 <- function (Nsim=1000){
x<- c(0.301,0,-0.301,-0.602,-0.903,-1.208, -1.309,-1.807,-2.108,-2.71) # logdose
2006 Oct 17
4
if statement error
Hi List,
I was not able to make this work. I know it is a simple one, sorry to bother. Give me some hints pls. Thanks!
Jen
if(length(real.d)>=30 && length(real.b)>=30 && beta1*beta2*theta1*theta2>0 )
{ r <- 1; corr <- 1; }
real.d and real.b are two vectors, beta1,beta2,theta1,and theta2 are constants. The error occurred like this:
Error in if
2013 Mar 11
2
vertical lines in R plot
Dear All,
May I seek your suggestion on a simple issue. I want to draw vertical lines
at some positions in the following R plot. To be more specific, I wish to
draw vertical lines at d=c(5.0,5.5,6) and they should go till
p=c(0.12,0.60,0.20) . I haven't found any way out, though made several
attempts. Please run the following commands first if you are interested in!