similar to: table questions

Displaying 20 results from an estimated 1000 matches similar to: "table questions"

2010 May 11
2
question about R
Hi, At each iteration in my program,I need to generate tree vectors,X1,X2,X3, from exponential distribution with parameters a1,a2,a3. Can you help me please how can I do it such that it take a little time? thank you khazaei
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
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
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 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
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 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,
2013 Jan 04
1
SpatialPolygon with the max value gets no color assigned in spplot function when using "at" parameter
Hi, I would like to do coloring of map regions based on the region values "weight". The approach I am taking is first to break regions into equal intervals, classIntervals(spdf$weight,4)$brks #4 intervals in this case and coloring all regions within the interval with the same color col = brewer.pal(4,"RdYlGn")) The max "weight" is as well the boundary of the
2019 Mar 03
2
bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample
When `length( skewed.probs ) > 200' uniform samples are generated in R-devel. R-3.5.1 behaves as expected. `epsilon` can be a lot bigger than illustrated and still the uniform distribution is produced. Chuck > set.seed(123) > > epsilon <- 1e-10 > > ## uniform to 200 then small > p200 <- prop.table( rep( c(1, epsilon), c(200, 999-200))) > ## uniform to 201
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)
2010 Sep 16
2
use same breaks and colors, but the displayed scale are different-image.plot()
Hi all, I want to put several figures in a one figure for easy comparison, so i need to use the same methods to plot these figures. The following is an example. I also list my method, but it does not work. #Example data x<- 1:10; y<- 1:10; z<- outer( x,y,"+");z2<- outer( x,y,"-") #Quick view them image.plot(x,y,z) #relatively larger value image.plot(x,y,z2)
2003 Apr 02
1
normalized frequency histogram
Hi folks I'm trying to plot a normalized frequency histogram of some data. After checking the docs, it seems there is no built in feature for this. from the definition for normalized frequency, I need to divide the relative frequency by the size of the intervals being used. So I could divide the series by this interval length, and then plot the relative frequency. The problem is
2010 Nov 19
1
Color Alaska in USA map
Hello: I have a problem when I tried to color the USA map with different colors. The following is my data (I only used the second column of data): alaska, 1, 2 Hawaii, 0, 0 USA, 5, 5 And here is my code: library("latticeExtra") library("mapproj") state<-read.table("C:\\usaclass.txt",sep=",") state
2007 Sep 27
5
New R website: R-Cookbook.com
R Community, I've put together a website that I thought this mailing list might be interested in: http://www.r-cookbook.com It's a (free) community-driven content management system for R "recipes", or working examples. Some of the features of the site are code highlighting, recipe ratings, recipe comments, personal "recipe boxes" to save your favorite
2012 Oct 17
2
loop of quartile groups
Greetings R users, My goal is to generate quartile groups of each variable in my data set. I would like each experiment to have its designated group added as a subsequent column. I can accomplish this individually with the following code: brks <- with(data_variables, cut2(var2, g=4)) #I don't want the actual numbers, I need a numbered group data$test1=factor(brks,
2009 Mar 19
8
function question
Dear R Gurus: I read somewhere that functions are considered vectors. Is this true, please? thanks Edna Bell