Displaying 20 results from an estimated 2000 matches similar to: "partial correlation significance"
2007 May 22
0
partial correlation function
Hi,
after reading the archives I found some methods... adopted and
modified one of them to the following. I think it is correct after
checking and comparing the results with other software... but if
possible someone could have a look and spot any mistakes I would be
grateful. Thanks
pcor3 <- function (x, test = T, p = 0.05, alternative="two.sided") {
nvar <- ncol(x)
ndata
2000 Feb 25
0
Summary: Partial correlation coefficients in R. Thanks everybody!
Hello all,
here's a collection of answers I got on my question concerning partial
correlation coefficients:
Some people gave a simple formula for the three-variable-case, as did Dave
Lucy:
pcor <- function(v1, v2, v3)
{
c12 <- cor(v1, v2)
c23 <- cor(v2, v3)
c13 <- cor(v1, v3)
partial <- (c12-(c13*c23))/(sqrt(1-(c13^2)) * sqrt(1-(c23^2)))
2003 Mar 31
4
Convert char vector to numeric table
I'm a great fan of read.table(), but this time the data had a lot of cruft. So I used readLines() and editted the char vector to eventually get something like this:
" 23.4 1.5 4.2"
" 19.1 2.2 4.1"
and so on. To get that into a 3 col numeric table, I first just used:
writeLines(data,"tempfile")
2013 Feb 20
2
xyplot help
I am ploting gridded time series data. I would like the actual lat and lon value appear on the graph-if possible inside the graph as numbers. If there is also more elegant ways to plot the graphs I will appreciate more suggestions.
#################################
library(ggplot2)
library(lattice)
month <- c("Jan", "Feb", "Mar", "Apr", "May",
2013 Feb 22
3
Help xyplot
Hi Mackay and anybody
(a) Is it possible to select randomly (let say five grids) and plot?
(b) Is it possible to plot five nearest grid in one figure?
The original question and improved codes:
#I am ploting gridded time series data. I would like the actual lat
#and lon value appear on the graph-if possible inside the graph as
#numbers. If there is also more elegant ways to plot the graphs I
2008 Mar 31
2
L-BFGS-B needs finite values of 'fn'
Dear All,
I am trying to solve the optimization problem below, but I am always
getting the following error:
Error in optim(rep(20, nvar), f, gr, method = "L-BFGS-B", lower = rep(0, :
L-BFGS-B needs finite values of 'fn'
Any ideas?
Thanks in advance,
Paul
-----------------------------------------------
k <- 10000
b <- 0.3
f <- function(x) {
n <- length(x)
2011 Jul 19
1
"may be used in an incorrect context"
R CMD check tells me
* checking R code for possible problems ... NOTE
agexact.fit.rds: ... may be used in an incorrect context: ?optim(init,
agfitfn, ...)?
Warning: <anonymous>: ... may be used in an incorrect context: ?optim(init, agfitfn, ...)?
Can anyone tell me what this message means? My searches haven't turned
up anything useful. This is with R 2.7 and 2.9.
The message
2012 Nov 26
1
Help on function please
Dear All,
I could use a bit of help here, this function is hard to figure out (for me at least) I have the following so far:
PKindex<-data.frame(Subject=c(1),time=c(1,2,3,4,6,10,12),conc=c(32,28,25,22,18,14,11))
Dose<-200
Tinf <-0.5
defun<- function(time, y, parms) {
dCpdt <- -parms["kel"] * y[1]
list(dCpdt)
}
modfun <- function(time,kel, Vd) {
out <-
2001 Feb 28
2
Automating the job?
Hi!
I just started to use R recently, and would like to ask a help about
automating the job.
I need to use "kmeans" function with my own 300 data files, and wonder if
it's possible to do it automatically. For example,
> library (mva)
> mydata <- read.table ("data1")
> cl <- kmeans(mydata, 5, 20)
and I just need to save "cl" info (i.e. the center
2013 Apr 25
1
lsfit: Error in formatting error message
Hi,
in R-3.0 I get the following error when calling lsfit with more
observations than variables, which seems to come from an error in the
formatting of the error message (note that this was not happening in
2.15.3):
> nobs <- 5; nvar <- 6; lsfit(matrix(runif(nobs*nvar), ncol=nvar),
runif(nobs), intercept=FALSE)
Error in sprintf(ngettext(nry, "%d response", "%d
2012 Feb 07
2
predict.naiveBayes() bug in e1071 package
Hi,
I'm currently using the R package e1071 to train naive bayes
classifiers and came across a bug: When the posterior probabilities of
all classes are small, the result from the predict.naiveBayes function
become NaNs. This is an issue with the treatment of the
log-transformed probabilities inside the predict.naiveBayes function.
Here is an example to demonstrate the problem (you might need
2001 May 09
1
Fortran subroutines dblepr, realpr, intpr
I am making my first attempts at using some Fortran code with R, and
so far it's going OK. To print from my Fortran programs, it seems I
need subroutines dblepr, realpr and intpr. From the excellent
"Writing R Extensions" document:
"Three subroutines are provided to ease the output of information
from FORTRAN code.
subroutine dblepr(label, nchar, data, ndata)
2011 Feb 25
1
help please ..simple question regarding output the p-value inside a function and lm
Dear R community members and R experts
I am stuck at a point and I tried with my colleagues and did not get it out.
Sorry, I need your help.
Here my data (just created to show the example):
# generating a dataset just to show how my dataset look like, here I have x
variables
# x1 .........to X1000 plus ind and y
ind <- c(1:100)
y <- rnorm(100, 10,2)
set.seed(201)
P <-
2008 Jan 14
2
Permutations of variables in a dataframe
Hallo All,
I would like to apply a function to all permutations of variables in a
dataframe (except the first). What is the best way to achieve this?
I produce the permutations using:
nvar <- ncol(dat) - 1
perms <- as.matrix( expand.grid(rep( list(1:0) , nvar ))[ , nvar:1] )
Thanks in advance
Serguei
Test-dataframe, comma-delimited:
code,wav,w,area,gdp,def,pop,coast,milspend,agr
2018 Oct 02
3
maximum matrix size
I am now getting the occasional complaint about survival routines that are not able to
handle big data.?? I looked in the manuals to try and update my understanding of max
vector size, max matrix, max data set, etc; but it is either not there or I missed it (the
latter more likely).?? Is it still .Machine$integer.max for everything??? Will that
change??? Found where?
I am going to need to go
2005 Jul 07
2
r: LOOPING
hi all
i know that one should try and limit the amount of looping in R
programs. i have supplied some code below. i am interested in seeing how
the code cold be rewritten if we dont use the loops.
a brief overview of what is done in the code.
==============================================
==============================================
==============================================
1. the input
2007 Feb 27
1
interactions and GAM
Dear R-users,
I have 1 remark and 1 question on the inclusion of interactions in the gam function from the gam package.
I need to fit quantitative predictors in interactions with factors. You can see an example of what I need in fig 9.13 p265 from Hastie and Tibshirani book (1990).
It's clearly stated that in ?gam "Interactions with nonparametric smooth terms are not fully
2013 Apr 01
2
Timing of SET_VECTOR_ELT
Assume a C program invoked by .Call, that returns a list.
Near the top of the program we allocate space for all the list elements. (It is my habit
to use "xyz2" for the name of the R object and "xyz" for the pointer to its contents.)
PROTECT(means2 = allocVector(REALSXP, nvar));
means = REAL(means2);
PROTECT(u2 = allocVector(REALSXP, nvar));
u =
2012 Oct 19
1
Looping survdiff
The number of recent questions from umn.edu makes me wonder if there's homework involved....
Simpler for your example is to use get and subset.
dat <- structure(..... as found below
var.to.test <- names(dat)[4:6] #variables of interest
nvar <- length(var.to.test)
chisq <- double(nvar)
for (i in 1:nvar) {
tfit <- survdiff(Surv(time, completion==2) ~
2013 Dec 08
2
How to evaluate sequence of strings like this
Hello Dear R community,
This is my problem. I have a data set (dataframe) called "mydat". It consist of 3 numerical variable. They are Centrecode, FSUSN and Round. I want to create unique ID by combining these 3 variables.
Follwing commands gives me what I need.
mydat1 <- paste(mydat$Centrecode, mydat$FSUSN,mydat$Round,sep="")
newds <- data.frame(mydat1)
For a