Displaying 20 results from an estimated 2000 matches similar to: "Density plots"
2012 Aug 02
2
Help on merging without a common variable
Dear All,
I want to create a dataset for a NONMEM simulation. I have a dataframe with
individual PK parameters and want to create a dosing sceinario in a second
dataframe. I want to merge them both so that every individiual's PK
parameters are combined with the dosing scenario into one. I do not have a
common variable to merge and cbind is giving error that lengths are
different. I
2012 Jan 11
6
Generating unque patient IDs
Dear group,
I am trying to prepare a NONMEM friendly dataset for population PK
analysis. My patient IDs are 10 digit long and NONMEM is losing precison
and rouding the last couple of digits. I need to generate unique Patient
IDs fromt he current 10-digit IDs. Ihave total 250 subjects so I
appreciate if anybody can suggest me a way to code this in R.
Regards,
Ayyappa
[[alternative HTML
2012 May 02
2
selection by two unique variables
Dear Group,
I am working with a large dataset where I need to select for each unique id
the the unique lastpk row. Here is a sample subject:
id wtdt wt lastpk
64050256 2010-09-18 275 2010-09-16
64050256 2010-09-19 277 2010-09-18
64050256 2010-09-20 272 2010-09-18
64050256 2010-09-21 277 2010-09-18
I want the result as:
2011 Aug 29
2
Plot history
Dear R group,
I am trying to plot uisng a for loop. Here is the script:
for (i in unique(cfn$ID)){
plot(cfn$TIME[cfn$ID==i],cfn$DV[cfn$ID==i],pch=16)}
I could access only the last plot of the series and cannot go back to see
all the plots. I appreciate your help in resolving this issue and also
please suggest how I can export the plots as a pdf or other format files for
publication purposes.
2013 Apr 23
1
Time and Date formatting
Dear Group,
I have a problem with time date formatting. I have Date and Time in
different columns in a .csv file and want to have a column with Date and
Time together. I could format the date into the right mode using strptime
and as.Date functions. I am not able to do that with TIME column. I
appreciate your help in solving this issue. Currently the TIME column is
in character mode.
2012 Feb 29
1
Coding help
Dear Group,
I have the following dataset:
ID REPI DV CONC SS
1 1 156.84 116 0
1 2 146.56 116 0
1 3 115.13 116 0
1 4 207.81 116 0
1 5 129.53 116 0
1 6 151.48 116 0
1 7 158.95 116 0
1 8 192.37 116 0
1 9 32.97 116 0
1 10 151.66 116 0
I want to calculate the percentile of each CONC within ID=i and add as a
column
2008 Mar 10
2
Multiple density plots
Hi all,
I'm interested in doing a multiple density plot on a number of columns in a
dataframe.
>DF
lineA.1 lineA.2 lineB.1 lineB.2
r1 5.355354 6.665575 10.288498 11.74750
r2 3.643415 5.427600 11.407112 13.97065
r3 5.813674 6.438502 9.628871 11.57456
r4 5.241340 5.125049 10.456221 12.35381
r5 4.640885 8.635518 8.344704 11.98484
r6 4.559852 6.416171 10.419599 10.89247
r7
2008 Jun 26
2
density and jpeg
Dear R community, I am using densityplot (lattice package) for a large
dataset and wish to print it to a jpeg (the pdf is huge). R crashes
consistently. Am I doing it wrong or is densityplot incompatible with jpeg?
I work on a Mac, R 2.7.0.
> require(lattice)
> jpeg("test.jpeg")
> d[1:10]
[1] 0.700218 0.700175 0.700357 0.700847 0.698286 0.701520 0.698158 0.699300
0.698819
2006 Oct 25
1
density plot text
Is there any way of adding text to a density plot? I have had a go using the
text() function but I think the error is because this function doesn't work
with densityplot().
Alternatively, I understand I can achieve pretty much the same result if I
plot a density kernel estimate using plot() (which allows text()), but I do
prefer densityplot().
Also, is it possible to specify the dimensions
2011 Jul 18
1
plotting groups via density and different colors
I have a data set that looks like this:
dene <- data.frame(length =
c(35,32,33,34,41,40,46,35,41,40,45,36,38,37,39,40,42,42,42,43,44),
sex=c(1,1,1,1,2,2,2,1,2,2,2,1,2,2,2,2,2,2,2,2,2))
I would like to plot the density (frequency of occurrence) of each length
class but I want to have different colors for sex. I used the following:
library(sm)
sex.f<-factor(as.factor(dene$sex),levels=c(1,2),
2012 Nov 20
1
lattice density plot: add vertical lines at groupwise medians for all panels
Suppose you have the following code:
########## Start code##########
data(Chem97, package="mlmRev")
densityplot(~gcsescore | factor(score), groups=gender, data=Chem97,
auto.key=TRUE, plot.points=FALSE, ref=TRUE,
panel=function(x,...){
panel.densityplot(x,...)
median.values <- median(x)
2010 Dec 21
1
Density plot with lattice?
Hi,
Is it possible to remove the points at the base of a density plot?I would like to keep only the curves of the plot, not the points.
Thank you.
Marie-Helene HacheyM.Sc. studentUniversite Laval, Quebec
2012 Feb 22
1
Lattice and horizontally stacked density plots
Hello,
I am try to make a density plot where plots are stacked like the one
found here:
http://dsarkar.fhcrc.org/lattice/book/images/Figure_14_03_stdBW.png
I am facing problems, however. Using the code example below, I'd like
to generate a separate panel for each val of id2. Within each panel,
I'd like to have individual histograms each on separate lines based on
the value of id1. ?Note
2010 Apr 22
2
How to insert gridlines in lattice density plot
Greetings.
How can I insert gridlines
in the following density plot call?
Must one compose a panel function?
'data.frame': 46 obs. of 2 variables:
$ fallrates: num 5.2 7.1 7.1 9.8 3.7 7.5 5 6.2 1.5 2.9 ...
$ prepost : Factor w/ 2 levels "post","pre": 2 2 2 2 2 2 2 2 2 2 ...
library(lattice)
densityplot(~fallrates, groups = prepost,
2009 Apr 10
2
Stacked density plots
Hello R-community,
I want to generate stacked density plots in lattice. My data consist of a numeric variable ('pid') that is measured in different individuals ('id'), which can be divided in two types ('type') and the measurements were repeated a different time points ('day').
I read in the Lattice book that this can be done using the 'flowViz'
2010 May 11
1
kernel density to smooth plots
Hi r-sers,
I have a data of relative frequencies for the interval of 0-20, 20-40,...380-400. I would like the two data on the same graph using the same x-axis label. My question is how to get a smooth curve using kernel density code if it possible for this data.
> cbind(rel_obs,rel_gen)
rel_obs rel_gen
[1,] 0.000000000 0.0000
[2,] 0.092534175 0.0712
[3,] 0.105152471 0.1092
2006 Jan 17
2
Cumulative Density Plots (Hmisc/lattice)
I have been using the ECDF function in the Hmisc package to produce
cumulative distribution function plots. The problem is that for small
datasets the steps "look bad" (not my characterization but from the
client). Is there a way to get the same information but smoothed? I have
tried the densityplot (lattice), which gives a smoothed line, but this
does not give the cumulative density.
2012 Jan 04
1
Adding a vertical line to plot with two overlapping density plots
Hi,
A simple question I hope. I wish to add a single vertical line to a plot
with several density plots.
Here is a simplified example.
############
thedata <- data.frame(x1=rnorm(100,1,1),x2=rnorm(100,3,1)) #create data
thedata.m<-melt(thedata)
densityplot(~value, thedata.m, groups=variable,auto.key=list(columns=2))
#this gives the two density plots
#########
what I wish now is to add a
2012 Mar 08
1
Adding mean line to a lattice density plot
Hi!
I have used the following command:
densityplot(~PV1CIV, groups=SGENDER, data=ISGFINC2,
lwd=2, col=1, lty=c(1,2), pch=c("+","o"),
key=list(text=list(lab=levels(ISGFINC2$SGENDER), col=1),
space="bottom", columns=2, border=T, lines=T, lwd=2,
lty=c(1,2), col=1), ref=T, plot.points=F)
to produce a lattice density plot presenting the distribution of
2010 Dec 09
1
Condional Density Plot from different data
I'm not certain I am using the lattice plot correctly here. Below is reproducible code. Suppose I have two data frames, such as:
set.seed(1234)
datA <- data.frame(condition = gl(3, 100), scores = c(rnorm(100), rnorm(100, 1,1), rnorm(100, 2,1)))
datB <- data.frame(condition = gl(3, 1000), scores = c(rnorm(1000, 3,1), rnorm(1000, 4,1), rnorm(1000, 5,1)))
I would like to plot the