Displaying 20 results from an estimated 95 matches for "beta0".
Did you mean:
beta
2005 Dec 01
2
Minimizing a Function with three Parameters
...\alpha \sum\limits_{i=1}^{n} ( i / \psihat(i) ) - (\alpha + 1)
\sum\limits_{i=1}^{n} ( i / (x_i + \psihat(i)) ) = 0
where \psihat=\beta_0 + \beta_1 * i. Now i want to get iterated values
for \alpha, \beta_0 and \beta_1, so i used the following implementation
# first equation
l1 <- function(beta0,beta1,alpha,x) {
n<-length(x)
s2<-length(x)
for(i in 1:n) {
s2[i]<-log(beta0+beta1*i)-log(x[i]+beta0+beta1*i)
}
s2<-sum(s2)
return((n/alpha)+s2)
}
# second equation
l2 <- function(beta0,beta1,alpha,x) {
n<-length(x)
s1<-length(x)
s2<-length(x)...
2008 Sep 11
0
Loop for the convergence of shape parameter
Hello,
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 and beta1 via GLM)
2) with lambda, estimate alpha via ML estimation
3) with updataed alpha, replicate 1) and 2) until alpha is converged to a
value
I coded 1) and 2) (it works),...
2010 Mar 25
0
help with breaking loops used to fit covariates in nlme model building procedure
Dear All
I'm attempting to speed up my model building procedure, but need some help with the loops I've created...please bear with me through the explanation!
My basic model call is something like:
m0sulf.nlme<-nlme(conc~beta0*exp(-beta1*day)+beta2*exp(-beta3*day),
data=m0sulf,
fixed=(beta0+beta1+beta2+beta3~1),
random=pdDiag(beta0+beta1+beta2+beta3~1),
start=c(beta0=-300,beta1=15, beta2=300,beta3=0.5),...
2008 Sep 25
0
solving for beta0 in a logsitic regression
Hi all,
I am trying to create simulated data for exploring reclassfication
measures in a logistic setting with two continuous predictors and I
would like to set the average population probability of outcome rather
than the logistic beta0. Is there a way to find a beta0 that will
generate the desired average population probability of outcome given x,y
and their odds ratios?
#Here is an outline of what I would like to do:
pop.d=0.1
xvar=rnorm(5000,0,0.5)
yvar=rnorm(5000,0,0.5)
orx=16
ory=2
#find beta0
beta0=f(x...
2011 May 04
1
hurdle, simulated power
...zero_trt
-0.200134813
Three of the four look right (ie, converging to population values), but
the count_trt is stuck at zero, regardless of sample size (when it
should be ~ -0.20).
Does anyone see what's wrong?
Thanks for any input.
cheers, Dave
mysim <- function(n, beta0, beta1, alpha0, alpha1, theta){
trt <- c(rep(0,n), rep(1,n))
### mean function logit model
p0 <- exp(alpha0 + alpha1*trt)/(1 + exp(alpha0 + alpha1*trt))
### 0 / 1 based on p0
y1 <- as.numeric(runif(n)>p0)
### mean function count portion
mu <- exp(beta0 + beta1*trt)
### estima...
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.
2008 Aug 22
2
WinBUGS with R
...am new to both of things, so do not blame me too much...
I am busy with semiparametric regression and use WinBUGS to sample
posteriors.
The code to call Winbugs is as follows:
data <- list("y","X","n","m") #My variables
inits.beta <- rep(0,K)
inits.beta0 <- 0
inits <- function(){list(beta=inits.beta,beta0=inits.beta0,taueps=1.0E-3)}
parameters <- list("sigma","beta","beta0","y.star")
fitm <- bugs(data,inits,parameters,model.file="model.bug",
n.chains=3, n.iter=n.iter, n.burnin=n....
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 and beta1 via GLM)
2) with lambda, estimate alpha via ML estimation
3) with updated alpha, replicate 1) and 2) until alpha is converged to a
value
My source code is
alpha=rep...
2007 Dec 04
1
Metropolis-Hastings within Gibbs coding error
...l.b1 = current.b1 = ratio1 = double(Nsim) # blank vector
index <- 1:Nsim # creating index
a0 <- 10 # initial value (assumed) for tau
b0 <- (.01) # initial value (assumed) for tau
fit <- glm((y/n)~x,family=binomial, weight = n, data=dta) # initial value for beta
parameters <- c("Beta0", "Beta1", "Tau")
parameter.matrix <- array(NA,c(Nsim,3)) # blank array
parameter.matrix <- as.data.frame(parameter.matrix) # creating data frame
parameter.matrix[1,] <- c(fit$coef[1],fit$coef[2],rgamma(1, shape=a0, scale = b0)) # putting initial values
for (i in...
2006 Aug 26
1
problems with loop
...in 1 : length(sim[,1]))
{
if (tmp[k,1]==sim[n,1] && v[k]<=sim[n,2]){tmp[k,2]=1}
if(tmp[k,1]==sim[n,1] && v[k]>sim[n,2]) {tmp[k,2]=0}
}
}
return(tmp)
}
# The model to be fitted
Model_1=function(beta0_mod,mu_mod,k_mod,I_mod)
{
parms = c(beta0=beta0_mod, mu=mu_mod, k=k_mod)
my.atol = 1e-6
times1=c(0,0.002884615,0.003846154,0.005769231,0.009615385,0.01,0.019230769)
times2=c(0.028846154,0.038461538,0.057692308,
0.076923077,0.083333333,0.096153846)
times3=c(0.115384615,0...
2004 May 24
0
Seasonal ARIMA question - stat package (formerly ts)
...ction.
However, I can't seem to duplicate these predictions in a separate
program using the model coefficients. From duplicating simpler models,
I understand the input variables are adjusted by the intercept term.
(e.g. for an arima(1,0,0) the prediction equation is y(t) = beta1 * (
y(t-1) - beta0 ) + beta0 ....where beta0 is the intercept)
Currently, I've expected the prediction to follow the equation below:
y(t) = beta0 + [beta1*( y(t-1) - beta0 )] + [beta2 * epsilon(t-1)]
+ [beta3 * (y(t-12) - beta0)] + [beta4 * epsilon(t-12)]
This has proved unsuccessful. What equatio...
2005 May 19
1
R 2.1.0 RH Linux Built from Source Segmentation Fault
...39
resources_used.cpupercent=98
resources_used.cput=00:25:02
resources_used.mem=233536kb
resources_used.ncpus=1
resources_used.vmem=250252kb
resources_used.walltime=00:25:13
===========End of original message text===========
The second source file contains:
rmnlRwMetrop1=function(Data,Prior,Mcmc,beta0)
{
#
# purpose:
# draw from posterior for MNL using Independence Metropolis
#
# Arguments:
# Data - list of m,X,y
# m is number of alternatives
# X is nobs*m x nvar matrix
# y is nobs vector of values from 1 to m
# Prior - list of A, betabar
# A is nvar x nvar prior preci matr...
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 respective p-values
only. Now I have aprx. 50 different data sets of y and x1 to x4. So...
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 Regards,Bo------------------------model {for(i...
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)# definition of sigmas2<-1/taus <-sqrt(s2)# calculation of the sample variancefor (i in 1:n){ c.time[i]<-time[i]-mean(tim...
2010 Nov 30
1
StructTS with 2 seasons
...trend and season), the top line s determines the number of
seasons in a year (3 and 4 work fine, 2 gives the above error), and at
the end tries to fit the model. I am using R version 2.11.1, Windows XP.
# ----- Basic structural model -----
s <- 2 # frequency or period
mu0 <- 6
beta0 <- 1
it0 <- 0
it.states <- sample(1:6,s)
mu <- numeric() # mean
beta <- numeric() # slope
it <- numeric() # seasonal state
mu[1] <- mu0 + beta0 + rnorm(1,0,2)
beta[1] <- beta0 + rnorm(1,0,0.5)
it[1] <- - sum(it.states[2:s]) + rnorm...
2017 Mar 14
2
gráfico jpg png
...por png funciona, aparentemente hay un inconveniente para guardar en jpg.
Un código reproducible de internet con una modificación en el tipo de archivo es:
names = LETTERS[1:26] ## Gives a sequence of the letters of the alphabet
beta1 = rnorm(26, 5, 2) ## A vector of slopes (one for each letter)
beta0 = 10 ## A common intercept
for(i in 1:26){
x = rnorm(500, 105, 10)
y = beta0 + beta1[i]*x + 15*rnorm(500)
mypath <- file.path("C:","R","SAVEHERE",paste("myplot_", names[i], ".png", sep = ""))
png(file=mypath)
mytitle =...
2020 Oct 29
1
R: sim1000G
...al = sample(setdiff(1:ncol(gt),which(freq==0)),45)
beta.sign = rep(1,45)
c.value = 0.402
beta.abs = c.value*abs(log10(freq[causal]))
beta.val = beta.sign*beta.abs
x.bar = apply(gt[,causal],2,mean)
x.bar = as.matrix(x.bar)
beta.val = t(as.matrix(beta.val))
#disease prvalance = 1%
#beta0 = -log(99)-beta.val %*% x.bar
#disease prvalance = 1.5%
beta0 = 0-beta.val %*% x.bar
eta = beta.val %*% t(gt[,causal])
eta = as.vector(eta) + rep(beta0,nrow(gt))
prob = exp(eta)/(1+exp(eta))
genocase = rep(NA, sample.size)
set.seed(seed.num)
for(i in 1:sample.size){
genocase[...
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+ beta1*x1+ beta2 * x2 + beta3 * x3)
y=rep(NA,N)
for (i in 1: N) {
y[i]=rpois(1,lambda2[i])
}
#generate inputs required by winbugs
data <- list(Y20=y,x1=x1, x2=x2, x3=x...
2012 Nov 16
1
Interpretation of davies.test() in segmented package
...e change is occurring, in other words, the break
point
Use of segmented():
Segmented does a very good job of capturing the breakpoints and fitting
three distinct slopes, i.e. linear models. It does not, however give me
Pr(>|t|) for the break point coefficients. I need to answer the question
H:0 Beta0=Beta with a certainty metric, i.e. probability statistic. This is
especially important for my, flat looking data class.
davies.test() question:
davies.test() only excepts lm() or glm() objects as input. If I run
segmented to find 1 breakpoint instead of 2, I get a totally bogus answer.
Without kno...