similar to: R: function code

Displaying 20 results from an estimated 6000 matches similar to: "R: function code"

2005 Feb 08
1
Toying with neural networks
Hello all, Ive been playing with nnet (package 'nnet') and Ive come across this problem. nnet doesnt seems to like to have more than 1000 weights. If I do: > data(iris) > names(iris)[5] <- "species" > net <- nnet(species ~ ., data=iris, size=124, maxit=10) # weights: 995 initial value 309.342009 iter 10 value 21.668435 final value 21.668435 stopped after 10
2007 Jul 15
1
NNET re-building the model
Hello, I've been working with "nnet" and now I'd like to use the weigths, from the fitted model, to iterpret some of variables impornatce. I used the following command: mts <- nnet(y=Y,x=X,size =4, rang = 0.1, decay = 5e-4, maxit = 5000,linout=TRUE) X is (m x n) Y is (m x 1) And then I get the coeficients by: Wts<-coef(mts) b->h1 i1->h1
2009 May 29
1
Backpropagation to adjust weights in a neural net when receiving new training examples
I want to create a neural network, and then everytime it receives new data, instead of creating a new nnet, i want to use a backpropagation algorithm to adjust the weights in the already created nn. I'm using nnet package, I know that nn$wts gives the weights, but I cant find out which weights belong to which conections so I could implement the backpropagation algorithm myself. But if anyone
2013 Oct 29
3
Ayuda con Mice con polyreg
Saludo gente, antes que nada gracias por la ayuda que puedan aportarme, soy iniciante en R, estoy usando el paquete Mice para realizar imputaciones múltiples sobre variables en su mayoría categóricas. El problema está que cuando expresó este comando imp <- mice(dataset,method="polr",maxit=1) donde el dataset es un data.frame me tirá este error : iter imp variable 1 1 pial1a
2004 Jun 14
2
CVnn2 + nnet question
Hi, I am trying to determine the number of units in the hidden layer and the decay rate using the CVnn2 script found in MASS directory (reference: pg 348,MASS-4). The model that I am using is in the form of Y ~ X1 + X2 + X3... + X11 and the underlying data is time-series in nature. I found the MASS and nnet package extremely useful (many thanks to the contributors). However I am getting
2009 May 29
1
final value of nnet with censored=TRUE for survival analysis
Hi there, I´ve a question concerning the nnet package in the area of survival analysis: what is the final value, which is computed to fit the model with the following nnet-c all: net <- nnet(cat~x, data=d, size=2, decay=0.1, censored=TRUE, maxit=20, Wts=rep(0,22), Hess=TRUE) where cat is a matrix with a row for each record and
2010 Jul 14
1
Changing model parameters in the mi package
I am trying to use the mi package to impute data, but am running into problems with the functions it calls. For instance, I am trying to impute a categorical variable called "min.func." The mi() function calls the mi.categorical() function to deal with this variable, which in turn calls the nnet.default() function, and passes it a fixed parameter MaxNWts=1500. However, as
2009 Jun 17
3
tiff() woes
Hello all, a friend has a problem with tiff() which I was unable to help about. I searched the error messages to no avail. When he tries: tiff(filename = "FedeWhyDoesntThisBloodyWork.tif", width = 5, height = 5, units = "cm", bg = "white", res = 1200) Error in tiff(filename = "FedeWhyDoesntThisBloodyWork.tif", width = 5, : unable to start device
2005 Mar 08
5
removing message: [Previously saved workspace restored]
Dear All, I saved by mistake the environment I was working in after typing q(), and now I get the annoying message: [Previously saved workspace restored] I have already deleted all the objects in the environment, saving it as an empty environment, so it's just a matter of nitpicking I suppose. The message does not appear if I start R from any other place in the directory tree. I am
2006 Feb 28
4
subsetting a list of matrices
Hi All, I have a list of matrices: > x [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 > y [,1] [,2] [,3] [,4] [,5] [,6] [1,] 18 21 24 27 30 33 [2,] 19 22 25 28 31 34 [3,] 20 23 26 29 32 35 > z =list(x,y) I want to create a second list that is has a subset each matrix in the list subsetting so I get the 2nd and 3rd row of each (and
2006 Sep 26
5
putting stuff into bins...
Hi All, I have a vector of data, a vector of bin breakpoints and I want to put my data in the bins and then extract fanciful informations like the mean value of each bin. I know I can write my own function, but I would have thought that R should have somewhere a function that took as arguments something like (data, breaks, what to do with the data in the bins). I surey could not find it
2007 Jun 26
2
fisher information matrix
Hi All, a colleague wants to calculate the Fisher information matrix for a model he wrote (not in R). He can easily get the neg-log-likelihood and the best fit parameters at the minimum. He can also get negLLs for other parameter values too. Given these data, is there a way in R to calculate the Fisher information matrix? Best, Federico -- Federico C. F. Calboli Department of Epidemiology
2007 Jun 21
2
Multinomial models
Hello, I am VERY new to R (one week) and I am trying to run a multinomial logit model. The model I am using is > model1 <- multinom(Y ~ X1 + X2 + , ..., Xn) if I put in > summary(model1) I get #Error in function (classes, fdef, mtable) : unable to find an inherited method for function "fitted", for signature "multinom" and if I put in > coef(model1)
2006 Oct 26
2
pairs matchning
Hi You could try to find an equivalent representation as a string and try to match those. > (A <- cbind(sample(1:2, 10, rep=TRUE), sample(1:2, 10, rep=TRUE))) [,1] [,2] [1,] 1 2 [2,] 1 2 [3,] 1 2 [4,] 2 2 [5,] 1 1 [6,] 1 2 [7,] 1 2 [8,] 1 1 [9,] 1 2 [10,] 1 1 > (B <- unique(A)) [,1] [,2] [1,] 1 2
2006 Feb 08
2
logical condition in vector operation
HI All, I have a data frame such as: > test x y p d [1,] 1 0 10 21 0 [2,] 2 3 11 12 0 [3,] 3 4 12 23 0 [4,] 3 5 13 24 0 and I want to perfor some operations on the first two coulums, conditional on the uneqaulity values on the 3rd and 4th columns. For instance: j = 3 test[test[,1] == j, 5] = test[test[,1] == j,2] + test[test[,2] == j,1] gives me the result: test: x y p d
2005 Apr 05
5
Help with three-way anova
Hi I have data from 12 subjects. The measurement is log(expression) of a particular gene and can be assumed to be normally distributed. The 12 subjects are divided into the following groups: Infected, Vaccinated, Lesions - 3 measurements Infected, Vaccintaed, No Lesions - 2 measurements Infected, Not Vaccinated, Lesions - 4 measurements Uninfected, Not Vaccinated, No Lesions - 3 measurements
2006 Mar 28
2
as.matrix and one row
Hi All, I have the following problem: x = c(1,2) x [1] 1 2 as.matrix(x) [,1] [1,] 1 [2,] 2 BUT, if I add: y = c(3,4) as.matrix(rbind(x,y)) [,1] [,2] x 1 2 y 3 4 It does not transpose. Since I will need as.matrix() for a list of data that is in one or more lines, I need as.matrix to behave in a consisten fashions, so I get as.matrix(x, whatever) [,1] [,2] x 1
2006 Mar 08
3
'less' for R?
Hi All, is there an equivalent of the Unix command 'less' (or 'more'), so I can look at what's inside a data.frame or a matrix without having it printed out on console? I am using R on Debian Linux and Mac OS 10.4.5 Cheers, F -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44
2005 Mar 23
3
nested random effects
Hi I am struggling with nested random effects and hope someone can help. I have individuals (ID) who are nested within families (FAM). I want to model an outcome variable, and take account of the intercorrelation of individuals within each family. I think this amounts to two random effects, one nested within the other. How can I model this in R? So far I have tried using the
2004 Jun 10
1
a scope problem
Hi, I have some code that looks like: dftc <- df[sets$tcset,] pt <- numeric(nrow(dftc)) sub <- 1:nrow(dftc) for (i in 1:nrow(dftc)) { n <- nnet( fmla, data=dftc, weights=wts, subset=sub[-i], size=4, decay=0.01) pt[i] <- predict( n, dftc[ i, ], type='class' ) } However running this give me the error: Error in eval(expr, envir, enclos) :