Displaying 6 results from an estimated 6 matches for "p2a".
Did you mean:
p2
2013 Dec 16
2
vectorizaciones
...e. He
intentado vectorizarlo pero sin mucho éxito con la función "Vectorize".
¿sabríais de alguna manera de evitar los bucles o de que funcionase Vectorize?
Adjunto un ejemplo
#...................
vec1a <- as.vector(1:3)
n1a <- 3
n2a <- 3
P1a <- matrix(rnorm(30),nrow=3)
P2a <- matrix(rnorm(30),nrow=3)
Ka <- 10
# En forma de funcion
producto <- function(n1a,n2a,Ka,vec1a,P1a,P2a){
LLa = numeric(2*Ka)
for (i in 1:n1a){
for (j in 1:n2a){
LLa = LLa - vec1a%*%matrix(abs(P1a[i,]-P2a[j,]),
nrow=length(vec1a), ncol=2*Ka, byrow=TRUE)
}
}
return(s...
2013 Dec 16
0
vectorizaciones
Hola,
De esta manera sí funciona:
#-----------------------------------------------
#...................
vec1a <- as.vector(1:3)
n1a <- 3
n2a <- 3
#P1a <- matrix(rnorm(30),nrow=3)
#P2a <- matrix(rnorm(30),nrow=3)
Ka <- 10
n.val <- 30
# En forma de funcion
producto <- function(n1a,n2a,Ka,vec1a,n.val){
# A eliminar una vez compruebes que la vectorización funciona
set.seed(123)
P1a <- matrix(rnorm(n.val),nrow=3)
P1a <- matrix(rnorm(n.val),nrow=3)
LLa = nume...
2010 Sep 26
1
formatting data for predict()
...dat=cbind(x1, x2)
mod2=glm(y ~ dat, family=binomial)
The results are the same as in mod. Yet I cannot figure out how to
input information into the "newdata" option of predict() in order to
generate the same predicted probabilities as above. The same code as
above does not work:
p2a=predict(mod2, type="response", newdata=as.data.frame(cbind(x1,
x2=0)))
unique(p2a)
Nor does creating a data frame that has the names "datx1" and "datx2,"
which is how the variables appear if you run a summary() on mod2.
Looking at the model matrix of mod2 shows...
2013 Apr 19
3
extracting the diagonal of an inverse matrix
Dear R-users,
I would like to know whether there is a way to extract a diagonal of an inverse matrix without computing the inverse of the matrix itself. The size of my matrices are really huge and, also using sparse matrix, computing the inverse leads to storage problems and low speed.
In other words, given a square matrix A, I aim to know diag(B), where B=solve(A), without computing solve(A).
2010 Sep 15
1
retrieving object names passed indirectly to a function
Hi folks,
I'm stuck with a problem that I suspect has a trivial solution...
I have a function, call it foo, that takes a number of arguments which
it uses as parameters for a simulation. For later analysis, foo stores
the names of the objects passed to it along with the simulation
results in its output (written to a database). The objects names are
accessed with deparse(substitute(argname)).
2008 Jun 30
4
Rebuild of kernel 2.6.9-67.0.20.EL failure
Hello list.
I'm trying to rebuild the 2.6.9.67.0.20.EL kernel, but it fails even without
modifications.
How did I try it?
Created a (non-root) build environment (not a mock )
Installed the kernel.scr.rpm and did a
rpmbuild -ba --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee
prep-out.log
The build failed at the end:
Processing files: kernel-xenU-devel-2.6.9-67.0.20.EL
Checking