Displaying 20 results from an estimated 8000 matches similar to: "computing the average response by nlme"
2005 Oct 27
1
syntax of nlme with nesting
This may appear too elementary to some on this list, but not to me. My
apologies if this is the case. I have mastered the lme function but the
nlme function has me stumped.
I am attempting to fit a nonlinear mixed model with 4 levels of nesting.
I am getting a cryptic error message and do not know what is wrong with
the syntax of the call. This is the call:
>
2002 Oct 10
2
Help?
Dear Sir :
I would ask if R contains some propreties to write the greeks(lambda,
theta,xsi,......) en also if R can also the mathematics signs like
integrals, indices.......
Your sincerly:
H.Zmarrou
University of Amsterdam:
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send
2008 Oct 19
1
multivariate integral with ADAPT when the parameter is close to boundary
Dear All,
There is one problem I encountered when I used ADAPT to compute some
2-D integral w.r.t beta density.
For example, when I try to run the following comments:
fun2<-function(theta){return(dbeta(theta[1],0.005,0.005)*dbeta(theta[2],0.005,0.005))}
int.fun2<-adapt(ndim=2,lo = c(0,0), up = c(1,1),functn = fun2,eps = 1e-4)
It seems it will take very long time to run. Acturally, I
2006 May 05
0
Spline integration & Gaussian quadrature (was: gauss.quad.prob)
Spencer
Thanks for your thoughts on this. I did a bit of work and did end up
with a method (more a trick), but it did work. I am certain there are
better ways to do this, but here is how I resolved the issue.
The integral I need to evaluate is
\begin{equation}
\frac{\int_c^{\infty} p(x|\theta)f(\theta)d\theta}
{\int_{-\infty}^{\infty} p(x|\theta)f(\theta)d\theta}
\end{equation}
Where
2005 Nov 09
1
strategies to obtain convergence using nlme
Hello. I am working on an analysis involving the nonlinear mixed model
function (nlme) in R. The data consist of measures of carbon fixation
by leaves as a function of light intensity and the parametric function
(standard in this area because it has a biological interpretation) is a
non-rectangular hyperbola. I cannot get the nonlinear mixed model
(nlme) function to converge cleanly. I am
2012 Feb 09
1
Constraint on one of parameters.
Dear all,
I have a function to optimize for a set of parameters and want to set a
constraint on only one parameter. Here is my function. What I want to do is
estimate the parameters of a bivariate normal distribution where the
correlation has to be between -1 and 1. Would you please advise how to
revise it?
ex=function(s,prob,theta1,theta,xa,xb,xc,xd,t,delta) {
expo1=
2009 Aug 17
2
Newbie that don't understand R code
I got some R code that I don't understand.
Question as comment in code
//where is t comming from, what is phi inverse
rAC <- function(name, n, d, theta){
#generic function for Archimedean copula simulation
illegalpar <- switch(name,
clayton = (theta < 0),
gumbel = (theta < 1),
frank = (theta < 0),
BB9 = ((theta[1] < 1) | (theta[2] < 0)),
GIG = ((theta[2] < 0) |
2009 May 19
2
what is wrong with this code?
dlogl <- -(n/theta)-sum((y/(theta)^2)*((1-exp(y/theta))/(1+exp(y/theta)))
d2logl <- (n/theta^2) - sum((-2y/theta^3)*(1-exp(y/theta))/(1+exp(y/theta)))
- sum(((2*y/theta^4)*exp(y/theta))/((1+exp(y/theta))^2))
returns the error message:
Error: unexpected symbol in:
"dlogl <- -(n/theta)-sum((y/(theta)^2)*((1-exp(y/theta))/(1+exp(y/theta)))
d2logl"
do you know what i have done
2008 Apr 22
2
optimization setup
Hi, here comes my problem, say I have the following functions (example case)
#------------------------------------------------------------
function1 <- function (x, theta)
{a <- theta[1] ( 1 - exp(-theta[2]) ) * theta[3] )
b <- x * theta[1] / theta[3]^2
return( list( a = a, b = b )) }
#-----------------------------------------------------------
function2<-function (x, theta)
{P
2005 Mar 16
1
Code to replace nested for loops
Dear list members,
How can I replace the nested for loops at then end of the script
below with more efficient code?
# Begin script__________________________________________________
# Dichotomous scores for 100 respondents on 3 items with
# probabilities of a correct response = .6, .4, and .7,
# respectively
x1 <- rbinom(100,1,.6)
x2 <- rbinom(100,1,.4)
x3 <- rbinom(100,1,.7)
#
2008 Mar 19
1
problem with optim and integrate
Dear all,
I want to min "integrate( (p1*dnorm+p2*dnorm+p3*dnorm)^(1.3))" for p, mu,
and sigma.
So, I have to estimate 8 parameters(p3=1-p1-p2).
I got this warning-"Error in integrate(numint, lower = -Inf, upper = Inf) :
non-finite function value."
My questions are
How could I fix it? I tried to divide into several intervals and sum up, but
I got same message.
My code is
2006 Apr 19
1
Function to approximate complex integral
I am writing a small function to approximate an integral that cannot be
evaluated in closed form. I am partially successful at this point and am
experiencing one small, albeit important problem. Here is part of my
function below.
This is a psychometric problem for dichotomously scored test items where
x is a vector of 1s or 0s denoting whether the respondent answered the
item correctly (1) or
2009 Aug 17
2
unnecessary braces?
the version 2 parser thinks I have unnecessary braces,
but I can't find any. False positive or am I missing
something? If a false positive, is there any way to
work around the warning?
* checking Rd files against version 2 parser ... WARNING
Warning: ./man/dbetabinom.Rd:32-34: Unnecessary braces at ?{p(x) = %
(C(N,x)*Beta(N-x+theta*(1-p),x+theta*p))/%
Beta(theta*(1-p),theta*p)}?
2008 Dec 27
1
indexed expression
Hello expeRts,
I need generate symbolize the autocovariances matrix of a Gaussian
ARMA(1,1), for derivate it and evaluate.
I try this codes, but whitout sucess
vacv<-NULL
vacv[1]<-1-2*phi*theta-theta^2
vacv[2]<-(1-phi*theta)*(phi-theta)
vacv[3:n]<-acv[2]*(phi^(1:(n-2)))
facv<-list()
for(i in 1:2)
2005 May 31
1
Solved: linear regression example using MLE using optim()
Thanks to Gabor for setting me right. My code is as follows. I found
it useful for learning optim(), and you might find it similarly
useful. I will be most grateful if you can guide me on how to do this
better. Should one be using optim() or stats4::mle?
set.seed(101) # For replicability
# Setup problem
X <- cbind(1, runif(100))
theta.true <- c(2,3,1)
y <- X
2011 Aug 17
2
An example of very slow computation
This message is about a curious difference in timing between two ways of computing the
same function. One uses expm, so is expected to be a bit slower, but "a bit" turned out to
be a factor of >1000. The code is below. We would be grateful if anyone can point out any
egregious bad practice in our code, or enlighten us on why one approach is so much slower
than the other. The problem
2006 Jul 25
5
greek letters, text, and values in labels
Hello,
I want to have a title that will look something like:
"Results for \theta=2.1", given that I have a variable theta=2.1, and
\theta should show on the screen like the greek letter.
I've tried a lot of things:
theta <- 2.1
plot(1:10, main=expression(paste("Results for", theta, "=", eval(theta))))
or using bquote
plot(1:10, main=paste("Results for
2009 Nov 08
3
MCMC gradually slows down
Hello,
I have written a simple Metropolis-Hastings MCMC algorithm for a
binomial parameter:
MHastings = function(n,p0,d){
theta = c()
theta[1] = p0
t =1
while(t<=n){
phi = log(theta[t]/(1-theta[t]))
phisim = phi + rnorm(1,0,d)
thetasim = exp(phisim)/(1+exp(phisim))
r = (thetasim)^4*(1-thetasim)^8/(theta[t]^4*(1-theta[t])^8)
if(runif(1,0,1)<r){
theta[t+1] = thetasim
}
2014 Mar 03
1
reference classes, LAZY_DUPLICATE_OK, and external pointers
We (the lme4 authors) are having a problem with doing a proper deep
copy of a reference class object in recent versions of R-devel with
the LAZY_DUPLICATE_OK flag in src/main/bind.c enabled.
Apologies in advance for any improper terminology.
TL;DR Is there an elegant way to force non-lazy/deep copying in our
case? Is anyone else using reference classes with a field that is an
external pointer?
2012 Dec 04
1
Solve system of equations (nleqslv) only returns origin
I'm solving 4 complex equations simultaneously. Code is below. The code
returns only zero's for the solution though there should also be a non-zero
result. I'm pretty confident that the equations are correct because they
are straight from a published paper and I checked them pretty thoroughly.
The parameter values I used are from the published paper as well. Any
suggestions for how