similar to: question about R

Displaying 20 results from an estimated 500 matches similar to: "question about R"

2010 Feb 26
7
question to make a vector without loop
Hello all, I want to define a vector like w[k+1]=w[k]*a/(b+k) for k=1,...,N-1 without use loop. Is it posible to do in R? Regards khazaei
2010 May 22
1
question about graph
Hi, I have two different sets of data from two different populations. I want to plot these samples (for example: Line graph) by just one graph. could you please help me? Thanks Khazaei
2010 Mar 02
2
question to define a matrix with some vectors with different lengths
Hi, I have some vector v1,v2,...,vk, with different lengths. I want to consider these vectors as a matrix with k rows. Can you please guide me how I can do it? Regards khazaei
2010 Jan 19
3
question on plot in R with mac
-------------------------------------------------------------------------- Hello all My computer is MacBook and I want to draw a plot in R, for example for x <- c(1,3,6,9,12) y <- c(1.5,2,7,8,15) I use this command plot(x,y). but it dosn't work. Could you please help me? thank you khazaei
2010 Mar 05
2
question on maximum of each row of the matrix
Hi, I used the apply()function to compute the maximum of the each row of the matrix, but in my application sometime the matrix has just one row, and the apply() dosen't work. Could you please give me some hints? thank you khazaei
2010 Mar 11
2
divid the rows of the matrix by the cector
Hi, I have a matrix with m rows and n column and a vector with n elements. I want to divid each rows of the matrix by vector direcly. could you please hint me? Thank you khazaei
2009 Dec 11
3
how can generate from trunceted gamma distribution in R ?
Hi, all How can generate a sample from truncated inverse gamma distribution in R? thanks
2009 Dec 25
2
[ how can sample from f(x)~x^(a-1)
Hello all how can sample from f(x)~x^(a-1)*ind(0,min(b,-log(u)) in R? where a and b is positive constand and 0<u<1 thanks khazaei
2010 Aug 09
1
error (code 12)
Hi, I am runing R on my mac and I get this error: R(206,0xa01ad720) malloc: *** mmap(size=4000002048) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug R(206,0xa01ad720) malloc: *** mmap(size=4000002048) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug Is there any an
2008 Jul 29
1
tensor product of equi-spaced B-splines in the unit square
Dear all, I need to compute tensor product of B-spline defined over equi-spaced break-points. I wrote my own program (it works in a 2-dimensional setting) library(splines) # set the break-points Knots = seq(-1,1,length=10) # number of splines M = (length(Knots)-4)^2 # short cut to splineDesign function bspline = function(x) splineDesign(Knots,x,outer.ok = T) # bivariate tensor product of
2010 May 17
2
best polynomial approximation
Dear R-users, I learned today that there exists an interesting topic in numerical analysis names "best polynomial approximation" (BSA). Given a function f the BSA of degree k, say pk, is the polynomial such that pk=arginf sup(|f-pk|) Although given some regularity condition of f, pk is unique, pk IS NOT calculated with least square. A quick google tour show a rich field of research
2008 Aug 08
3
Multivariate regression with constraints
Hi all, I am running a bivariate regression with the following: p1=c(184,155,676,67,922,22,76,24,39) p2=c(1845,1483,2287,367,1693,488,435,1782,745) I1=c(1530,1505,2505,204,2285,269,1271,298,2023) I2=c(8238,6247,6150,2748,4361,5549,2657,3533,5415) R1=I1-p1 R2=I2-p2 x1=cbind(p1,R1) y1=cbind(p2,R2) fit1=lm(y1~-1+x1) summary(fit1) Response 2: Coefficients: Estimate Std. Error t value
2008 May 29
2
Troubles plotting lrm output in Design Library
Dear R-helpers, I'm having a problem in using plot.design in Design Library. Tho following example code produce the error: > n <- 1000 # define sample size > set.seed(17) # so can reproduce the results > age <- rnorm(n, 50, 10) > blood.pressure <- rnorm(n, 120, 15) > cholesterol <- rnorm(n, 200, 25) > sex <-
2008 Jul 23
1
mle2(): logarithm of negative pdfs
Hi, In order to use the mle2-function, one has to define the likelihood function itself. As we know, the likelihood function is a sum of the logarithm of probability density functions (pdf). I have implemented myself the pdfs that I am using. My problem is, that the pdfs values are negative and I cann't take the logarithm of them in the log-likelihood function. So how can one take the
2009 Dec 12
1
Replace NAs in a range of data frame columns
Dear all, I'm stuck in a seemingly trivial task that I need to perform for many datasets. Basically, I want to replace NA with 0 in a specified range of columns in a dataframe. I know the first and last column to be recoded only by its name. I can select the columns starting like this a[match('first',names(a)): match('last',names(a))] The question is how can replace all NA
2008 Dec 10
4
repeated searching of no-missing values
hi all, I have a data frame such as: 1 blue 0.3 1 NA 0.4 1 red NA 2 blue NA 2 green NA 2 blue NA 3 red 0.5 3 blue NA 3 NA 1.1 I wish to find the last non-missing value in every 3ple: ie I want a 3 by 3 data.frame such as: 1 red 0.4 2 blue NA 3 blue 1.1 I have written a little script data = structure(list(V1 = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L ), V2 = structure(c(1L, NA,
2009 May 07
1
data transformation using gamma
Hi R-users, I have this code to uniformise the data using gamma: > length(dp1) [1] 696 > dim(dp1) [1] 58 12 > dim(ahall) [1]  1 12 > dim(bhall) [1]  1 12 > trans_dt <- function(dt,a,b) + { n1 <- ncol(dt) +   n2 <- length(dt) +   trans  <- vector(mode='numeric', length=n2) +   dim(trans) <- dim(dt) +   for (i in 1:n1) +   {  dt[,i] <- as.vector(dt[,i])
2009 May 04
2
Reversing axis label order
Dear R Users, I am executing the following command to produce a line graph: matplot(aggregate_1986[,1], aggregate_1986[,2:3], type="l", col=2:3) On the x-axis I have values of Latitude (in column 1) ranging from -60 to +80 (left to right on the x-axis). However, I wish to have these values shown in reverse on the x-axis, going from +80 to -60 (ie. North to South in terms of Latitude).
2008 Jul 22
1
How to simulate heteroscedasticity (correlation)
Hi, I would like to generate two correlated variables. I found that funktion for doing that: a <- rmvnorm(n=10000,mean=c(20,20),sigma=matrix(c(5,0.8*sqrt(50), 0.8*sqrt(50),10),2,2)) (using library(mvtnorm)) Now I also want to generate two correlated variables where the error variance vary over the variable-correlation. And I want to plot this for showing heteroscedasticity. Like shown
2010 May 13
1
access objects in my environment
Dear group, Here are my objects in my environment: > ls() [1] "Pos100415" "Pos100416" "posA" "pose15" "pose16" "pose16t" "position" "trade" "x" I need to pass the object "Pos100415" to a function. This element is a data.frame, obtained through a function: Pos(x)<-myfun(x)