Displaying 20 results from an estimated 107 matches for "nvar".
Did you mean:
near
2004 Dec 16
0
fitting problems in coxph.fit
...al)
### load example data
load(url("http://www.imbe.med.uni-erlangen.de/~hothorn/coxph_fit.Rda"))
method <- "efron"
### copied from `coxph.fit'
coxfit <- .C("coxfit2", iter=as.integer(maxiter),
as.integer(n),
as.integer(nvar), stime,
sstat,
x= x[sorted,] ,
as.double(offset[sorted] - mean(offset)),
as.double(weights),
newstrat,
means= double(nvar),
coef= as.double(init),...
2008 Mar 31
2
L-BFGS-B needs finite values of 'fn'
Dear All,
I am trying to solve the optimization problem below, but I am always
getting the following error:
Error in optim(rep(20, nvar), f, gr, method = "L-BFGS-B", lower = rep(0, :
L-BFGS-B needs finite values of 'fn'
Any ideas?
Thanks in advance,
Paul
-----------------------------------------------
k <- 10000
b <- 0.3
f <- function(x) {
n <- length(x)
r <- sum((b^(0:(n-1)))*log(x))...
2005 May 19
1
R 2.1.0 RH Linux Built from Source Segmentation Fault
...p, or
'help.start()' for a HTML browser interface to help.
Type 'q()' to quit R.
[Previously saved workspace restored]
> # program name: mnl.R
> # my hierarchical bayes logit model using random walk algorithm
> #
> # nphy= number of physicians in the sample
> # nvar = no. of variables in X
> # nalt = no. of alternatives
> # nobs = no. of observations
> # yrows (nphy x 1 matrix) contains no. of observations by each physician
> # X (nobs*nalt x nvar) contains xvalues for each of j alt on each
>of n occasions
> # Y (nobs x 1) contains chos...
2002 Feb 27
1
Bug in glm.fit? (PR#1331)
...NULL,
3 mustart = NULL, offset = rep(0, nobs), family = gaussian(),
4 control = glm.control(), intercept = TRUE)
5 {
6 x <- as.matrix(x)
7 xnames <- dimnames(x)[[2]]
8 ynames <- names(y)
9 conv <- FALSE
10 nobs <- NROW(y)
11 nvars <- NCOL(x)
12 if (nvars == 0) {
13 cc <- match.call()
14 cc[[1]] <- as.name("glm.fit.null")
15 return(eval(cc, parent.frame()))
16 }
17 if (is.null(weights))
18 weights <- rep(1, nobs)
19 if (is.null(offset))...
2011 Jul 19
1
"may be used in an incorrect context"
...ches haven't turned
up anything useful. This is with R 2.7 and 2.9.
The message appears to be referring to a section of code whose
highlights are
agfitfn <- function(beta) {
r <- .C("agexactrds", iter= as.integer(control$iter.max),
as.integer(n),
as.integer(nvar), sstart, sstop,
sstat,
x= x[sorted,],
sextra,
as.integer(length(response.prob)),
as.double(response.prob),
as.double(alpha),
as.double(offset[sorted] - mean(offset)),
newstrat,
means = double(nvar),
coef=...
2006 Dec 02
0
fixup for debug package and R2.4.0
...perm[[i]] <- pi
}
rows[[i]] <- seq.int(from = nrow + 1, length = ni)
rlabs[[i]] <- Make.row.names(nmi, ri, ni, nrow)
nrow <- nrow + ni
if (is.null(value)) {
value <- unclass(xi)
nvar <- length(value)
all.levs <- vector("list", nvar)
has.dim <- logical(nvar)
facCol <- logical(nvar)
ordCol <- logical(nvar)
for (j in 1:nvar) {
xj <- value[[j]]...
2012 Feb 07
2
predict.naiveBayes() bug in e1071 package
...terior probabilities of
all classes are small, the result from the predict.naiveBayes function
become NaNs. This is an issue with the treatment of the
log-transformed probabilities inside the predict.naiveBayes function.
Here is an example to demonstrate the problem (you might need to
increase 'nvar' depending on your machine):
-------------------- 8< --------------------
N <- 100
nvar <- 60
varnames <- paste("v", 1:nvar, sep="")
dat <- sapply(1:nvar, function(dummy) {c(rnorm(N/2, 0, 1), rnorm(N/2, 10, 1))})
colnames(dat) <- varnames
out <- rep(c...
2007 Jan 12
0
Minor logical bug in rbind.data.frame ?
...perm[[i]] <- pi
}
rows[[i]] <- seq.int(from = nrow + 1, length = ni)
rlabs[[i]] <- Make.row.names(nmi, ri, ni, nrow)
nrow <- nrow + ni
if (is.null(value)) {
value <- unclass(xi)
nvar <- length(value)
all.levs <- vector("list", nvar)
has.dim <- logical(nvar)
facCol <- logical(nvar)
ordCol <- logical(nvar)
for (j in 1:nvar) {
xj <- value[[j]]...
2013 Apr 25
1
lsfit: Error in formatting error message
Hi,
in R-3.0 I get the following error when calling lsfit with more
observations than variables, which seems to come from an error in the
formatting of the error message (note that this was not happening in
2.15.3):
> nobs <- 5; nvar <- 6; lsfit(matrix(runif(nobs*nvar), ncol=nvar),
runif(nobs), intercept=FALSE)
Error in sprintf(ngettext(nry, "%d response", "%d responses"), ", ",
ngettext(ncx, :
invalid format '%d'; use format %s for character objects
> traceback()
3: sprintf(ngette...
2018 Oct 02
3
maximum matrix size
...e or all of my .Call() statements, in order to give a sensible message whenever a
bounday is struck.? A well meaning person just posted a suggested "bug fix" to the github
source of one routine where my .C call allocates a scratch vector, suggesting? "resid =
double( as.double(n) *nvar)" to prevent a "NA produced by integer overflow" message,? in
the code below.?? A fix is obvously not quite that easy :-)
??? ??? resid <- .C(Ccoxscore, as.integer(n),
??? ??? ??? ??? as.integer(nvar),
??? ??? ??? ??? as.double(y),
??? ??? ??? ??? x=as.double(x),
??? ??? ??...
2008 Jan 14
2
Permutations of variables in a dataframe
Hallo All,
I would like to apply a function to all permutations of variables in a
dataframe (except the first). What is the best way to achieve this?
I produce the permutations using:
nvar <- ncol(dat) - 1
perms <- as.matrix( expand.grid(rep( list(1:0) , nvar ))[ , nvar:1] )
Thanks in advance
Serguei
Test-dataframe, comma-delimited:
code,wav,w,area,gdp,def,pop,coast,milspend,agr
aut,5,10,83.87,26.39,-1.29,8.07,0,0.72,1.81
bel,1,12,30.53,24.87,-0.28,10.29,0.07,1.29,1.09
bul,7...
2011 Feb 25
1
help please ..simple question regarding output the p-value inside a function and lm
...# please not that I want to avoid to fit y ~ x2 + x3 or y ~ x4 + x5 (means
that I am selecting two x variables at time to end)
# question: how can I do this and put inside a user function as I worked out
the following???
# defining function for lm model
mylm <- function (mydata,nvar) {
y <- NULL
P1 <- vector (mode="numeric", length = nvar)
P2 <- vector (mode="numeric", length = nvar)
for(i in 1: nvar) {
print(P1[i] <- summary(lm(mydata$y ~ mydata[,i]) +
mydata[,i+1]$coefficients[2,4]))
print(P2[i] <- summar...
2005 Jul 07
2
r: LOOPING
...500 since we import 500 rows at a time
8. nruns = how many groups you want to run the analysis on
==============================================
==============================================
==============================================
TRY<-function(nsize=500,filename="C:/A.txt",nvar=61,nruns=1)
{
#the matrix with the payoff weights
fit.reg<-matrix(nrow=nruns,ncol=nvar-1)
for (ii in 1:nruns)
{
skip=1+(ii-1)*nsize
#import the data in batches of "nsize*nvar"
#save as a matrix and then delete "dscan" to save memory space
dscan<-scan(file=filename,se...
2013 Apr 01
2
Timing of SET_VECTOR_ELT
...sume a C program invoked by .Call, that returns a list.
Near the top of the program we allocate space for all the list elements. (It is my habit
to use "xyz2" for the name of the R object and "xyz" for the pointer to its contents.)
PROTECT(means2 = allocVector(REALSXP, nvar));
means = REAL(means2);
PROTECT(u2 = allocVector(REALSXP, nvar));
u = REAL(u2);
PROTECT(loglik2 = allocVector(REALSXP, 2));
loglik = REAL(loglik2);
PROTECT(rlist = mknamed(VECSXP, outnames));
Can I assign the individual elements into rlist using SET_VECTOR_ELT at th...
2012 Jan 21
1
Function for multiple t tests
Hi,
I want to run t.test() for several variables among two groups, and I
would like to skip the tedious process of collecting information to
assemble a table, but I am not sure if the function I want already
exists. Any suggestion would be appreciated.
I have a working example, as required by the posting guide:
my_swiss = swiss[-1,]
my_swiss$facto = rep(1:2,nrow(my_swiss)/2)
2007 May 09
3
Increasing precision of rgenoud solutions
Dear All
I am using rgenoud to solve the following maximization problem:
myfunc <- function(x) {
x1 <- x[1]
x2 <- x[2]
if (x1^2+x2^2 > 1)
return(-9999999)
else x1+x2
}
genoud(myfunc, nvars=2,
Domains=rbind(c(0,1),c(0,1)),max=TRUE,boundary.enforcement=2,solution.tolerance=0.000001)
How can one increase the precision of the solution
$par
[1] 0.7072442 0.7069694
?
I have tried solution.tolerance but without a significant improvement.
Any ideas?
Thanks in advance,
Paul
2013 Dec 08
2
How to evaluate sequence of strings like this
...me what I need.
mydat1 <- paste(mydat$Centrecode, mydat$FSUSN,mydat$Round,sep="")
newds <- data.frame(mydat1)
For a large data set, I don't want to write like this ... "mydat$Centrecode, mydat$FSUSN,mydat$Round". So, I tried to automate using following code.
nvar <- paste("mydat","$",names(mydat)[1:3],sep="")
mydat1 <- paste(eval(parse(text=nvar)))
newds <- data.frame(mydat1_u)
I am finding problem in the second line. Please help me.
Thank you for your kind help.
--
View this message in context: http://r.789695.n...
2009 Jan 15
2
LCA (e1071 package): error
Hello,
I will use the lca method in the e1071 package. But I get the following error:
Error in pas[j, ] <- drop(exp(rep(1, nvar) %*% log(mp))) :
number of items to replace is not a multiple of replacement length
Does anybody know this error and knows what this means?
Kind regards,
Tryntsje
2005 Feb 21
0
want to call R from aplatform written i strict ANSI C
...bal Definitions */
#include "project.h"
#include "rpa_proj.h"
#include "rpa_proj.c"
extern RPA_ptr *SHAREX_ROOT;
extern MINLP_ptr *SHAREX_PROB;
IVECTOR SUPER_FLAG = &(INT_STATUS[16]);
IVECTOR ALLOCATION_SWITCH = &(INT_PROTOCOL[30]);
extern void compare_NVAR(int n1,int n2,int n3,char *stage);
/* end of global definitions */
void evaluator(DVECTOR w,double Penalty,double *gf,double *F,double *Dev) {
int i,n,n_i,n_x,n_d,m_f,ACCELERATE;
ACCELERATE=INT_STATUS[0];
REAL_STATUS[4] += 1.0; /* number of evaluator() calls */
n = min(SHAREX_PROB->n,*(...
2005 Feb 25
0
Fwd: want to call R from aplatform written i strict ANSI C
...bal Definitions */
#include "project.h"
#include "rpa_proj.h"
#include "rpa_proj.c"
extern RPA_ptr *SHAREX_ROOT;
extern MINLP_ptr *SHAREX_PROB;
IVECTOR SUPER_FLAG = &(INT_STATUS[16]);
IVECTOR ALLOCATION_SWITCH = &(INT_PROTOCOL[30]);
extern void compare_NVAR(int n1,int n2,int n3,char *stage);
/* end of global definitions */
void evaluator(DVECTOR w,double Penalty,double *gf,double *F,double *Dev) {
int i,n,n_i,n_x,n_d,m_f,ACCELERATE;
ACCELERATE=INT_STATUS[0];
REAL_STATUS[4] += 1.0; /* number of evaluator() calls */
n = min(SHAREX_PROB->n,*(...