similar to: problem in fitting model in NLS function

Displaying 20 results from an estimated 200 matches similar to: "problem in fitting model in NLS function"

2012 Mar 29
1
Retrieving matrix column and row names by index value
Hi all, So let's say I have a matrix, mdat and I only know the index number. How do I retrieve the column and row names? For example, > mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("C.1", "C.2", "C.3"))) > mdat[4] [1] 12 >
2012 May 10
0
Coloring subsets of points of a strip chart by quantiles
Hello All, I am trying to color five subsets of points in a series of vertical strip charts by quintiles using the quantile function, but I have not been able to do this successfully, nor have I been able to find an example of this online. I would like to have the "E1", "E2", and "E3" columns plotted on a single plot (containing the three strip charts). I am
2012 Nov 28
1
Problems with nls
The problem is badly scaled -- parameters from very small to very big. nlmrt package manages a bit better, but scaling would likely make it and nls both happier. nlxb insists on having its data in a data frame. Here's my code rm(list=ls()) Laptop_sale <- c(1405, 1863,2027,2669,2938,5275,6595,6943,8621,10905,12420,22400,32380,31600,34900,43163,47838,47592) CuSale <- Laptop_sale time
2011 Jun 24
0
reshape: cast(x, a ~ b ~ .) vs. cast(x, a ~ b) difference
Hi, I have a problem with understanding what the function cast() from the package reshape is doing. In the example below I have a 2x2x2 array which I first melt and then cast to get the averages over the field 'strain' for every combination of the fields 'treatement' and 'gene': ------ > mdat <- melt(array(rnorm(8), dim=c(2,2,2),
2009 Jan 26
1
reshape problem: id and variable names not being recognized
Hi everyone. Long time listener, first-time caller here. I have a data set that's been melted with the excellent reshape package, but I can't seem to cast it the way I need to. Here's the melted data's structure: > str(mdat) 'data.frame': 6978 obs. of 4 variables: $ VehType : Factor w/ 2 levels "Car","Truck": 1 1 2 1 1 2 1 1 1 1 ... $ Year :
2011 Nov 11
1
barplot names.arg
Hello there, I have a question regarding bar plots. I am trying to plot the data from the following matrix as a barplot - # input data mdat <- matrix(c(0.1,0.9,0.9,0.1,0.5,0.5,0.45,1-0.45,0.6,0.4,0.8,0.2), nrow = 6, ncol=2, byrow=TRUE, + dimnames = list(c("Mon", "Mon", "Tues", "Tues", "Thurs", "Friday"), +
2010 Sep 18
2
feedback/question on function update()
Hi, First let me say I am a big fan of R and appreciate all your time and effort. The update() function does not seem to work in a for loop. Consider the following: mdat <- matrix(c(1,2,3, 11,23,13, 12,4,8), nrow = 3, ncol=3, byrow=TRUE) reg <- lm(mdat[7:9]~1) for(i in 1:2) { reg <- update(reg,.~.+mdat[((i-1)*3 + 1):(i*3)]) #update reg twice } reg # reg should have two independent
2009 Mar 05
3
Dropping rows conditionally
Dear R-help team, I am getting addicted to using R but keep on getting many challenges on the way especially on data management (data cleaning). I have been wanting to drop all the rows if there values are `NA' or have specific values like 1 or 2 or 3. mdat <- matrix(1:21, nrow = 7, ncol=3, byrow=TRUE, dimnames = list(c("row1",
2008 Nov 22
2
ggplot2 - facet_grid and facet_wrap
Hello R users (and Hadley) I have another question about ggplot2 :-) (version 0.8) `dat` <- structure(list(D = c("a", "b", "c", "d"), G = c(1.51520888871520, 1.88812208268440, -6.60521862, 0.55968739), E = c(1.38888592256404, 1.39366168665589, 1.22509259382058, 1.36617701059296), I = c(6.92634958902857, 6.94416045215158, 13.2179488828556,
2011 May 18
1
matrix help (first occurrence of variable in column)
Dear R help, Apologies for the less than informative subject line. I will do my best to describe my problem. Consider the following matrix: mdat <- matrix(c(1,0,1,1,1,0), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("T1", "T2"), c("sp.1", "sp.2", "sp.3"))) mdat In my actual data I have time
2007 Jun 12
1
Subset and logical operator error
Hello, It looks to me as if the ! logical operator cannot be called when subsetting a data.frame. In the example below, the value column has two factor levels (but my typical datasets have more), and what I am trying to do is to exclude all lines for which the "value" is different from "A". I have got a syntax error message everytime I try to use the subset() function.
2010 May 11
1
create a data.frame for aov
Hi R-experts, I try to find a way to transfer a matrix to a data.frame that is used as input of aov. can you give me advice for that? >mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("Col1", "Col2", "Col3"))) >mdat      Col1 Col2 Col3 row1    1    2    3 row2   11   12   13 ===>
2009 Jun 03
1
Lattice(barchart) related query
Hi, I have been recently experimenting with the lattice package, which I must admit is just great! However, I'm sort of stuck in modifying certain parameters; Would appreciate some pointers on a couple of things: 1) Is it possible to change the font of the labels (say to computer modern) -- either in the Windows output or thru' Sweave (generating EPS/PDF)? 2) As you will notice, there
2005 Jan 06
5
How to avoid rounding of matrix elements?
Hi all R-users, If I have a matrix with numeric elements as follows, the values are rounded when I try to refer to a specifici element using [], the value is rounded. The same thing happens if the matrix is read from a file, the values are stored to the correct precision but then when I try to refer to a specific element (such as using [], it is rounded. How do I avoid this rounding?
2017 Jun 18
0
R_using non linear regression with constraints
I ran the following script. I satisfied the constraint by making a*b a single parameter, which isn't always possible. I also ran nlxb() from nlsr package, and this gives singular values of the Jacobian. In the unconstrained case, the svs are pretty awful, and I wouldn't trust the results as a model, though the minimum is probably OK. The constrained result has a much larger sum of squares.
2012 Jun 06
2
ggplot2: legend for geom_rug() ..?
Hi, I was trying to make another legend for the rug plot. Sample code: library(ggplo2) ids <- paste('id_',1:3,sep='') before <- sample(9) after <- sample(1:10,9) dat <- as.matrix(cbind(before,after)) rownames(dat) <- rep(ids,3) position <- c(rep(10,3),rep(13,3),rep(19,3)) mdat <- cbind(melt(dat),position) ggplot(mdat, aes(position, value)) +
2017 Jun 18
0
R_using non linear regression with constraints
I've seen a number of problems like this over the years. The fact that the singular values of the Jacobian have a ration larger than the usual convergence tolerances can mean the codes stop well before the best fit. That is the "numerical analyst" view. David and Jeff have given geometric and statistical arguments. All views are useful, but it takes some time to sort them all out and
2013 Jul 09
3
fitting log function: errors using nls and nlxb
Hi- I am trying to fit a log function to my data, with the ultimate goal of finding the second derivative of the function. However, I am stalled on the first step of fitting a curve. When I use the following code: FG2.model<-(nls((CO2~log(a*Time)+b), start=setNames(coef(lm(CO2 ~ log(Time), data=FG2)), c("a", "b")),data=FG2)) I get the following error: Error in
2017 Jun 21
1
fitting cosine curve
Using a more stable nonlinear modeling tool will also help, but key is to get the periodicity right. y=c(16.82, 16.72, 16.63, 16.47, 16.84, 16.25, 16.15, 16.83, 17.41, 17.67, 17.62, 17.81, 17.91, 17.85, 17.70, 17.67, 17.45, 17.58, 16.99, 17.10) t=c(7, 37, 58, 79, 96, 110, 114, 127, 146, 156, 161, 169, 176, 182, 190, 197, 209, 218, 232, 240) lidata <- data.frame(y=y, t=t) #I use the
2012 Nov 07
5
Calling R object from R function
Hi, Can you please help me with this please? What I am trying to do is call a vector from R function and used in the new function So I create 4 functions with these arguments M11 <- function(TrainData,TestData,mdat,nsam) { ls <- list() I have few statments one of them is vectx <- c(,1,2,3,4,5,6,6) vectz <- c(12,34,5,6,78,9,90) and then................ ls(vectx=vtecx,vectz=vectz)