<?xml version="1.0" encoding="UTF-8"?>
<PharmML 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns="http://www.pharmml.org/pharmml/0.8/PharmML"
	xsi:schemaLocation="http://www.pharmml.org/pharmml/0.8/PharmML http://www.pharmml.org/pharmml/0.8/PharmML"
	xmlns:math="http://www.pharmml.org/pharmml/0.8/Maths"
	xmlns:ct="http://www.pharmml.org/pharmml/0.8/CommonTypes"
	xmlns:ds="http://www.pharmml.org/pharmml/0.8/Dataset"
	xmlns:mdef="http://www.pharmml.org/pharmml/0.8/ModelDefinition"
	xmlns:mstep="http://www.pharmml.org/pharmml/0.8/ModellingSteps"
	xmlns:design="http://www.pharmml.org/pharmml/0.8/TrialDesign"
	writtenVersion="0.8.1">
	<ct:Name>Generated from MDL. MOG ID: example334</ct:Name>
	<IndependentVariable symbId="T"/>
	<ct:FunctionDefinition xmlns="http://www.pharmml.org/pharmml/0.8/CommonTypes"
		symbolType="real"
		symbId="additiveError">
	    <ct:Description>Constant or additive error model</ct:Description>
	    <ct:FunctionArgument symbolType="real" symbId="additive"/>
	    <ct:Definition>
	        <Assign>
	           <ct:SymbRef symbIdRef="additive"/>
	        </Assign>
	    </ct:Definition>
	</ct:FunctionDefinition>
	<ModelDefinition xmlns="http://www.pharmml.org/pharmml/0.8/ModelDefinition">
		<VariabilityModel blkId="vm_err" type="residualError">
			<Level symbId="DV"/>
		</VariabilityModel>
		<VariabilityModel blkId="vm_mdl" type="parameterVariability">
			<Level symbId="MDL__prior"/>
			<Level symbId="ID">
				<ParentLevel>
					<ct:SymbRef symbIdRef="MDL__prior"/>
				</ParentLevel>
			</Level>
		</VariabilityModel>
		<ParameterModel blkId="pm">
			<PopulationParameter symbId="MU_POP_K">
				<ct:Assign>
					<ct:Real>0.1</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="MU_POP_V">
				<ct:Assign>
					<ct:Int>8</ct:Int>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="VAR_POP_K">
				<ct:Assign>
					<ct:Real>0.3</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="VAR_POP_V">
				<ct:Assign>
					<ct:Real>0.3</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="a_OMEGA_K">
				<ct:Assign>
					<ct:Real>0.1</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="b_OMEGA_K">
				<ct:Assign>
					<ct:Real>0.1</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="a_OMEGA_V">
				<ct:Assign>
					<ct:Real>0.1</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="b_OMEGA_V">
				<ct:Assign>
					<ct:Real>0.1</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="a_OMEGA_T">
				<ct:Assign>
					<ct:Real>0.3</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="b_OMEGA_T">
				<ct:Assign>
					<ct:Real>0.3</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="a_POP_T">
				<ct:Assign>
					<ct:Real>0.1</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="b_POP_T">
				<ct:Assign>
					<ct:Real>0.1</ct:Real>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="R_mat">
				<ct:Assign>
					<ct:Matrix matrixType="Any">
						<ct:MatrixRow>
							<ct:Assign>
								<ct:Int>1</ct:Int>
							</ct:Assign>
							<ct:Assign>
								<ct:Real>0.1</ct:Real>
							</ct:Assign>
						</ct:MatrixRow>
						<ct:MatrixRow>
							<ct:Assign>
								<ct:Real>0.1</ct:Real>
							</ct:Assign>
							<ct:Assign>
								<ct:Int>1</ct:Int>
							</ct:Assign>
						</ct:MatrixRow>
					</ct:Matrix>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="rho">
				<ct:Assign>
					<ct:Int>2</ct:Int>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="lMU_POP_K">
				<ct:Assign>
					<math:Uniop op="log">
						<ct:SymbRef blkIdRef="pm" symbIdRef="MU_POP_K"/>
					</math:Uniop>	
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="lMU_POP_V">
				<ct:Assign>
					<math:Uniop op="log">
						<ct:SymbRef blkIdRef="pm" symbIdRef="MU_POP_V"/>
					</math:Uniop>	
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="lPOP_K">
				<ct:VariabilityReference>
					<ct:SymbRef blkIdRef="vm_mdl" symbIdRef="MDL__prior"/>
				</ct:VariabilityReference>
				<Distribution>
					<ProbOnto xmlns="http://www.pharmml.org/probonto/ProbOnto" name="Normal2">
						<Parameter name="mean">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="lMU_POP_K"/>
							</ct:Assign>
						</Parameter>
						<Parameter name="var">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="VAR_POP_K"/>
							</ct:Assign>
						</Parameter>
					</ProbOnto>
				</Distribution>
			</PopulationParameter>
			<PopulationParameter symbId="lPOP_V">
				<ct:VariabilityReference>
					<ct:SymbRef blkIdRef="vm_mdl" symbIdRef="MDL__prior"/>
				</ct:VariabilityReference>
				<Distribution>
					<ProbOnto xmlns="http://www.pharmml.org/probonto/ProbOnto" name="Normal2">
						<Parameter name="mean">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="lMU_POP_V"/>
							</ct:Assign>
						</Parameter>
						<Parameter name="var">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="VAR_POP_V"/>
							</ct:Assign>
						</Parameter>
					</ProbOnto>
				</Distribution>
			</PopulationParameter>
			<PopulationParameter symbId="POP_K">
				<ct:Assign>
					<math:Uniop op="exp">
						<ct:SymbRef blkIdRef="pm" symbIdRef="lPOP_K"/>
					</math:Uniop>	
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="POP_V">
				<ct:Assign>
					<math:Uniop op="exp">
						<ct:SymbRef blkIdRef="pm" symbIdRef="lPOP_V"/>
					</math:Uniop>	
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="invOMEGA_P">
				<ct:VariabilityReference>
					<ct:SymbRef blkIdRef="vm_mdl" symbIdRef="MDL__prior"/>
				</ct:VariabilityReference>
				<Distribution>
					<ProbOnto xmlns="http://www.pharmml.org/probonto/ProbOnto" name="Wishart2">
						<Parameter name="inverseScaleMatrix">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="R_mat"/>
							</ct:Assign>
						</Parameter>
						<Parameter name="degreesOfFreedom">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="rho"/>
							</ct:Assign>
						</Parameter>
					</ProbOnto>
				</Distribution>
			</PopulationParameter>
			<PopulationParameter symbId="OMEGA_P">
				<ct:Assign>
					<math:MatrixUniop op="inverse">
						<ct:SymbRef blkIdRef="pm" symbIdRef="invOMEGA_P"/>
					</math:MatrixUniop>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="TAU_T">
				<ct:VariabilityReference>
					<ct:SymbRef blkIdRef="vm_mdl" symbIdRef="MDL__prior"/>
				</ct:VariabilityReference>
				<Distribution>
					<ProbOnto xmlns="http://www.pharmml.org/probonto/ProbOnto" name="Gamma2">
						<Parameter name="shape">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="a_OMEGA_T"/>
							</ct:Assign>
						</Parameter>
						<Parameter name="rate">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="b_OMEGA_T"/>
							</ct:Assign>
						</Parameter>
					</ProbOnto>
				</Distribution>
			</PopulationParameter>
			<PopulationParameter symbId="OMEGA_T">
				<ct:Assign>
					<math:Binop op="divide">
						<ct:Int>1</ct:Int>
						<ct:SymbRef blkIdRef="pm" symbIdRef="TAU_T"/>
					</math:Binop>
				</ct:Assign>
			</PopulationParameter>
			<PopulationParameter symbId="POP_T">
				<ct:VariabilityReference>
					<ct:SymbRef blkIdRef="vm_mdl" symbIdRef="MDL__prior"/>
				</ct:VariabilityReference>
				<Distribution>
					<ProbOnto xmlns="http://www.pharmml.org/probonto/ProbOnto" name="Gamma2">
						<Parameter name="shape">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="a_POP_T"/>
							</ct:Assign>
						</Parameter>
						<Parameter name="rate">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="b_POP_T"/>
							</ct:Assign>
						</Parameter>
					</ProbOnto>
				</Distribution>
			</PopulationParameter>
			<RandomVariable symbId="DIST_K_V">
				<ct:VariabilityReference>
					<ct:SymbRef blkIdRef="vm_mdl" symbIdRef="ID"/>
				</ct:VariabilityReference>
				<Distribution>
					<ProbOnto xmlns="http://www.pharmml.org/probonto/ProbOnto" name="MultivariateNormal2">
						<Parameter name="mean">
							<ct:Assign>
								<ct:Vector>
									<ct:VectorElements>
										<math:Uniop op="log">
											<ct:SymbRef blkIdRef="pm" symbIdRef="POP_K"/>
										</math:Uniop>	
										<math:Uniop op="log">
											<ct:SymbRef blkIdRef="pm" symbIdRef="POP_V"/>
										</math:Uniop>	
									</ct:VectorElements>
								</ct:Vector>
							</ct:Assign>
						</Parameter>
						<Parameter name="precisionMatrix">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="invOMEGA_P"/>
							</ct:Assign>
						</Parameter>
					</ProbOnto>
				</Distribution>
			</RandomVariable>
			<RandomVariable symbId="eta_T">
				<ct:VariabilityReference>
					<ct:SymbRef blkIdRef="vm_mdl" symbIdRef="ID"/>
				</ct:VariabilityReference>
				<Distribution>
					<ProbOnto xmlns="http://www.pharmml.org/probonto/ProbOnto" name="Normal2">
						<Parameter name="mean">
							<ct:Assign>
								<ct:Int>0</ct:Int>
							</ct:Assign>
						</Parameter>
						<Parameter name="var">
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="OMEGA_T"/>
							</ct:Assign>
						</Parameter>
					</ProbOnto>
				</Distribution>
			</RandomVariable>
			<IndividualParameter symbId="K">
				<ct:Assign>
					<math:Uniop op="exp">
						<ct:VectorSelector>
							<ct:SymbRef blkIdRef="pm" symbIdRef="DIST_K_V"/>
							<ct:Cell>
								<ct:Assign>
									<ct:Int>1</ct:Int>
								</ct:Assign>
							</ct:Cell>
						</ct:VectorSelector>
					</math:Uniop>	
				</ct:Assign>
			</IndividualParameter>
			<IndividualParameter symbId="V">
				<ct:Assign>
					<math:Uniop op="exp">
						<ct:VectorSelector>
							<ct:SymbRef blkIdRef="pm" symbIdRef="DIST_K_V"/>
							<ct:Cell>
								<ct:Assign>
									<ct:Int>2</ct:Int>
								</ct:Assign>
							</ct:Cell>
						</ct:VectorSelector>
					</math:Uniop>	
				</ct:Assign>
			</IndividualParameter>
			<IndividualParameter symbId="TAU">
				<StructuredModel>
					<Transformation type="log" />
					<LinearCovariate>
						<PopulationValue>
							<ct:Assign>
								<ct:SymbRef blkIdRef="pm" symbIdRef="POP_V"/>
							</ct:Assign>
						</PopulationValue>
					</LinearCovariate>
					<RandomEffects>
						<ct:SymbRef blkIdRef="pm" symbIdRef="eta_T"/>
					</RandomEffects>
				</StructuredModel>
			</IndividualParameter>
			<IndividualParameter symbId="SD_ADD">
				<ct:Assign>
					<math:Binop op="divide">
						<ct:Int>1</ct:Int>
						<math:Uniop op="sqrt">
							<ct:SymbRef blkIdRef="pm" symbIdRef="TAU"/>
						</math:Uniop>	
					</math:Binop>
				</ct:Assign>
			</IndividualParameter>
			<RandomVariable symbId="eps">
				<ct:VariabilityReference>
					<ct:SymbRef blkIdRef="vm_err" symbIdRef="DV"/>
				</ct:VariabilityReference>
				<Distribution>
					<ProbOnto xmlns="http://www.pharmml.org/probonto/ProbOnto" name="Normal2">
						<Parameter name="mean">
							<ct:Assign>
								<ct:Int>0</ct:Int>
							</ct:Assign>
						</Parameter>
						<Parameter name="var">
							<ct:Assign>
								<ct:Int>1</ct:Int>
							</ct:Assign>
						</Parameter>
					</ProbOnto>
				</Distribution>
			</RandomVariable>
		</ParameterModel>
		<StructuralModel blkId="sm">
			<ct:Variable symbId="DOSE" symbolType="real">
			</ct:Variable>
			<ct:Variable symbId="C" symbolType="real">
				<ct:Assign>
					<math:Binop op="times">
						<math:Binop op="divide">
							<ct:SymbRef blkIdRef="sm" symbIdRef="DOSE"/>
							<ct:SymbRef blkIdRef="pm" symbIdRef="V"/>
						</math:Binop>
						<math:Uniop op="exp">
							<math:Binop op="times">
								<math:Uniop op="minus">
									<ct:SymbRef blkIdRef="pm" symbIdRef="K"/>
								</math:Uniop>
								<ct:SymbRef symbIdRef="T"/>
							</math:Binop>
						</math:Uniop>	
					</math:Binop>
				</ct:Assign>
			</ct:Variable>
		</StructuralModel>
		<ObservationModel blkId="om1">
			<ContinuousData>
				<Standard symbId="Y">
					<Output>
						<ct:SymbRef blkIdRef="sm" symbIdRef="C"/>
					</Output>
					<ErrorModel>
						<ct:Assign>
							<math:FunctionCall>
								<ct:SymbRef symbIdRef="additiveError"/>
								<math:FunctionArgument symbId="additive">
									<ct:SymbRef blkIdRef="pm" symbIdRef="SD_ADD"/>
								</math:FunctionArgument>
							</math:FunctionCall>
						</ct:Assign>
					</ErrorModel>
					<ResidualError>
						<ct:SymbRef blkIdRef="pm" symbIdRef="eps"/>
					</ResidualError>
				</Standard>
			</ContinuousData>
		</ObservationModel>
	</ModelDefinition>
	<TrialDesign xmlns="http://www.pharmml.org/pharmml/0.8/TrialDesign">
		<ExternalDataSet toolName="NONMEM" oid="nm_ds">
			<ColumnMapping>
				<ColumnRef xmlns="http://www.pharmml.org/pharmml/0.8/Dataset" columnIdRef="ID"/>
				<ct:SymbRef blkIdRef="vm_mdl" symbIdRef="ID"/>
			</ColumnMapping>
			<ColumnMapping>
				<ColumnRef xmlns="http://www.pharmml.org/pharmml/0.8/Dataset" columnIdRef="AMT"/>
				<math:Piecewise>
					<math:Piece>
						<ct:SymbRef blkIdRef="sm" symbIdRef="DOSE"/>
						<math:Condition>
							<math:LogicBinop op="gt">
								<ds:ColumnRef columnIdRef="AMT"/>
								<ct:Int>0</ct:Int>
							</math:LogicBinop>
						</math:Condition>
					</math:Piece>
				</math:Piecewise>
			</ColumnMapping>
			<ColumnMapping>
				<ColumnRef xmlns="http://www.pharmml.org/pharmml/0.8/Dataset" columnIdRef="TIME"/>
				<ct:SymbRef symbIdRef="T"/>
			</ColumnMapping>
			<ColumnMapping>
			    <ColumnRef xmlns="http://www.pharmml.org/pharmml/0.8/Dataset" columnIdRef="DV"/>
				<ct:SymbRef blkIdRef="om1" symbIdRef="Y"/>
			</ColumnMapping>
			<DataSet xmlns="http://www.pharmml.org/pharmml/0.8/Dataset">
				<Definition>
					<Column columnId="ID" columnType="id" valueType="int" columnNum="1"/>
					<Column columnId="AMT" columnType="dose" valueType="real" columnNum="2"/>
					<Column columnId="TIME" columnType="idv" valueType="real" columnNum="3"/>
					<Column columnId="DV" columnType="dv" valueType="real" columnNum="4"/>
					<Column columnId="MDV" columnType="mdv" valueType="int" columnNum="5"/>
				</Definition>
				<ExternalFile oid="id">
					<path>TestData.csv</path>
					<format>CSV</format>
					<delimiter>COMMA</delimiter>
				</ExternalFile>
			</DataSet>
		</ExternalDataSet>
	</TrialDesign>
	<ModellingSteps xmlns="http://www.pharmml.org/pharmml/0.8/ModellingSteps">
		<EstimationStep oid="estimStep_1">
			<ExternalDataSetReference>
				<ct:OidRef oidRef="nm_ds"/>
			</ExternalDataSetReference>
			<ParametersToEstimate>
				<ParameterEstimation>
					<ct:SymbRef blkIdRef="pm" symbIdRef="lPOP_K"/>
				</ParameterEstimation>
				<ParameterEstimation>
					<ct:SymbRef blkIdRef="pm" symbIdRef="lPOP_V"/>
				</ParameterEstimation>
				<ParameterEstimation>
					<ct:SymbRef blkIdRef="pm" symbIdRef="invOMEGA_P"/>
				</ParameterEstimation>
				<ParameterEstimation>
					<ct:SymbRef blkIdRef="pm" symbIdRef="TAU_T"/>
				</ParameterEstimation>
				<ParameterEstimation>
					<ct:SymbRef blkIdRef="pm" symbIdRef="POP_T"/>
				</ParameterEstimation>
			</ParametersToEstimate>
			<Operation order="1" opType="generic">
				<Property name="algo">
					<ct:Assign>
						<ct:String>mcmc</ct:String>
					</ct:Assign>
				</Property>
			</Operation>
			<Operation order="2" opType="BUGS">
				<Property name="nchains">
					<ct:Assign>
						<ct:Int>1</ct:Int>
					</ct:Assign>
				</Property>
				<Property name="burnin">
					<ct:Assign>
						<ct:Int>1</ct:Int>
					</ct:Assign>
				</Property>
				<Property name="niter">
					<ct:Assign>
						<ct:Int>1</ct:Int>
					</ct:Assign>
				</Property>
				<Property name="winbugsgui">
					<ct:Assign>
						<ct:String>true</ct:String>
					</ct:Assign>
				</Property>
			</Operation>
		</EstimationStep>
		<mstep:StepDependencies>
			<mstep:Step>
				<ct:OidRef oidRef="estimStep_1"/>
			</mstep:Step>
		</mstep:StepDependencies>
	</ModellingSteps>		
</PharmML>
