similar to: Looking for a cleaner way to implement a setting certain indices of a matrix to 1 function

Displaying 20 results from an estimated 6000 matches similar to: "Looking for a cleaner way to implement a setting certain indices of a matrix to 1 function"

2007 May 23
1
I made some progress on my previous "systemfit" question but still not quite there
Surprisingly, I played around with some test code and below actually creates equations that look correct. tempmat<-matrix(10,nrow=6,ncol=6) restrictmat<-diag(6) colnames(tempmat)<-c("AUD.l1","CHF.l1","CAD.l1","GBP.l1","EUR.l1","JPY.l 1")
2004 Mar 19
2
How to collect trees grown by rpart
Jonathan, Try making a list instead of an array. See ?list. Also, did you look into random forests? I'm not sure what you want to do, but there might be methods there to do some of the work for you. Sean On 3/19/04 1:12 PM, "Jonathan Williams" <jonathan.williams at pharmacology.oxford.ac.uk> wrote: > I would like to collect the trees grown by rpart fits in an array,
2006 Oct 17
1
looking for a cleaner way to do something
I have two numeric vectors each of length 17 and each is named the exact same way. so obsnum ppppp ppppm pppmp . dot dot dot...... temp1 is 1417 52 63 85 obsnum ppppp ppppm pppmp . dot dot dot...... temp2 is 1213 41 50 97 what i want to have is a resultant matrix with 2 rows and 16 columns where the 16
2006 Jan 08
1
confint/nls
I have found some "issues" (bugs?) with nls confidence intervals ... some with the relatively new "port" algorithm, others more general (but possibly in the "well, don't do that" category). I have corresponded some with Prof. Ripley about them, but I thought I would just report how far I've gotten in case anyone else has thoughts. (I'm finding the code
2006 Mar 23
1
AIC mathematical artefact or computation problem ?
Dear R user, I have made many logistic regression (glm function) with a second order polynomial formula on a data set containing 440 observation of 96 variables. I?ve made the plot of AIC versus the frequency (presence/observations) of each variable and I obtain a nearly perfect arch effect with a symmetric axe for a frequency of 0.5 . I obtain the same effect with deterministic data. Maybe
2008 Oct 25
1
Filling symbols in xyplot
Hello, I am using xyplot and am happy with my graph, *except* that I cannot get the symbols to be filled. I tried using bg=c("red3","red","black","lightgrey")) in both the key and the xyplot function, that that was obviously not the answer. I would like the sybols to be filled with the same colors as the lines. Does anybody have an answer? In case
2013 Nov 01
1
Package(s) for making waffle plot-like figures?
Dear all, I am trying to make a series of waffle plot-like figures for my data to visualize the ratios of amino acid residues at each position. For each one of 37 positions, there may be one to four different amino acid residues. So the data consist of the positions, what residues are there, and the ratios of residues. The ratios of residues at a position add up to 100, or close to 100 (more on
2007 Aug 24
4
Turning a logical vector into its indices without losing its length
I have the code below which gives me what I want for temp based on logvec but I was wondering if there was a shorter way ( i.e : a one liner ) without having to initialize temp to zeros. This is purely for learning purposes. Thanks. logvec <- c(TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE) temp<-numeric(length(invec)) temp[invec]<-which(invec) temp [1] 1 0 0 4 0 0 7 0 obviously, the
2006 Oct 24
6
extract certain values from a ts
Hi, Having several daily wind speed time series I want to extract those consecutive days over and below certain values (i.e. 5 < x <8) Don't know which funtion to use (aggregate, lapply?) and how to do it. Thanks in advance Antonio
1999 Dec 07
4
Finding indices with a certain property
I want the indices i for which x[i] < 0 (say): > x <- c(1, -1, 3, 3, -2) > where.negative(x) [1] 2 5 Surely where.negative is something simple, but how? G?ran -------------------------------------------------------------- G?ran Brostr?m Department of Statistics tel: +46 90 786-5223 Ume? University fax: +46 90 786-6614 S-90187 Ume?, Sweden
2012 Apr 03
2
Looking for the name of a certain kind of quantile plot
Hi, While playing with quantile-quantile plots, I wrote up some code which plots something strangely different. Here's the pseudocode: testhist <- hist(sample_data) refhist <- hist(rnorm(n, mean=0,sd=1)) # for some large-ish n cumtest <- cumsum(testhist) cumref <- cumsum(refhist) plot(cumref,cumtest) This produces a straight line of slope 1 for a sample with the same
2001 Jul 18
1
hypothesis testing in models
Dear all, Being an economics student, I am trying to put together a little tutorial/FAQ/... for those who have (more) background in econometrics rather than in statistics -- just as I have. I'v been looking for a hypothesis testing tool in R (just linear or also nonlinear) for model parameters, but could not find anything so far. I did find a similar but unanswered question in the archives,
2006 Nov 12
7
I think a simple question
I have index ( of a vector ) values of say tempin<-c(1 31 61 91 121 all the way upto 1411) What I want is a function that takes in a number say, x = 5, and gives me an new vector of tempout<-1 6 31 36 91 96 121 126 .......... 1411 1416 This can't be so hard but I can't get it and I've honestly tried. Obviously, tempin + 5 gives me the missing values but I
2007 Dec 29
15
Do you think it would look cleaner?
I was looking over some of my specs. I was thinking that the following: @game.should_receive(:name).and_return(''The Battle for Blaze'') @game.should_receive(:people).and_return(5000000) @game.should_receive(:activated).and_return(true) Would it look cleaner if I could do this instead? @game.should_recieve_and_return( :name => ''The Battle for Blaze''
2007 Oct 11
6
confusion with R syntax
I just noticed something by accident with R syntax that I'm sure is correct but I don't understand it. If I have a simple numeric vector x and I subscript it, it seems that I can then subscript a second time with TRUE or FALSE, sort of like a 2 dimensional array in C. Does someone know if this is documented somewhere Because it's neat but I never knew it existed. To me it seems like a
2007 Oct 12
2
Plotting question
I am constructing plots ( regular not lattice ) and my initial command is par(mar=c(3,4,2,2), mfcol=c(5,2)) and then I create 10 plots on the page. It looks great but the plots on the page go in the order 1 6 2 7 3 8 4 9 5 10 Where the numbers denote decile breakdowns. Is there an easy way to make them go from left to right so 1 2 3 4 5 6 7 8 9 10 I could try
2006 Jun 08
0
Cleaner way to do this
is there a cleaner way to achieve this? // Is this the correct way? def show_servers @server_pages, @switch_servers = paginate :servers, :conditions=>["id in (select server_id from server_interfaces where server_interfaces.switch_interface_id in (select id from switch_interfaces where switch_id = ?) )",params[:id]], :per_page => 20, :order => "name" render
2006 Mar 02
0
Cleaner code in rails view
Hi all. Saw this trick on the ruby-talk list and wanted to share my use of it in a Rails view. Some other code allowed a record to be posted to the DB w/o a good referential link. IOW, the FK in the record pointed to a missing record in the linked to table. The Rails view just spit out an attribute of the linked table and that caused the app to crash because table1.table2 was nill and
2007 Feb 27
0
^*^ Best PC Optimizer and PC Cleaner ^*^
* [image: Best PC Optimizer] <http://www.awpedia.com/downloads/cCleaner/>** Over 48 million downloads!!!* * CCleaner <http://www.awpedia.com/downloads/cCleaner/> is a freeware system optimization and privacy tool. It removes unused files from your system - allowing Windows to run faster and freeing up valuable hard disk space. It also cleans traces of your online activities such as
2010 Dec 13
0
PATCH: btrfs ioctl for waiting for kernel cleaner thread task completions kernel code
the attached patch is against ubuntu maverick latest git, and I believe it is final. It is forward-compatible, as there is space in it to define 29 more deferred things to wait for, if needed, as well as a flag bit reserved for strict versioning. Calling it with a flags field of 0xFFFFFFFA will wait for everything it knows how to wait for, including things it doesn''t know how to wait for