similar to: How to remove double loop?

Displaying 20 results from an estimated 10000 matches similar to: "How to remove double loop?"

2008 Jan 07
3
Polynomial fitting
I wonder how one in R can fit a 3rd degree polynomial to some data? Say the data is: y <- c(15.51, 12.44, 31.5, 21.5, 17.89, 27.09, 15.02, 13.43, 18.18, 11.32) x <- seq(3.75, 6, 0.25) And resulting degrees of polynomial are: 5.8007 -91.6339 472.1726 -774.2584 THanks in advance! -- Jonas Malmros Stockholm University Stockholm, Sweden
2008 Mar 19
3
How to remove double for loop?
Hello everyone. I use double for loops to fill in matrices, but there are surely better (and computationally faster) ways to perform that task. Could someone show me, given the following example of a double for loop, how this could be done? It is much easier to learn by examples. Val <- matrix(0, nrow=n+1, ncol=n+1) for( i in 0:n){ for(j in 0:i){ Val[j+1, i+1] <- u^j*d^(i-j)
2007 Dec 17
3
Cannot grasp how to apply "by" here...
I have a data frame named "database" with panel data, a little piece of which looks like this: Symbol Name Trial Factor1 Factor2 External 1 548140 A 1 -3.87 -0.32 0.01 2 547400 B 1 12.11 -0.68 0.40 3 547173 C 1
2007 Oct 27
3
How to make own function load automatically on startup
Dear list members, I have written a function, called say Analysis. I supply an Excel file name as an argument, it does analysis on this file and returns a pdf file with specific plots, and a text file with several statistical models' output (I extract certain values from the output and create my own custom dataframe with output). As of now I have to open the script file and load the function
2007 Dec 17
1
How to create a mixed col.names?
Hello, I have a vector of names, say : names <- c("Factor 1", "Factor 2", Factor 3") I am creating a dataframe and I want the column names to be mixed like this: "Factor 1" " Sign Factor 1" "Factor 2" "Sign Factor 2" "Factor 3" "Sign Factor 3" How can I automate the creation of such a mixed vector? I tried
2007 Nov 13
1
Cleaning database: grep()? apply()?
Dear R users, I have a huge database and I need to adjust it somewhat. Here is a very little cut out from database: CODE NAME DATE DATA1 4813 ADVANCED TELECOM 1987 0.013 3845 ADVANCED THERAPEUTIC SYS LTD 1987 10.1 3845 ADVANCED THERAPEUTIC SYS LTD 1989 2.463 3845 ADVANCED THERAPEUTIC SYS LTD 1988 1.563 2836 ADVANCED TISSUE
2007 Oct 31
1
textplot() in gplots causes problems (0x9)
Hello, I am using textplot function in gplots package to put some model output inside a PDF file, but it does not seem to work properly with PDF. I am doing follwing: pdf(file="C:/...", paper="a4", width=8, height=12) .model <- lm(.model.formula, data=database) textplot(capture.output(summary(.model)), valign="top", halign="left") I am getting these
2007 Oct 26
1
glm with Student t for error distribution
Hello, My response variable seems to be distributed according to Student t with df=4. I have 320 observations and about 20 variables. I am wondering whether there is a way to fit glm with Student t for error distribution. Student t is not one of the family choices in glm function. How should I proceed to fit glm with Student t? I know that Student t is the Inverse Gamma with shape parameter
2007 Dec 20
1
Computing normal conf.intervals
Hi everybody, I wonder if there is a built-in function similar to Matlab's "normfit" which computes 95% CI based on the normality assumption. So, I have a vector of values and I want to calculate 95% normal CI. Of course, I could write my own function, no problem, but I still wonder if built-in functionality exists. (I wish quantile() had this functionality included). Anyone knows?
2019 Sep 03
2
oval support for centos
We use oval to check the system vulnerability. Redhat offer official oval(https://www.redhat.com/security/data/oval/), and it works well on redhat. There is no official centos oval, and using redhat oval on centos got false results. centos is based redhat, so I wrote a script fetch redhat oval files and convert it to useful for centos. And I push the oval to my github:
2013 Jul 02
1
[PATCH] drm/nv50-/disp: Use output specific mask in interrupt
The commit commit 476e84e126171d809f9c0b5d97137f5055f95ca8 Author: Ben Skeggs <bskeggs at redhat.com> Date: Mon Feb 11 09:24:23 2013 +1000 drm/nv50-/disp: initial supervisor support for off-chip encoders changed the write mask in one of the interrupt functions for on-chip encoders, causing a regression in certain VGA dual-head setups. This commit reintroduces the mask
2009 Nov 08
3
MCMC gradually slows down
Hello, I have written a simple Metropolis-Hastings MCMC algorithm for a binomial parameter: MHastings = function(n,p0,d){ theta = c() theta[1] = p0 t =1 while(t<=n){ phi = log(theta[t]/(1-theta[t])) phisim = phi + rnorm(1,0,d) thetasim = exp(phisim)/(1+exp(phisim)) r = (thetasim)^4*(1-thetasim)^8/(theta[t]^4*(1-theta[t])^8) if(runif(1,0,1)<r){ theta[t+1] = thetasim }
2020 Aug 04
3
CentOS Security Advisories OVAL feed??
Dear List, I have spent some time playing around with oscap and the RHEL OVAL feed (https://www.redhat.com/security/data/oval/v2/RHEL8/, also check Chapter 16 of the RHEL 8 Design Guide). Because I could not find an existing OVAL file for CentOS, I downloaded one of the RHEL8 files and managed to modify (eg. the rhel-8.1-e4s.oval.xml) it to make it work on a CentOS machine. Basically I just
2003 Apr 18
2
Question about PAM clustering method
Hello everyone. I just started learning R for clustering analysis in my research project. I tried k-means method and PAM method, both of which were properly processed with my data. I have some questions about PAM graphical output. Suppose to do the commands shown below; pm<-pam(D, 6) plot(pm) I got two charts after prompted. In the first chart, 6 oval clusters are drawn together
2017 Feb 01
2
CentOS 7.3.1611 scap-security-guide issue
Hello, I have noticed that pci-dss profile, ssg-centos7-xccdf.xml will always fail on test and remediation for disable_prelink rule. That seem to be caused by insufficient CentOS RPM customization of upstream code. Specifically this: https://github.com/OpenSCAP/scap-security-guide/blob/master/shared/oval/disable_prelink.xml#L24-L35
2010 Dec 24
1
Help required: binomial option pricing using package
I'm using the CRRBinomialTreeOption function (in package "fOptions") with a loop for pricing a large number of options. But I can't transfer the values obtained from this function to a "numeric" matrix as the outcome of this function is not a simple numeric. The following is the piece of code: # USING THE FUNCTION library(fOptions)
2013 Feb 25
3
How to plot 2 continous variables on double y-axis with 2 factors: ggplot2, gplot, lattice, sciplot?
Hi, I have a data set with two continous variables that I want to plot MEANS (I am not intrerested in median values) on a double-y graph. I also have 2 factors. I want the factor combinations plotted in different panes. Dummy dataset: mydata <- data.frame(factor1 = factor(rep(LETTERS[1:3], each = 40)), factor2 = factor(rep(c(1:4), each = 10)), y1 =
2020 Aug 05
3
CentOS Security Advisories OVAL feed??
On 05/08/2020 16:49, Johnny Hughes wrote: > On 8/5/20 1:05 AM, centos at niob.at wrote: >> On 04/08/2020 23:50, Jon Pruente wrote: >>> On Tue, Aug 4, 2020 at 11:34 AM <centos at niob.at> wrote: >>> >>>> Q5) If the answer to the last question is "no": shouldn't there be such >>>> a resource? >>>> >>> CentOS
2012 Feb 01
3
Configuration Compliance auditing for many CentOS 5.x boxes
Hi CentOS experts,* Short Version* I would like to produce a weekly report in HTML for each CentOS 5.x server we have indicating configuration compliance with some industry benchmark. I am looking for a tool or tools to implement this, I am happy to use 3rd party proprietary stuff if necessary. * Long(er) Version* Current Situation.. I have a client with many (200x) CentOS 5.x servers
2009 Jul 09
1
Bug in package.skeleton, R 2.9.0?
Dear all, I am using package.skeleton to build a small packages of misc function for personal use. I have recently discovered that the option force=TRUE doesn't seem to do what is meant to do. Here's what I'm doing: > setwd("/Users/danielk/Documents/R/packages/dk") > files <- paste("codebase", dir("codebase", pattern=".R"),