Displaying 20 results from an estimated 21 matches for "gamma1".
Did you mean:
gamma
2016 Apr 18
0
R [coding : do not run for every row ]
...ject: Re: [R] R [coding : do not run for every row ]
>
> You can make this much more readable with apply functions.
>
> result <- apply(
> all_combine1,
> 1,
> function(x){
> p.value <- sapply(
> seq_len(nSims),
> function(sim){
> gamma1 <- rgamma(x["m"], x["sp(skewness1.5)"], x["scp1"])
> gamma2 <- rgamma(x["n"], x["scp1"], 1)
> gamma1 <- gamma1 - x["sp(skewness1.5)"] * x["scp1"]
> gamma2 <- gamma2 - x["sp(skewne...
2016 Apr 18
0
R [coding : do not run for every row ]
...e1))
> {
> #generate samples from the first column and second column
> m<-all_combine1[ss,1]
> n<-all_combine1[ss,2]
>
> for (sim in 1:nSims)
> {
> #generate 2 random samples from gamma distribution with equal skewness
> gamma1<-rgamma(m,all_combine1[ss,3],all_combine1[ss,4])
> gamma2<-rgamma(n,all_combine1[ss,4],1)
>
> # minus the population mean to ensure that there is no lose of equality of mean
> gamma1<-gamma1-all_combine1[ss,3]*all_combine1[ss,4]
> gamma2<-g...
2016 Apr 18
3
R [coding : do not run for every row ]
...e1))
> {
> #generate samples from the first column and second column
> m<-all_combine1[ss,1]
> n<-all_combine1[ss,2]
>
> for (sim in 1:nSims)
> {
> #generate 2 random samples from gamma distribution with equal skewness
> gamma1<-rgamma(m,all_combine1[ss,3],all_combine1[ss,4])
> gamma2<-rgamma(n,all_combine1[ss,4],1)
>
> # minus the population mean to ensure that there is no lose of equality of mean
> gamma1<-gamma1-all_combine1[ss,3]*all_combine1[ss,4]
> gamma2<-g...
2016 Apr 18
0
R [coding : do not run for every row ]
You can make this much more readable with apply functions.
result <- apply(
all_combine1,
1,
function(x){
p.value <- sapply(
seq_len(nSims),
function(sim){
gamma1 <- rgamma(x["m"], x["sp(skewness1.5)"], x["scp1"])
gamma2 <- rgamma(x["n"], x["scp1"], 1)
gamma1 <- gamma1 - x["sp(skewness1.5)"] * x["scp1"]
gamma2 <- gamma2 - x["sp(skewness1.5)"]...
2016 Apr 17
2
R [coding : do not run for every row ]
...combine matrix
for(ss in 1:nrow(all_combine1))
{
#generate samples from the first column and second column
m<-all_combine1[ss,1]
n<-all_combine1[ss,2]
for (sim in 1:nSims)
{
#generate 2 random samples from gamma distribution with equal skewness
gamma1<-rgamma(m,all_combine1[ss,3],all_combine1[ss,4])
gamma2<-rgamma(n,all_combine1[ss,4],1)
# minus the population mean to ensure that there is no lose of equality of mean
gamma1<-gamma1-all_combine1[ss,3]*all_combine1[ss,4]
gamma2<-gamma2-all_combine1[ss,3]...
2016 Apr 19
0
problem on simulation code (the loop unable to function effectively)
...for(ss in 1:nrow(all))
>
> { #generate samples from the first column and second column
> m<-all[ss,1]
> n<-all[ss,2]
>
> for ( sim in 1:nSims)
> {
> #generate 2 random samples from gamma distribution with equal
> skewness
> gamma1<-rgamma(m,16/9,all[ss,3])
> gamma2<-rgamma(n,16/9,1)
> #minus population mean from each sample to maintain the equality of
> null #hypotheses (population mean =scale parameter *shape
> parameter)
> gamma1<-gamma1-16/9*all[ss,3]
> gamma2<-gamma2-16/9
>...
2010 Sep 16
4
Pesky homemade function code
...j in 1:dim(index)[1]){
time[j]=abs(data$times[data$ids==id[1]][index[j,1]]-data$times[data$ids==id[1]][index[j,2]])
gamma[j]=.5*(data$resids[data$ids==id[1]][index[j,1]]-data$resids[data$ids==id[1]][index[j,2]])^2
}
for (i in id[-1]){
index=combinations(length(data$times[data$ids==i]),2)
time1=gamma1=numeric(dim(index)[1])
for (j in 1:dim(index)[1]){
time1[j]=abs(data$times[data$ids==i][index[j,1]]-data$times[data$ids==i][index[j,2]])
gamma1[j]=.5*(data$resids[data$ids==i][index[j,1]]-data$resids[data$ids==i][index[j,2]])^2
}
time=c(time,time1)
gamma=c(gamma,gamma1)
}
value=list(time=time...
2016 Apr 19
0
problem on simulation code (the loop unable to function effectively)
...first column and second column
>>> m<-all[ss,1]
>>> n<-all[ss,2]
>>>
>>> for ( sim in 1:nSims)
>>> {
>>> #generate 2 random samples from gamma distribution with equal
>>> skewness
>>> gamma1<-rgamma(m,16/9,all[ss,3])
>>> gamma2<-rgamma(n,16/9,1)
>>> #minus population mean from each sample to maintain the equality of
>>> null #hypotheses (population mean =scale parameter *shape
>>> parameter)
>>> gamma1<-gamma1-16/9*al...
2009 Nov 05
1
Simulate data for spline/piecewise regression model
...Sets the sample of subjects for whom the data is to be generated#
knot = 8 #Specifies the value of knot/change point#
beta0 = 3 #Specifies the value of intercept for x <= knot#
beta1 = 8 #Specifies the value of slope for x <= knot#
gamma0 = 6 #Specifies the value of intercept for x > knot#
gamma1 = 5 #Specifies the value of slope for x > knot#
#The following intializes empty (NA) vectors#
X = rep(NA,subjects)
Y = rep(NA, subjects)
DATA = rep(NA, subjects)
#The following sample x.values from uniform distribution#
X = runif(subjects,1,20)
# For loop for computing y-values by comparing...
2011 Jun 07
0
WinBUGS on survival, simple but confusing question
...be passed into WinBUGS
surt.BUGS = surt;
surt.BUGS[surt >= surt.cens] = NA;
if(any(is.na(surt.BUGS))) cat("surt.BUGS taking NA (censored) value at",
which(is.na(surt.BUGS)), ".\n");
surt.cens.BUGS = surt.cens;
surt.cens.BUGS[surt < surt.cens] = 0;
## non-info prior
sd.gamma1 = sd.gamma2 = 1e-2;
pos.lim = 1e-4;
norm.sd = 1e-3;
BUGS.data = list("N", "Treat", "surt.BUGS", "surt.cens.BUGS", "sd.gamma1",
"sd.gamma2", "norm.sd", "pos.lim");
BUGS.parameters = c("alpha", "surt.sigm...
2004 Oct 27
2
Skewness and Kurtosis
Hi,
in which R-package I could find skewness and kurtosis
measures for a distribution?
I built some functions:
gamma1<-function(x)
{
m=mean(x)
n=length(x)
s=sqrt(var(x))
m3=sum((x-m)^3)/n
g1=m3/(s^3)
return(g1)
}
skewness<-function(x)
{
m=mean(x)
me=median(x)
s=sqrt(var(x))
sk=(m-me)/s
return(sk)
}
bowley<-function(x)
{
q<-as.vector(quantile(x,prob=c(.25,.50,.75)))
b=(q[3]+q[1]-2*q[2])/(q[3]-q[2])
re...
2006 May 19
0
how to estimate adding-regression GARCH Model
...question in using fSeries package--the funciton garchFit and
garchOxFit
if adding a regression to the mean formula, how to estimate the model in
R? using garchFit or garchOxFit?
For example, Observations is {x,y}_t,there may be some relation between x
and y.
the model is
y_t=gamma0 + *gamma1*x_t*+psi*e_{t-1}+e_t the gamma1*x_t is
regression.
e_t=sqrt(h_t)*N(0,1)
h_t=alpha0+alpha1*e_t^2+beta*h_{t_1}~~~~~~~GARCH(1,1).
I didn't know how to estimate the model using function garchFit or
garchOxFit or other functions? because the argument in
garchFit/garchOxFit is f...
2009 Apr 11
2
who happenly read these two paper Mohsen Pourahmadi (biometrika1999, 2000)
...I found I really can get the same or close output as he did,so,any one who
have happenly read his paper,got any idea how he got the LS estimates of
gamma.
he assumed the autoregressive phi_tj satisfy the cubic function on lag of
time,where t is from 1 to 11,j from 1 to t-1,his model is:
phi_tj=gamma1+gamma2*(t-j)+gamma3*(t-j)^2+gamma4*(t-j)^3, #biometrika
1999,page685
at first moment ,I thougt my design matrix should be
1 1 1 1
1 2 4 8
1 3 9 27.....
but I found this is wrong,actually I should(I think) use a polynomial design
matirx with level of 11,degree=3
here is my rocode~~...
2013 Nov 16
1
r documentation rugarch egarch
....nabble.com/RUGARCH-eGARCH-and-variance-targeting-td4634896.html
someone proposes to read the "vignette on how the unconditional variance is
calculated for the eGARCH
model"
I don`t know what is meant by vignette.
The R-built-in help function tells me about eGARCH: "assymetry term: gamma1"
Thanks a lot R-help. This is relly a lot of information.
I`d like to find out about the eGARCH model notation used in R, the settings
and estimation techniques that are used and/or can be configured in this
case, ...
When searching the internet I`ve also not been very successful.
When work...
2012 Dec 04
1
Solve system of equations (nleqslv) only returns origin
...000
L=12600
theta=0.6
psale=0.6
mu=psale*(1-theta)
alphah=0.15
Cg=6240
Cs=2820
A= 100
D=0.0001
greekp=0.43
K=100000
##### Species Parameters ##########
b1=0.38
p1=16654
v1 = 0.28
N1=6000
g1=1
delta1=1
b2=0.4
p2=2797
v2 = 0.31
N2=10000
g2=1
delta2=1
### Define functions with vector x = c(Lg, Ls, gamma1, gamma2, lamda)
firstordercond <- function (x) {
y=numeric(4)
y[1]=(alphah/x[3])-(x[5]*((p1-(((theta+mu)*(((N1/A)*g1^greekp*x[1]^b1)+K))+((theta+mu)*(((1-exp(-2*D*v1*N1))*x[2])+K))))*(((N1/A)*g1^(greekp))*x[1]^b1+(2*v1*N1*D)*x[2])
+
delta1*theta*(((N1/A)*g1^(greekp))*x[1]^b1+(2*v1*...
2011 Dec 01
1
Estimation of AR(1) Model with Markov Switching
...# convert into time series object
y <- ts(y, start = 1, freq = 1)
# construct negative conditional likelihood function
neg.logl <- function(theta, data) {
# construct parameters
beta_s0 <- theta[1:2]
beta_s1 <- theta[3:4]
sigma2 <- exp(theta[5])
gamma0 <- theta[6]
gamma1 <- theta[7]
# construct probabilities
#probit specification
p_s0_s0 <- pnorm(gamma_s0)
p_s0_s1 <- pnorm(gamma_s1)
p_s1_s0 <- 1-pnorm(gamma_s0)
p_s1_s1 <- 1-pnorm(gamma_s1)
# create data matrix
X <- cbind(1,y)
# assume erogodicity of the markov chain
# use unconditional pr...
2002 Apr 22
3
glm() function not finding the maximum
...() function. Indeed, it is the reason
why I switched to R from Splus. The Splus analogue was very slow, and
didn't find the maximum.
The data set and code for the two methods of estimation are included
below. I don't think I am making a mistake here. Sorry if I have.
Thanks
Richard
> gamma1(data) #uses the glm() function
$loglik
[1] 875.4274
$par
[1] 9.572403e-02 4.345771e+03
> gamma2(data) #"by hand" using optim()
$loglik
[1] 793.3913
$par
[1] 0.518145 802.854297
#Data set
data_c(51.47, 210.19, 49.55, 61.93, 60.61, 744.57, 338.59, 133.93,
191.57, 111.43, 432.83, 18...
2007 May 08
0
Question on bivariate GEE fit
Hi,
I have a bivariate longitudinal dataset. As an example say,
i have the data frame with column names
var1 var2 Unit time trt
(trt represents the treatment)
Now suppose I want to fit a joint model of the form for the *i* th unit
var1jk = alpha1 + beta1*timejk + gamma1* trtjk + delta1* timejk:trtjk +
error1jk
var2 = alpha2 + beta2*timejk + gamma2* trtjk + delta2* timejk:trtjk +
error2jk
where j index time and k index the treatment received
Using indicator variables I have been able to fit and run the code for
a bivariate model using unstructured covariance m...
2011 Sep 15
0
garchFit
...t". Maybe it would help me just to know what the coefficients are
telling me.
I do already understand well what functions like arima or garch are doing
and telling me. So the problem should not be mathematical, but i do not
understand what exactly are mu, omega, alpha1, ..., beta1,... or also
gamma1,...
instead to the coefficiebts a0,a1,...,b1,... of the garch function.
many thanks
Roland
--
View this message in context: http://r.789695.n4.nabble.com/garchFit-tp3815122p3815122.html
Sent from the R help mailing list archive at Nabble.com.
2006 Oct 27
0
VGAM package released on CRAN
...Fisk Distribution family function
frank Frank's Bivariate Distribution Family Function
frechet2 Frechet Distribution Family Function
freund61 Freund's (1961) Bivariate Extension of the
Exponential Distribution
gamma1 1-parameter Gamma Distribution
gamma2 2-parameter Gamma Distribution
gammahyp Gamma Hyperbola Bivariate Distribution
gaussianff Gaussian (normal) Family Function
genbetaII Generalized Beta Distribution of the Second Kind
ge...