Displaying 13 results from an estimated 13 matches for "meanx".
Did you mean:
means
2011 Apr 07
1
dotplot as a background for multiple barchart plots (with Lattice)
...an
### dummy data building
test <- data.frame(Subject=rep(c("A", "B", "C", "D"), each=6),
Type=rep(c("EEE", "FFF", "GGG", "HHH", "III",
"JJJ"), times=4),
MeanX=abs(rnorm(24)),
MeanZ=abs(rnorm(24)))
### data for regrouping all means
all <- data.frame(Type=levels(factor(test$Type)), MeanX = c(0), MeanZ =
c(0))
### building means...
for(s in levels(factor(test$Subject)))
{
tmp <- data.frame(Type = all$Type)
for(t in tmp...
2005 Oct 05
1
(no subject)
...2,1)
v=matrix(c(1,0,0,1),2,2)
Y=function(X1,X2,mu=m,V=v)
{
X=matrix(c(X1,X2),2,1)
a=(1/((2*pi)*sqrt(det(V))))*exp((-0.5)*(t(X-mu)%*%solve(V)%*%(X-mu)))
a[1]
}
x1=seq(-1,1)
x2=x1
Z=outer(x1,x2,FUN="Y",mu=m,V=v)
persp(x1,x2,Z)
my code:
BINORMAL<-function(varx=1,vary=1,covxy=0,meanx=0,meany=0)
{
#the following function plots the density of a bi variate normal distribution
covXY<-matrix(c(varx,covxy,covxy,vary),2,2)
A<-solve(covXY)
#up<-max(meanx+4*varx^.5,meanx-4*varx^.5,meany+4*vary^.5,meany-4*vary^.5)
#x <- seq(-up,up,length=50)
#y <- x
x <- seq(m...
2006 Apr 08
1
add lines to a plot with a loop without erase the last one
...in 1:n)
{
epsilon<-rnorm(length(s),0,sqrt(var))
for (j in 1:(length(s)))
{
data[j,i]<-((alpha*s[j]) / (s[j] + beta)) + (epsilon[j]*(s[j]/(s[j] +
beta)))
b<-data[,i]
}
#print(b)
X<-b[-1]/s[-1]
#print(X)
#print(X)
#print(length(b[-1]))
#print(length(X))
meanX<-mean(X)
#print(meanX)
meanV<-mean(b)
#print(meanV)
betachap[i]<-((meanX*squareproduct(b[-1],b[-1]))-
(meanV*squareproduct(X,b[-1])))/((meanV*squareproduct(X,X))-
(meanX*squareproduct(X,b[-1])))
alphachap[i]<-meanV + betachap[i]*meanX
varchap[i]<-((squareproduct(b[-1],b[-1])) +
(2*b...
2011 Aug 12
2
recode Variable in dependence of values of two other variables
Hi,
as an R-beginner, I have a recoding problem and hope you can help me:
I am working on a SPSS dataset, which I loaded into R (load("C:/...)
I have 2 existing Variables: "ID" and "X" ,
and one variable to be computed: meanX.dependID (=mean of X for all rows
in which ID has the same value)
ID = subject ID. Since it is a longitudinal dataset, there are repeated
measurement points for each subject, each of which appears in a new row.
So, each ID value appears in many rows. (e.g. ID ==1 in row 1:5; ID ==2
in rows 6:...
2011 Aug 11
1
Splitting data
...dy =
for (i in 1:length(n)){
split <- length(data)/(n[i])
for (j in 1:(n[i]/2)){
x = data[(1 + (j-1)*(2*split)):(round(split) + (j-1)*(2*split))]
dx = cbind(dx,x)
y = data[((round(split)+1) + (j-1)*(2*split)):(2*j*split)]
dy = cbind(dy,y)
}}
dx = dx[,2:dim(dx)[2]]
dy = dy[,2:dim(dy)[2]]
k=0
meanx=0
meany=0
sdx=0
sdy=0
nx=0
ny=0
for (k in 1:dim(dx)[2]) {
meanx[k] = mean(unique(dx[,k]))
meany[k] = mean(unique(dy[,k]))
sdx[k] = sd(unique(dx[,k]))
sdy[k] = sd(unique(dy[,k]))
nx[k] = length(unique(dx[,k]))
ny[k] = length(unique(dy[,k]))
}
t = (meanx-meany)/sqrt((sdx^2/nx) + (sdy^2/ny))
df = ((...
2008 Jul 25
2
Fit a 3-Dimensional Line to Data Points
Hi Experts,
I am new to R, and was wondering how to do 3D linear
regression in R. In other words, I need to Fit a
3-Dimensional Line to Data Points (input).
I googled before posting this, and found that it is
possible in Matlab and other commercial packages. For
example, see the Matlab link:
2008 Jul 06
3
Lots of huge matrices, for-loops, speed
Hello,
we have 80 text files with matrices. Each matrix represents a map (rows for
latitude and columns for longitude), the 80 maps represent steps in time. In
addition, we have a vector x of length 80. We would like to compute a
regression between matrices (response through time) and x and create maps
representing coefficients, r2 etc. Problem: the 80 matrices are of the size
4000 x 3500 and we
2011 Nov 22
3
Binned line plot
I have a scatter plot with 10000 points.? I would like to add a line that bins every 50 points and connects the average of each bin.? I'm looking for something similar to line type "m" in Stata.
With this dataset of 10000 points, I would also like to bin the data and make boxplots at certain intervals, so that I have a set of boxplots to represent each bin.? I would also like the
2005 Jul 21
0
reorder bug in heatmap.2?
I want to plot a heatmap without reordering the columns. This works
fine in "heatmap":
> heatmap(meanX[selected,], col=cm.colors(256), Colv=NA)
But in "heatmap.2" I get:
> heatmap.2(meanX[selected,], col=cm.colors(256), Colv=NA)
Error in if (!is.logical(Colv) || Colv) ddc <- reorder(ddc, Colv) :
missing value where TRUE/FALSE needed
(Note that instructions for the use of "C...
2010 Aug 09
1
nested 'by'
...01 14 5
15 45678 1902 15 4
16 45678 1900 16 3
17 45678 1901 17 2
18 45678 1902 18 1
result<-by(example[,3:4], example$id, by(example[,3:4],
example$Year,colMeans, na.rm=T))
Error in FUN(X[[1L]], ...) : could not find function "FUN
desired result should look like:
id Year meanx mean y
1 12345 1900 ... ...
2 12345 1901 ...
3 12345 1902 ...
4 54321 1900
5 54321 1901
6 54321 1902
7 45678 1900
8 45678 1901
9 45678 1902
[[alternative HTML version deleted]]
2010 Dec 08
1
the output of function lars
..."lambda" "R2"
[6] "RSS" "Cp" "actions" "entry" "Gamrat"
[11] "arc.length" "Gram" "beta" "mu" "normx"
[16] "meanx"
I do not know what does RSS, arc.length, mu mean???
If mu means \hat{miu}, it does not seems to be right. I did not simulate my
data with mean.
besides I caculated R2 by myself but it cannot match the R2here
I think R2=1-sum((y-x%*%lobj$beta)^2)/var(y)*19 #I have 20 observations...my
R2...
2006 Oct 30
2
how to set debug breaks
Hi,
I am new in R and have some frustrations as how to set debug breaks during
emacs R debug. I use debug () as where or which function to debug. But
during the debug, e.g., I have a for loop at the beginning of the function
code and want the code execution to jump through that for loop and set a
break after that. How to do that? Is there a web site detailing the syntax
of the debugging of R?
2010 Apr 06
1
Caret package and lasso
Dear all,
I have used following code but everytime I encounter a problem of not having
coefficients for all the variables in the predictor set.
# code
rm(list=ls())
library(caret)
# generating response and design matrix
X<-matrix(rnorm(50*100),nrow=50)
y<-rnorm(50*1)
# Applying caret package
con<-trainControl(method="cv",number=10)
data<-NULL
data<- train(X,y,