Displaying 20 results from an estimated 700 matches similar to: "nls & fitting"
2004 Nov 04
3
calling a var by name in another var
Hello list,
I'd like to use a variable (or a column of a data frame) by using its name as a
string. E.g.:
Data2003 <- c(150,200,120)
Data2004 <- c(145,211,110)
myvar1 <- "Data2003"
myvar2 <- "Data2004"
# now I'd like do do this
total <- Data2003 + Data2004
# in any way like
# total <- ???(myvar1, myvar2)
# or
# total <- ???(myvar1) +
2012 Jul 26
4
names function not working at the 2nd place in a program
Hello,
I am using names function to name an array.
It works first time when I use *as.numeric(names(myVar1)*
However, at a place later, when I tried to use a very similar line of code
*as.numeric(names(myVar2)*, it always returned 'numeric(0)' (or if I only
type 'names(myVar2), it gave me NULL'.
Both myVar1 and myVar2 are type of integer. The only difference that I can
tell is
2008 Feb 15
1
Questions about EM algorithm
Dear all:
Assume I have 3 distributions, x1, x2, and x3.
x1 ~ normal(mu1, sd1)
x2 ~ normal(mu2, sd2)
x3 ~ normal(mu3, sd3)
y1 = x1 + x2
y2 = x1 + x3
Now that the data I can observed is only y1 and y2. It is
easy to estimate (mu1+m2), (mu1+mu3), (sd1^2+sd2^2) and
(sd1^2+sd3^2) by EM algorithm since
y1 ~ normal(mu1+mu2, sqrt(sd1^2+sd2^2)) and
y2 ~ normal(mu1+mu3, sqrt(sd1^2+sd3^2))
However, I want
2010 Mar 20
2
EM algorithm in R
Please help me in writing the R code for this problem. I've been solving this
for 4 days. It was hard for me to solve it. It's a simulation problem in R.
The problem is
My true model is a normal mixture which is given as
0.5 N(-0.8,1) + 0.5 N(0.8,1). This model has two components.
I will get a random sample of size 100 from this model. I will do this 300
times.
That means, I will have
2008 Apr 05
2
How to improve the "OPTIM" results
Dear R users,
I used to "OPTIM" to minimize the obj. function below. Even though I used
the true parameter values as initial values, the results are not very good.
How could I improve my results? Any suggestion will be greatly appreciated.
Regards,
Kathryn Lord
#------------------------------------------------------------------------------------------
x = c(0.35938587,
2008 Apr 05
2
How to improve the "OPTIM" results
Dear R users,
I used to "OPTIM" to minimize the obj. function below. Even though I used
the true parameter values as initial values, the results are not very good.
How could I improve my results? Any suggestion will be greatly appreciated.
Regards,
Kathryn Lord
#------------------------------------------------------------------------------------------
x = c(0.35938587,
2010 Jun 13
1
using latticeExtra plotting confidence intervals
I am wanting to plot a 95% confidence band using segplot, yet I am wanting
to have groups. For example if I have males and females, and then I have
them in different races, I want the racial groups in different panels. I
have this minor code, completely made up but gets at what I am wanting, 4
random samples and 4 samples of confidence, I know how to get A & B into one
panel and C&D in to
2009 Oct 31
1
Help me improving my code
Hi,
I am new to R. My problem is with the ordered logistic model. Here is my
question:
Generate an order discrete variable using the variable
wrwage1 = wages in first full calendar quarter after benefit application
in the following way:
*
wage*1*Ordered *=
1 *if*0 *· wrwage*1 *< *1000
2 *if*1000 *· wrwage*1 *< *2000
3 *if*2000 *· wrwage*1 *< *3000
4 *if*3000 *· wrwage*1 *<
2010 Jul 18
2
loop troubles
Hi all, I appreciate the help this list has given me before. I have a
question which has been perplexing me. I have been working on doing a
Bayesian calculating inserting studies sequentially after using a
non-informative prior to get a meta-analysis type result. I created a
function using three iterations of this, my code is below. I insert prior
mean and precision (I add precision manually
2008 Jan 24
2
testing coeficients of glm
Dear list,
i'm trying to test if a linear combination of coefficients of glm is equal
to 0. For example :
class 'cl' has 3 levels (1,2,3) and 'y' is a response variable. We want to
test H0: mu1 + mu2 - mu3 =0 where mu1,mu2, and mu3 are the means for each
level.
for me, the question is how to get the covariance matrix of the estimated
parameters from glm. but perhaps there
2011 Jun 13
2
use variable value to create new variable name
Hi,
Is it possible (and how) to use a variable value to create a name of a new R
variable? I want to do something like this:
for (i in 1:3) {
newvarialbe_#i# = somedata
}
where #i# is a value stored by i. In the first loop, there will be
newvariable_1, in second newvariable_2 and so on.
Thanks in advance,
Maciek
[[alternative HTML version deleted]]
2008 Jul 28
1
Mixed model question.
I continue to struggle with mixed models. The square zero version
of the problem that I am trying to deal with is as follows:
A number (240) of students are measured (tested; for reading
comprehension)
on 6 separate occasions. Initially (square zero) I want to treat the
test time as a factor (with 6 levels). The students are of course
``random effects''. Later I want to look at
2012 Oct 05
2
problem with convergence in mle2/optim function
Hello R Help,
I am trying solve an MLE convergence problem: I would like to estimate
four parameters, p1, p2, mu1, mu2, which relate to the probabilities,
P1, P2, P3, of a multinomial (trinomial) distribution. I am using the
mle2() function and feeding it a time series dataset composed of four
columns: time point, number of successes in category 1, number of
successes in category 2, and
2007 Oct 23
1
How to avoid the NaN errors in dnbinom?
Hi, The code below is giving me this error message:
Error in while (err > eps) { : missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In dnbinom(x, size, prob, log) : NaNs produced
2: In dnbinom(x, size, prob, log) : NaNs produced
I know from the help files that for dnbinom "Invalid size or prob will
result in return value NaN, with a warning", but I am not able
2008 Dec 08
1
Multivariate kernel density estimation
I would like to estimate a 95% highest density area for a multivariate
parameter space (In the context of anova). Unfortunately I have only
experience with univariate kernel density estimation, which is remarkebly
easier :)
Using Gibbs, i have sampled from a posterior distirbution of an Anova model
with k means (mu) and 1 common residual variance (s2). The means are
independent of eachother, but
2005 Nov 09
2
About: Error in FUN(X[[1]], ...) : symbol print-name too long
Hi,
I??m trying to use the Win2BUGS package from R and I have a similar problem
that reurns with the message:
Error in FUN(X[[1]], ...) : symbol print-name too long
But, there is no stray ` character in the file ( Sugestions given by: Duncan
Temple Lang <duncan>
Date: Mon, 26 Sep 2005 07:31:08 -0700 )
The progam in R is:
library(R2WinBUGS)
library(rbugs)
dat <-
2013 Feb 01
2
How does this function print, why is n1 which equals 1 printed as 2?
Windows 7, R 2.12.1
Colleagues,
I am trying to understand the n.for.2means function. The code below is a copy of the function (renamed to n.for.2means.js). I have inserted a single line of code towards the bottom of the function which uses the cat function to print the value of n1. You will note the value (preceded by stars) is printed as 1.
The function (1) prints a lot of output without any
2007 Mar 06
2
Estimating parameters of 2 phase Coxian using optim
Hi,
My name is Laura. I'm a PhD student at Queen's University Belfast and have
just started learning R. I was wondering if somebody could help me to see
where I am going wrong in my code for estimating the parameters [mu1, mu2,
lambda1] of a 2-phase Coxian Distribution.
cox2.lik<-function(theta, y){
mu1<-theta[1]
mu2<-theta[2]
lambda1<-theta[3]
2006 Jun 07
2
help with combination problem
hello:
I have 3 data.frame objects.
First df object:
Of dim (149,31). Columns 2:31 are marked as T1..T14
and N1..N16.
Name T1 T2 N1 T3 N2 N3 N4 T4
mu1 10 10 9 10 9 9 8 10
mu2 11 11 9 11 9 9 9 11
...
muN 12 12 9 11 9 9 8 12
Second df object:
of Dim (50000,31). Columns 2:31 are maked as T1...T14
and N1..N16.
2003 Nov 20
2
reading data rows
I have problems reading a file with more than one row
to carry out mathematical calculations
I have a a file of the form
mu1 mu2 alpha beta Wsigma sigmaA b r
25 15 .05 .05 22 3 .3 .5
30 20 .1 .2 22 .3 .3 .5
I intend to read one row , carry out the calculations
and then the next row with which I intend to do the
same calculations.
I do the following.