similar to: Omit Inf

Displaying 20 results from an estimated 10000 matches similar to: "Omit Inf"

2012 Jun 12
4
How to index a matrix with different row-number for each column?
here's my question: suppose I have a matrix: mt<-matrix(1:12,ncol=6) now I have a vector vt<-c(1,2,2,2,1,2) which means I want to get: the 1st row for column1; the 2nd row for column2; the 2nd row for column3; the 2nd row for column4; ... that what I want is this vector: 1,4,6,8,9,12 Does anyone know how to do this fast? I know I can use for-loop to travel all columns,but
2013 Feb 07
4
Sourcing my file does not print command outputs
I looked at the documentation of source() and summary(), and I could not find the reason why calling something like: > summary(resamps) from the command line, works (it prints the summary) whereas calling summary(resampls) from a file that I source with source("my_file.r") does not print anything. How can I get summary(resamps) to print when I source a file with this command?
2012 Jun 19
2
matchit - can I weight the parameters?
This may be a really obvious question but I just can't figure out how to do it. I have a small dataset that I am trying to compare to some controls. It is essential that the controls are matched on Cancer Stage (a numerical factor between 1 and 4), and then ideally on Age (integer), Gender (factor), Performance Status(factor). I'm using matchit to try and do this, but it seems to give
2009 Apr 15
2
problem with read.table
Hi all, I've simple code to read a file (verify.txt in the same directory as the script file) but when I run this I get "Error in eval(expr, envir, enclos) : object "y" not found". data_model.df = read.table("./verify.txt", header=TRUE, nrows=10); f <- lm(y ~ x) Could someone pls tell me what's wrong with this code? Sincere thanks!
2012 Jan 18
4
confint function in MASS package for logistic regression analysis
I have the following binary data set: Sex Response 0 1 0 159 162 1 4 37 My commands library(MASS) sib.glm=glm(sib~sex,family=binomial,data=sib.data) summary(sib.glm) The coefficients in the output are Estimate Std. Error z value Pr(>|z|) (Intercept) -3.6826 0.5062 -7.274 3.48e-13
2010 Jun 09
1
Problem Matching Exact Values
Sorry for the basic question - bur I ran into something I haven't noticed before and would appreciate a little more perspective on my problem. I am using R to determine if various thresholds are hit (or surpassed) in a data set.? If a threshold is surpassed, I have had no problems identifying it.? However, when the threshold is matched *exactly*, not all cases are being identified. Please
2008 Sep 10
4
re flecting a line
Suppose x and y are numeric vectors of the same length. plot(x,y) #scatterplot lmObj1 <- lm(y~x) # best fit line abline(lmObj1) # good lmObj2 <- lm(x~y) #get best fit but with axes interchanged abline(lmObj2) # not what I want. I want the correct line, drawn on the same graph, but with # response and predictor variables interchanged One way to proceed would be to
2011 Mar 01
3
Difference in numeric Dates between Excel and R
Hello. I am using some dates I read in excel in R. I know the excel origin is supposed to be 1900-1-1. But when I used as.Date with origin=1900-1-1 the dates that R reported me where two days ahead than the ones I read from Excel. I noticed that when I did in R the following: > as.Date("2011-3-4")-as.Date("1900-1-1") Time difference of 40604 days but if I do the same
2012 Jun 12
6
Attempting to update from R 2.14 to 2.15
I am very new to Linux so I probably am doing something stupid but I cannot seem to update to R 2.15 Using Ubuntu 12.02 Precise Penguin I realise that debian packages are not updated regularly so I tried to follow the insructions at the R-site So far, I have modified /etc/apt/sources.list to read ## R CRAN added 2012-06-12 deb http://probability.ca/cran/bin/linux/debian squeeze-cran/ Issued
2009 Oct 20
2
Problems importing Unix SAS .ssd04 file to R (Win)
Hello, I'm trying to import a SAS file made using SAS on Unix. Currently I'm using SAS on Windows and I'm trying to import that .ssd04 file to R. The file name of the file is testfile.ssd04 and it is located in 'M:\sasuser'. I'm using Windows XP and R 2.91. Basically what I'm doing is ############ r code ############## > library(foreign) > sashome <-
2010 Dec 06
5
How can I refer to actual (n) and previous (n-1) elements in a vector?
Hello, How can I apply a function on a vector that refers to actual (n) and previous elements in the vector (e.g. n-1)? For example: I would like to calculate the sum of (n-1) + n for each element of a vector and get a vector as a result. Besides others I tried this: v<-c(3,6,8,1,1,3,9,5,6,3) for (i in 1:NROW(v)){a[i]<-a[i-1]+a[i]} I would like to get this result:
2010 Feb 25
5
Plotting 15 million points
Hi All I have a vector of about 15 million numbers which I would like to plot. The goal is the see the distribution. I tired the usual steps. 1. Histogram : never gets complete my window freezes w/out log base 10 2. Density : I first calculated the kernel density and then plotted it which worked. It would be nice to superimpose histogram with density but as of now I am not able to get this
2013 Feb 12
7
Is there a neat R trick for this?
Hello all, given two vectors X and Y I'd like to receive a vector Z which contains, for each element of X, the index of the corresponding element in Y (or NA if that element isn't in Y). Example: x <- c(4,5,6) y <- c(10,1,5,12,4,13,14) z <- findIndexIn(x, y) z [1] 5 3 NA 1st element of z is 5, because the 1st element of x is at the 5th position in y 2nd element of z is 3,
2012 Apr 19
1
SmoothTrend in OpenAir
I'm trying to plot smooth trend using smoothTrend in OpenAir but I'm having problems. I used the following code. --------------------------------------------------------------------------------- #Set my working dir to the dir with my files setwd("c:/R") #Load the openair library library(openair) #Load the data mydata <- read.table("MCNP-pH.csv", header=TRUE,
2011 May 30
1
Error in minimizing an integrand using optim
Hi, Am not sure if my code itself is correct. Here's what am trying to do: Minimize integration of a function of gaussian distributed variable 'x' over the interval qnorm(0.999) to Inf by changing value of parameter 'mu'. mu is the shift in mean of 'x'. Code: # x follows gaussian distribution # fx2 to be minimized by changing values of mu # integration to be done over
2013 Oct 20
5
nlminb() - how do I constrain the parameter vector properly?
Greets, I'm trying to use nlminb() to estimate the parameters of a bivariate normal sample and during one of the iterations it passes a parameter vector to the likelihood function resulting in an invalid covariance matrix that causes dmvnorm() to throw an error. Thus, it seems I need to somehow communicate to nlminb() that the final three parameters in my parameter vector are used to
2012 Feb 02
2
Problem with range()
Hello, I'm using range do define boundaries for a linear model, so the line I graph is only graphed for the range of data. There are NAs in the data, but I dont remember this being a problem before. I typed na.action=na.omit anyway, which has usually solved any NA issues in the past. Any idea why R cant do vector functions for these data? Solution? Thanks, Colin Wahl M.S. Biology candidate
2012 Jun 09
1
Inf and NA
Hi all, I have a csv matrix "KT.csv" and it has Inf and NA I want to calculate the mean of each row so I use rowMeans(KT,na.rm = TRUE) but with this Inf cannot be omminted. I?m trying to use before running rowMeans(KT,na.rm = TRUE) KT<-range(KT,finite=TRUE) but it doesn?t works... Do you know a simple way to ommit Inf en the calculations? Many thanks. I have tried also to
2012 Dec 12
4
Matrix multiplication
Hi, I have a transition matrix T for which I want to find the steady state matrix for. This could be approximated by taking T^n , for large n. T= [ 0.8797 0.0382 0.0527 0.0008 0.0212 0.8002 0.0041 0.0143 0.0981 0.0273 0.8802 0.0527 0.0010 0.1343 0.0630 0.9322] According to a text book I have T^200 should have reached the steady state L L
2011 Feb 08
1
FP growth in R?
Does anyone know of an R interface to Christian Borgelt's implementation of the FP growth algorithm? thanks a lot Rob Tibshirani -- I get so much email that I might not reply to an incoming email, just because it got lost. So don't hesitate to email me again. The probability of a reply should increase. Prof. Robert Tibshirani ?Depts of Health Research and Policy, and Statistics