similar to: sample()

Displaying 20 results from an estimated 7000 matches similar to: "sample()"

2004 Mar 22
2
Handling of NAs in functions lrm and robcov
Hi R-helpers I have a dataframe DF (lets say with the variables, y, x1, x2, x3, ..., clust) containing relatively many NAs. When I fit an ordinal regression model with the function lrm from the Design library: model.lrm <- lrm(y ~ x1 + x2, data=DF, x=TRUE, y=TRUE) it will by default delete missing values in the variables y, x1, x2. Based on model.lrm, I want to apply the robust covariance
2007 Aug 30
2
Assigning line colors in xyplot
Hi, I have a dataframe containing data from individuals 1, ..., 12 (grouping variable "g" in the data frame below), which belong either to "A" or "B" (grouping variable "f"): set.seed(1) tmp <- data.frame(
2004 Mar 04
1
Ordinal logistic regression using spatial data
I have a spatial data set with ordinal response variable containing four levels. I would like to know if and how spatial autocorrelation can be taken into account when ordinal logistic regression is used (e.g. the function lrm from the Design package). Thanks for your help! Christof
2004 Feb 25
2
circular filter
I try to find a circular filter that I can export to be used in a spatial software. Assuming, we have a matrix, representing 9x9 regularly spaced points with the center point 'filter[5, 5]'. In this example, I want to find a function that weighs all neighbor points within a distance of d=4 units with 1: > filter <- matrix(0, 9, 9) > filter <- function() ... > filter
2002 Oct 15
2
glm and Newey-West estimator
Dear R-users, has anybody combined the glm function with the Newey-West estimator of variance, similar as in Stata 7.0? I'd like to estimate corrected standard errors within a logistic regression model, taking into account the auto-correlated binary observations within individuals. I use R1.5.1 on Mac OS X (10.2). Thanks, Christof
2003 Feb 25
1
plotting question: filling area between two lines
Is there any way to fill the area within a plotted line and a horizontal line, e.g. in the following example: x <- rnorm(100) plot(x,type="l") abline(h=0) Thanks for any help. Christof
2005 Jul 04
1
Colors in mtext
I want to assign different colors to different strings using mtext(...). However, when I use something like mtext(text=c("string1","string2","string3"), col=c("black","blue","red"), side=3, line=0) string2 and string3 are printed over string1. When I use paste("string1","string2","string3"), the series
1999 Jul 15
1
hosts allow/deny not working correctly
When the world was young, "M. Tyson Bigler" <bigler@shellus.com> carved some runes like this: > I am having difficult getting the hosts allow/deny to work with IP ranges > or netmasks. Ideally I would prefer to use the IP/Netmask method, e.g. > 111.22.33.0/255.255.255.0, because we have a flat ATM network with > multiple class C's (netmask is really
2002 Jul 01
1
glmmPQL
Dear R users, can anybody explain me why the function glmmPQL(.) behaves in different ways, depending on the number of measurements/individuals you use? To show you this, I generated two examples. The first one includes 20 indivduals with each 100 repeated measurements (binary response), the second one includes 40 individuals. The 'individuals' differ only in different x values. I
2012 Mar 20
2
Reshaping data from long to wide without a "timevar"
Hello All, I was wondering if it's possible to reshape data from long to wide in R without using a "timevar". I've pasted some sample data below along with some code. The data are sorted by Subject and Drug. I want to transpose the Drug variable into multiple columns in alphabetical order. My data have a variable called "RowNo" that functions almost like a
2005 Mar 03
2
reading row vectors from file
Hi, New to R, using version 2.0.1 (2004-11-15) on debian Linux (sid), kernel 2.6.8-2-686. I have data in files with separate vectors on each row of the file, e.g., $ cat /tmp/stats freq,0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,... noise,49,47,48,48,50,47,48,47,46,50,48,54,49,47,49,... signal,99,0,100,0,0,100,0,100,100,0,100,101,100,0,0,... pctrcv,5,0,5,0,0,5,0,5,11,0,5,5,5,0,0,...
2011 Jul 25
1
Ouch - brown, hansen error
Hi I'm trying to use ouch's hansen and brown functions but I get the error: > brown(logflatnodes,archotreeouch) Error in backsolve(l, x, k = k, upper.tri = upper.tri, transpose = transpose) : NA/NaN/Inf in foreign function call (arg 1) and with hansen also: Error in optim(par = c(sqrt.alpha, sigma), fn = function(par) { : function cannot be evaluated at initial parameters
2010 Jul 30
4
transpose of complex matrices in R
Hello everybody When one is working with complex matrices, "transpose" very nearly always means *Hermitian* transpose, that is, A[i,j] <- Conj(A[j,i]). One often writes A^* for the Hermitian transpose. I have only once seen a "real-life" case where transposition does not occur simultaneously with complex conjugation. And I'm not 100% sure that that wasn't a
2024 Feb 29
2
[External] converting MATLAB -> R | element-wise operation
I decided to do a direct comparison of transpose and sweep. library(microbenchmark) NN <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 2, byrow = TRUE) # Example matrix lambda <- c(2, 3, 4) # Example vector colNN <- t(NN) microbenchmark( sweep = sweep(NN, 2, lambda, "/"), transpose = t(t(NN)/lambda), colNN = colNN/lambda ) Unit: nanoseconds expr min lq
2008 Oct 21
1
Error in sample(colnames(B), 10) : invalid 'x' argument
HI, I have a file named "s1"(which has 14 rows and 4 columns) which is in csv format. I import and call it "A" the file using: A <- read.csv(file="s1.csv",head=TRUE,sep=",") then I transpose it and call it "B"(which will have 4 rows and 14 columns) using: B=t(A) when I want to make 5 samples from "B" (choosing 10 columns) using:
2003 Sep 29
4
Data frame transpose
Hi All, I want to ask if there is a transpose function for data frame like the procedure of transpose in SAS? Because I want to partially transpose a data frame which contains 5 columns (siteid, date, time, obs, mod), what I want to do is to put time as the column variables along with siteid, and date, and put obs and mod in the row names. specifically to transpose a data frame: siteid date
2009 Nov 04
1
s4 generic issue
I'm hoping that someone with deeper insight into S4 than I, that is to say virtually everyone reading this list, could help resolve the following problem in SparseM. We have setGeneric("backsolve", function(r, x, k = NULL, upper.tri = NULL, transpose = NULL, twice = TRUE, ...) standardGeneric("backsolve"), useAsDefault= function(r, x,
2006 Jul 27
2
Vector extracted from a matrix. How can I specify dimensions in as.matrix?
Transpose vector extracted from a matrix Hello, I am doing a recursive analysis that uses every line (vector) of a matrix in a loop. In the model, I need to transpose those vectors that are extracted from a matrix. Using simple vectors (no matrix involved) the transpose function works fine: simplevector <-matrix(1:3,3,1) tsimplevector <-t(simplevector) #transposed dim(simplevector)
2010 Dec 20
1
transposing panel data
I am currently trying to transpose some large panel data set ie transposing multiple rows in into a single column. instead the transpose functionality transposes all rows into columns. my sample data set looks like below: ACCT_NUM ACCOUNT_NAME TRAN_AMT DATE EMPLOYER 101913 GK 7489 30-Apr-10 PENSION 101913 GK 7489 30-May-10 PENSION 101913
2010 Dec 20
2
package "arules" - 'transpose' of the transactions
Suppose this is my list of transactions: set.seed(200) tran=random.transactions(100,3) inspect(tran) items transactionID 1 {item80} trans1 2 {item8, item20} trans2 3 {item28} trans3 I want to get the 'transpose' of the data, i.e. transactionID items 1 {trans2} item8 2 {trans2} item20 3 {trans3} item28 4 {trans1} item80 I