Displaying 20 results from an estimated 10000 matches similar to: "R help?"
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} (
2012 Apr 05
1
integrate function - error -integration not occurring with last few rows
Hi,
I am using the integrate function in some simulations in R (tried ver 2.12
and 2.15). The problem I have is that the last few rows do not integrate
correctly. I have pasted the code I used.
The column named "integral" shows the output from the integrate function.
The last few rows have no integration results. I tried increasing the
doses, number of subjects, etc.... this error occurs
2009 Nov 05
1
Simulate data for spline/piecewise regression model
Dear All,
I am trying to simulate data for a spline/piecewise regression model. I am missing something fundamental in my simulation procedure because when I try to fit my simulated data using the Gauss-Newton method in SAS, I am getting some wacky parameter estimates. Can anyone please check my simulation code and tell me what mistake I am making in generating data for spline model?
Thank you
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
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.
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
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)#
2017 Mar 14
2
gráfico jpg png
Estimados
Hace unos días envié un correo porque tenía problemas para guardar los gráficos en el disco rígido, utilizando R server 9, comentaba que el código antes funcionaba pero que tenía fallas.
No encuentro mi mensaje en la lista para continuar el hilo, encontré el problema, no lo comprendo del todo pero cambiando jpg por png funciona, aparentemente hay un inconveniente para guardar en jpg.
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
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 ~
2009 Sep 28
1
Using linear formula inside MLE
Say I have a formula Y ~ 1 + X, where X is a categorical variable. A
previous thread showed how to evaluate this model using the mle package
from "stats4" (see below). But, the user had to create the data matrix,
X, including the column of one's for the regression constant. Is there a
way to nest the linear formula in the code below, so the data matrix
doesn't explicitly
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]
2017 Jul 28
3
Superscript and subscrib R for legend x-axis and y-axis and colour different subjects in longitudinal data with different colours
I am trying to make a x-axis and y-axis titles with both a special character and a subscript. I am not being able to do this. I think its just a placing of my parenthesis, but I've tried (seemingly) everything.
Even more, when I try the blog users code it works.
Is it because I?m using longitudinal data?
Even more. Is it possible to colour each one of the 15 lines with a different
2005 Jun 09
2
lme model specification
Dear All,
I am trying to specify the following fixed effects model for lme:
y ~ constant1 - beta1*(x - beta2)
where y is the response, x is the independent variable, and the
operators above are real arithmetic operations of addition, subtraction,
and multiplication. I realize that this model is just a
reparameterization of y=beta0+beta1*x, but I am using this
parameterization because I am
2005 Jul 20
1
nls
Dear R-helpers,
I am trying to estimate a model that I am proposing, which consists of putting
an extra hidden layer in the Markov switching models. In the simplest case the
S(t) - Markov states - and w(t) - the extra hidden variables - are independent,
and w(t) is constant. Formally the model looks like this:
y(t)=c(1,y[t-1])%*%beta0*w+c(1,y[t-1])%*%beta1*(1-w). So I ran some simulations
to
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
2005 Jul 08
2
time series regression
Hi:
I have two time series y(t) and x(t). I want to
regress Y on X. Because Y is a time series and may
have autocorrelation such as AR(p), so it is not
efficient to use OLS directly. The model I am trying
to fit is like
Y(t)=beta0+beta1*X(t)+rho*Y(t-1)+e(t)
e(t) is iid normal random error. Anybody know whether
there is a function in R can fit such models? The
function can also let me specify