Displaying 20 results from an estimated 6000 matches similar to: "question about optim"
2011 May 19
3
problem with optim()
Dear R-users,
I would like to maximize the function g above which depends on 4 parameters (2 vectors, 1 real number, and 1 matrix) using optim() and BFGS method. Here is my code:
# fonction to maximize
g=function(x)
{
x1 = x[1:ncol(X)]
x2 = x[(ncol(X)+1)]
x3 = matrix(x[(ncol(X)+2):(ncol(X)+1+ncol(X)*ncol(Y))],nrow=ncol(X),ncol=ncol(Y))
x4 = x[(ncol(X)+1+ncol(X)*ncol(Y)+1):length(x)]
2011 Apr 14
0
question about optim
thank you very much for your response!
But I have now another problem: optim( ) gives me the exactly same initial values for the 4 parameters. I have tried many initial values, and it always didnt change them.
opt$convergence = 1. I increased the number of iterations, but the problem is still there. I also made sure that the function doesnt return "NAN" or "INF" values...
2004 Jun 01
1
swapping with data.frame
Hi there,
I have some data which are convenient to enter as lists. For example:
t1<-list(fname="animal1",testname="hyla",dspkr="left",res1=39.7,res2=15.0)
t2<-list(fname="animal1",testname="bufo",dspkr="left",res1=14.4,res2=56.1)
2012 Jan 04
1
function in R for my exercise
Hi R helpers!
I have a question. I'm trying to create a function for an exercise. Here are
the arguments I should include:
x and y are numeric
z is a name ("plus","minus","multiply","divide")
and swap is logical.
Here is what the function should do:
When z="plus", then x+y is performed and so on for the other z names. It
should give a NA
2006 Aug 18
1
multivariate analysis by using lme
Dear R users,
I have a data structure as follows:
id two res1 res2 c1 c2 inter
1 -0.786093166 1 0 1 2 6
3 -0.308495749 1 0 0 1 2
5 -0.738033048 1 0 0 0 1
7 -0.52176252 1 0
2000 Jul 05
1
Tukey.aov with split-plot designs
I am using R 1.1 with Redhat 6.2 and RW 1.001 with Win98 (the upkey doesn't
work on my IBM either as has been previously reported by others).
The function aov doesn't return either the residuals or the residual
degrees of freedom for split-plot designs.
If you use the following code from Baron and Li's "Notes on the use of R
for psycology experiments and questionnaires"
2013 Apr 29
1
how to add new rows in a dataframe?
Hi,
dat1<- read.table(text="
id??????????????? t???????????????????? scores
2???????????????? 0??????????????????????? 1.2
2???????????????? 2???????????????????????? 2.3
2???????????????? 3??????????????????????? 3.6
2???????????????? 4??????????????????????? 5.6
2???????????????? 6??????????????????????? 7.8
3???????????????? 0??????????????????????? 1.6
3????????????????
2010 Jul 20
1
p-values pvclust maximum distance measure
Hi,
I am new to clustering and was wondering why pvclust using "maximum"
as distance measure nearly always results in p-values above 95%.
I wrote an example programme which demonstrates this effect. I
uploaded a PDF showing the results
Here is the code which produces the PDF file:
-------------------------------------------------------------------------------------
s <-
2003 Aug 21
4
anova(lme object)
Hi,
I use lme to fit models like
R> res1 <- lme(y~A+B, data=mydata, random=~1|subject)
R> res2 <- lme(y~B+A, data=mydata, random=~1|subject)
(only difference between these two models are the
sequence in which the indep variables are written in
formula)
where y is continuous and A, B, and subject are
factors. To get ANOVA table I used
R> anova(res1)
R> anova(res2)
and found
2005 Jul 19
1
initial points for arms in package HI
Dear R-users
I have a problem choosing initial points for the function arms()
in the package HI
I intend to implement a Gibbs sampler and one of my conditional
distributions is nonstandard and not logconcave.
Therefore I'd like to use arms.
But there seem to be a strong influence of the initial point
y.start. To show the effect I constructed a demonstration
example. It is reproducible
2007 Nov 12
2
strange `nls' behaviour
I initially thought, this should better be posted to r-devel
but alas! no response. so I try it here. sory for the
lengthy explanation but it seems unavoidable. to quickly see
the problem simply copy the litte example below and execute
f(n=5)
which crashes. called with n != 5 (and of course n>3 since
there are 3 parameters in the model...) everything is as it
should be.
in detail:
2013 Apr 14
1
possible loop problem
Hi,
It would be better if you provided the output of dput(dataset).? I am not sure about the structure of your dataset.
Just from reading the data as is shown.
dat1<- read.table(text="
separator,tissID
>,>,2
,2,1
,6,5
,11,13
>,>,4
,4,9
,6,2
,7,3
,21,1
,23,58
,25,9
,26,4
>,>,11
,1,12
>,>,21
,4,1
,11,3
2011 Aug 04
1
How to get the test statistic corresponding to the p-value in mtable?
Dear R-Users,
I want to use mtable from package "memisc" to produce Latex-style estimation
output. However, mtable() only gives me a p-value and not the corresponding
test-statistic. Does anyone know how to extract it, either from a glm/anova
object or mtable? Here is a short example:
# Run this ####################
install.packages("memisc")
library(memisc)
set.seed(1)
2011 Feb 24
2
MCMCpack combining chains
Deal all, as MCMClogit does not allow for the specification of several chains, I have run my model 3 times with different random number seeds and differently dispersed multivariate normal priors.
For example:
res1 = MCMClogit(y~x,b0=0,B0=0.001,data=mydat, burnin=500, mcmc=5500, seed=1234, thin=5)
res2 = MCMClogit(y~x,b0=1,B0=0.01,data=mydat, burnin=500, mcmc=5500, seed=5678, thin=5)
res3 =
2012 Aug 06
1
cannot find function "simpleRDA2"
Hi,
I am trying to run the command "forward.sel.par," however I receive
the error message: "Error: could not find function 'simpleRDA2'." I
have the vegan library loaded. The documentation on "varpart" has not
helped me to understand why I cannot call this function. Maybe I am
missing something obvious because I am still an 'R' novice.
Below is a
2007 Aug 15
3
Formula in lm inside lapply
I am trying to run separate regressions for different groups of
observations using the lapply function. It works fine when I write the
formula inside the lm() function. But I would like to pass formulae into
lm(), so I can do multiple models more easily. I got an error message
when I tried to do that. Here is my sample code:
#generating data
x1 <- rnorm(100,1)
x2 <- rnorm(100,1)
y <-
2023 Nov 14
1
data.frame weirdness
What is going on here? In the lines ending in #### the inputs and outputs
are identical yet one gives a warning and the other does not.
a1 <- `rownames<-`(anscombe[1:3, ], NULL)
a2 <- anscombe[1:3, ]
ix <- 5:8
# input arguments to #### are identical in both cases
identical(stack(a1[ix]), stack(a2[ix]))
## [1] TRUE
identical(a1[-ix], a2[-ix])
## [1] TRUE
res1 <-
2023 Nov 14
1
data.frame weirdness
They differ in whether the row names are "automatic":
> .row_names_info(a1)
[1] -3
> .row_names_info(a2)
[1] 3
Best,
-Deepayan
On Tue, 14 Nov 2023 at 08:23, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
>
> What is going on here? In the lines ending in #### the inputs and outputs
> are identical yet one gives a warning and the other does not.
>
>
2007 Oct 26
2
[LLVMdev] LLVM Newbie. Questions about backend.
Hello,
I have been studying LLVM and started to create a new backend for a
new RISC architecture. Now I need some help to get forward with my
project. I'm quite new to compiling techniques so I'm sorry for the
stupid questions.
Question 1:
My idea is to lower the select SDNode as follows:
%res1 = %falseVal
%res2 = setc %trueVal, %condition
Where setc is conditional mov. The
2023 Nov 14
1
data.frame weirdness
In that case identical should be FALSE but it is TRUE
identical(a1, a2)
## [1] TRUE
On Tue, Nov 14, 2023 at 8:58?AM Deepayan Sarkar
<deepayan.sarkar at gmail.com> wrote:
>
> They differ in whether the row names are "automatic":
>
> > .row_names_info(a1)
> [1] -3
> > .row_names_info(a2)
> [1] 3
>
> Best,
> -Deepayan
>
> On Tue, 14 Nov