[R] codenls

Prof J C Nash (U30A) nashjc at uottawa.ca
Wed Nov 13 18:50:44 CET 2013


The expression has b[1] and b[2] while start has b[2] and b[3].

The expression needs a different form, for example:

#   fit<-nlrob(y ~ x1 / (1+ b[1]*x2^b[2]),data = xx, start =
#   list(b[2],b[3]))
   fit<-nlrob(y ~ x1 / (1+ b1*x2^b2),data = xx, start =
   list(b1=b[2],b2=b[3]))

This "works", though I have no idea if the results make sense.

JN

On 13-11-13 06:00 AM, r-help-request at r-project.org wrote:
> Message: 6
> Date: Tue, 12 Nov 2013 06:03:02 -0800 (PST)
> From: IZHAK shabsogh <ishaqbaba at yahoo.com>
> To: "r-help at r-project.org" <r-help at r-project.org>
> Subject: [R] codenls
> Message-ID:
> 	<1384264982.50617.YahooMailNeo at web142502.mail.bf1.yahoo.com>
> Content-Type: text/plain
> 
>  kindly help correct this program as given below i run and run is given me some error
> 
> rm(list=ls())
>  require(stats)
>  require(robustbase) 
>  x1<-as.matrix(c(5.548,4.896,1.964,3.586,3.824,3.111,3.607,3.557,2.989))
>  y<-as.matrix(c(2.590,3.770,1.270,1.445,3.290,0.930,1.600,1.250,3.450))
>  x2<-as.matrix(c(0.137,2.499,0.419,1.699,0.605,0.677,0.159,1.699,0.340))
>  k<-rep(1,9)
>  x<-data.frame(k,x1,x2)
>  xx<-data.frame(y,x1,x2)
>  
>  
>  freg<-function(y,x1,x2){
>    reg<- lm(y ~ x1 + x2 , data=x)
>   
>  return(reg)
>  }
>  
>  fit<-freg(y,x1,x2)
>  b<-as.matrix((coef(fit)))
>  
> 
>  f<-function(b,x1,x2){
>    fit<-nlrob(y ~ x1 / (1+ b[1]*x2^b[2]),data = xx, start =
>    list(b[2],b[3]))
>    return(fit)
>  }
>  fit1<-f(b,x1,x2)
> Error in nlrob(y ~ x1/(1 + b[1] * x2^b[2]), data = xx, start = list(b[2],  : 
>   'start' must be fully named (list or numeric vector)
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Tue, 12 Nov 2013 06:34:44 -0800 (PST)
> From: Alaios <alaios at yahoo.com>
> To: "R-help at r-project.org" <R-help at r-project.org>
> Subject: [R] Handle Gps coordinates
> Message-ID:
> 	<1384266884.5102.YahooMailNeo at web125305.mail.ne1.yahoo.com>
> Content-Type: text/plain
> 
> Dear all,
> I would like to ask you if there are any gps libraries.
> 
> 
> I would like to be able to handle them,
> -like calculate distances in meters between gps locations,
> -or find which gps location is closer to a list of gps locations.
> 
> Is there something like that in R?
> 
> I would like to tthank you in advance for your reply
> 
> Regards
> Alex
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------
> 
> Message: 8
> Date: Tue, 12 Nov 2013 06:59:53 -0800
> From: Baro <babakbsn at gmail.com>
> To: R help <r-help at r-project.org>
> Subject: [R] Having a relative x-axis in a plot
> Message-ID:
> 	<CAF-JZQupPPoyGfd-1k0ztn7bHmFTxdXUjtMGHub9D3TYLh=2uQ at mail.gmail.com>
> Content-Type: text/plain
> 
> I would like to have a relative x-axis in r. I am reading time seris from
> an excel file and I want to show in a plot and also I want to have a window
> which moves over the values.
> 
> My aim ist to see which point belongs to which time(row number in excel
> file). i.e I am reading from 401th row in 1100th column in excel file and
> my window length is 256. here is my code:
> 
> #which column in excel filespalte<-1100
> #start row and end row
> start<-401end<-600
> 
> window<-256
> n<-1
> 
> wb <- loadWorkbook("D:\\MA\\excel_mix_1100.xls")
> dat <-readWorksheet(wb, sheet=getSheets(wb)[1], startRow=start,
> endRow=end, startCol=spalte, endCol=spalte,header=FALSE)
> datalist<-dat[seq(1, length(dat[,1]), by = 2),]
> datalist<-matrix(datalist)while(1+window<=length(datalist)){
>   kd<-matrix(as.integer(datalist[n:(n+window-1),1]))
>   Sys.sleep(0.2)
>   plot(kd,type="l",col="blue",xlab="Rohdaten",ylab="values",xlim=c(start+n,start+n+window-1))
>   n<-n+1}
> 
> 	[[alternative HTML version deleted]]



More information about the R-help mailing list